HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

alternate way to do wait in multiplayer

09-02-2002, 01:58 AM#1
Guest
I realize the normal way to do wait commands is to store a variable that keeps count of the players and then do For Each Integer A from 1 to VARIABLE do wait 10 seconds

but,

would this work:

For Each Integer A from 1 to (Number of Players) do wait 10 seconds


I would test this out but at the moment I don't have the people to test it out with :(

Thanks.
09-02-2002, 03:03 AM#2
Guest
I don't really have the ability to test that out either, but there are other ways you could pull off a separate "wait" function for each player, albeit considerably longer...

The idea is similar to the old Custom Score counter trick in StarEdit. You could create an integer array, and a boolean array to use as a flag. Then you could piece together a few triggers like this...

(sorry, I don't have the mind to go into WorldEdit and copy the text exactly right now)

#1
EVENTS
- Elapsed game time is 0.00 seconds
ACTIONS
- For each (Integer A) from 1 to (Number of players), set Integer array(Player A) to 0
- For each (Integer A) from 1 to (Number of Players), set Boolean array(Player A) to "false"

#2
EVENTS
- Whatever player-related events are supposed to start the wait timer
CONDITIONS
- Boolean array(Triggering player) is set to "false"
ACTIONS
- Set Boolean array(Triggering player) to "true"

You can copy the event in #2 and change the specified player as much as you need in your event copies if you want more than one player to be able to start their timer by doing the same action.

#3
EVENTS
- Every 1.00 seconds of game time
ACTIONS
- For each (Integer A) from 1 to (Number of Players), do If Boolean array(Player A) set to "true", then execute trigger #4 else Do nothing

#4
ACTIONS (that's right, no events or conditions whatsoever)
- Add 1 to Integer array(Player A)
- If Integer array(Player A) equal to 10 then execute trigger #5 else Do nothing

#5
ACTIONS (yep, again...nothing but actions)
- <insert actions to be executed at end of timer for Player A here>
- Set Boolean array(Player A) to "false"
- Set Integer array(Player A) to 0

If you don't want separate wait timers and flags for everyone, but used the above method, you probably found out that things got messy. For example, if you set it up to create one boss monster for everyone collectively when their timers reached 10 together, you'll find you just created one boss monster for each player :p

If you just want one wait timer and flag for everyone collectively, kick out the arrays and just use a normal Boolean and normal Integer, and set their starting values to "false" and 0, respectively. Then, make the following changes to the above triggers:
- Get rid of trigger #1...you don't need it anymore :p
- Wherever it says "Boolean array(Triggering Player)" or "Boolean array(Player A)", change it to just plain "Boolean"
- Wherever it says "Integer array(Player A)", change it to just plain "Integer"
- Get rid of all the "For" loops...you don't need 'em ;)

That's just off the top of my head, it's not tested, and I might have missed something. But based on my prior experience, that should work. Actually, this is worth the added work even if your posted method works, because this way every player has their own wait timer and flag. That way, you can implement other triggers that change one player's timer without changing it for everyone else. It's more versatile for the added work ^_^

If you don't understand something there, let me know. FYI, the "10" signifies the wait timer period. You can change that to whatever you want.

P.S. Sorry, I modified this about half a dozen times...so you're probably confused now if you were watching the forum for updates. :\