repeated actions

Started by Sam., Wed 02/06/2004 16:37:18

Previous topic - Next topic

Sam.

In my game I want a puzzle that can only happen at a certain time. you are in an office and need to sneak some papers into a box without the receptionist noticing. Every minute or so I want the receptionist to go out and wait for a few seconds. In this gap it is possible to put the papers in the box. At any other time it is not. I don't know how to do this as wait pause the game. any ideas?
Bye bye thankyou I love you.

®2-D2

well, set a timer and let it run.
if it has reached the desired value, reset it to 0, make the character leave the room for some time (maybe you need the help of another timer here) and set a variable (which can be used to check if the person is in the room or not).
Then if the person returns, start over again (i.e. infinite loop)

Barbarian

#2
Quote from: Zootyfruit on Wed 02/06/2004 16:37:18
In my game I want a puzzle that can only happen at a certain time. you are in an office and need to sneak some papers into a box without the receptionist noticing. Every minute or so I want the receptionist to go out and wait for a few seconds. In this gap it is possible to put the papers in the box. At any other time it is not. I don't know how to do this as wait pause the game. any ideas?

Well, I'm still learning about all this scripting stuff, and most likely someone else who is more experience can give you a better suggestion, but here's one thing I had in mind that might work for you.

You can put it in the "Repeatedly Execute" part for that room.
Make a variable and have it conditional. When the secretary is in the room have "Game - Set Varible Value (secretary, 0)"
Then, when she leaves the room, you can "Game - Set Variable Value (secretary, 1)"

The perhaps in the time she is out of the room, instead of using a "wait" command, you can use a counter in the Repeatedly execute part for that room, like:

Repeatedly Execute "Conditional - If variable is set to s certain value (secretary, 1)"
and child action of "Run Script",

then in your script something like
" if (my_counter == 20000)Ã,  { // then include the script to run the commands to return the secrectary to the room, reset the secretary variable value to 0 again, and reset the my_counter back to 0, other wise add +1 to the my_counter untill it hit's 20000 or whatever you set it at" and if you performed the action required and no longer need the secretary to leave the room, you could like make another variable for checking if your action was performed and if so, then no longer need to run the commands to make the secretary leave the room and run your counter.

well, I hope you sort of understand what I'm trying to explain. Like I mentioned, I'm a real "newbie" at this scripting stuff, so maybe my explaination wasn't so good, and I don't know all the right commands to need to include in a script like that to make it work, but I think my idea ia along what you had in mind, and using a counter in the repeatedly execute should still give your character time and access to the game like you want, rather than being tied up with a "wait" command.


Checking the help manual:

"Repeatedly execute
occurs repeatedly on every interpreter cycle. The normal game speed is 40 cycles per second, so this event occurs about every 25 milliseconds. "

Ã,  Ã,  I'm kind of bad at math, so you can play around with the "my_counter" number untill you find what is a good amount of time for you to implement into your game for that action.

Hope my suggestion maybe gave you some idea and was sort of helpful?Ã,  :P
Conan: "To crush your enemies, see them driven before you, and to hear the lamentation of the women!"
Mongol General: "That is good."

Blade of Rage: www.BladeOfRage.com

SMF spam blocked by CleanTalk