Jump to content

Running multiple timers on the same script possible?


Guest Messenjah

Recommended Posts

Guest Messenjah

Ok, so I've got a bit of a possible issue I may be facing.

 

I am working on a set of dancers for my nightclub. Now, if the player requests, they can get a lapdance if they provide the dancer with a good tip. The dancer will then take them to the back, where they will proceed to dance.

 

Now, I need to create two effects that may both require some sort of timer.

 

First timer will happen when an AI package is running, the NPC will need to remove an article of clothing every 30 seconds when the AI package is active.

 

The Second timer I need, is that if They are using another AI package (Just a simple travel package that takes them to the location), if a certain amount of seconds has passed and the AI package is still running, then it will change a quest variable to 0 and complete the lap dance quest stages so that the NPC will go back to it's default routine.

 

 

The idea, is that one package will take the NPC to the location so that the NPC will in-effect, "wait" for the player to arrive. When the player arrives, they will be prompted by a triggered quest event, to "have a seat". If they sit down, another AI package will start and the striptease sequence will start and the first AI package will be invalidated via a trigger placed at the location of the seat. A script on the NPC will then begin a clothing removal timer if the AI package is running.

 

 

Anyway, what I'm wonder is this:

 

Can I run two separate timers under the same script on the same NPC?

HOWEVER, where the second timer comes in, is if the player does not SIT down and the Trigger second AI package does not initiate. IE: The player loses track of the dancer or decides they don't want a lap dance after all and leaves. The second timer will check to see if the first AI package is still running and if it reaches a certain timeout period, the lap dance quest events will auto-complete and the AI package will become invalid so that the NPC will return to it's default daily routine (I have a set of AI packages that validate and invalidate based on conditions over different day parts so that all dancer NPCs will rotate on and off the stage).

Link to comment
Share on other sites

Just use different float variables for your various timers. You can have as many as you need in a script. GetSecondsPassed always returns the same value no matter how many times you call it in the same script iteration, so all your timers will increment (or decrement) by the same amount. Some can count up, some down, and trigger your events after the required intervals depending on the starting value of the floats.
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...