Announcement

Collapse
No announcement yet.

OK, now how do I get time to change?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    OK, now how do I get time to change?

    I have an event I only want to happen at night. I'm trying to get time to
    change while you're running around the map (I'll key the event to a flag
    that is only on when it is nighttime)...but I'm having issues. I can't find a way to change time while the players are in the village. I tried doing a random number genertion between 1-100 and if less than 50, turn on night, more than 50 turn on day, and triggering it everytime someone walked in a building, but it doesn't seem to work. And if I run a constant script with time slowly changing after so many frames, my characters can't move. Any ideas?
    Thanks a lot!

    #2
    Re: OK, now how do I get time to change?

    Well this is where action script come into play. Action scripts run in the background so they still allow player movement.

    So create an event called Timer. Then in the motion slot of the event put this script.

    Action Script: Clock

    Script: Apply Together // might not be needed but doesn't hurt
    Script Branch: Repeat: Flag [Off(fixed)] Off
    -Script Branch: Repeat: Variable [Hours] < 24
    --Data: Variable: [Hours] = [Hours] + 1
    --Other: Wait 30F // you can change this to whatever wait you want right now it is 1 sec an hour since 30F = 1sec
    -Script: Branch End
    -Data: Variable: [Hours] = 0 + 0; // very important to reset this.
    Script: Branch End

    Them put your timer event on every map (make it an event with no model and no apply script). For an example of this look at the sign in the preset data, and the time change (#241 in preset data) script.

    Then in your event you only want to happen at night, check to see if the hours variable is say > 20 (8PM) and < 6 (6AM). Of course it is easy to make this do minutes and seconds.

    The reason why it did not work before is that content scripts stall the game while they are running so you cannot move etc while they are running, action scripts however run in the background (though I would be careful making them too complicated as they can freeze the game if you do, so just be careful when using them, but the one above is just fine as I have a more complicated version of this in my game, and a action buttons script running on every map).

    You can also check out my script on the tips and tricks thread for doing time calculation and weather with it.
    Last edited by thetruecoolness; 07-10-2005, 10:01 PM.
    はじめまして。真(しん)の冷静(れいせい)です。どうぞよろしく。
    http://www.thetruecoolness.com/

    5198-2124-7210 Smash

    Comment


      #3
      Re: OK, now how do I get time to change?

      I got it working now! Thanks a bunch!

      Comment

      Working...
      X