HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Alternate Wait Function for Multiplayer

09-27-2002, 04:22 PM#1
Guest
Let me know what you think of this. I posted it under the Map Creation forum in that thread on uhh, don't remember, but then I discovered this section. Much more appropriate to go here methinks. Anyway, where there is a 'sic' I may have the wrong function name. Sorry! You get the idea.

-------

function Wait takes real duration returns nothing
local timer WaitTimer

set WaitTimer = CreateTimer()
call TimerStart( WaitTimer, duration, false, null) // sic

loop
exitwhen TimerGetRemaining( WaitTimer) <= 0.0 // sic
call TriggerSleepAction(0.01)
endloop

call DestroyTimer( WaitTimer)
endfunction

-------

Alternately you could use GetElapsedTime (WaitTimer) >= duration to exitwhen instead.

Anyway, this avoids the hassle of counting (and keeping count) of players and issuing a wait per, and seems much more reliable.

Let me know what you think!

EDIT: Think I got the right func names now. Thanks Slow Smurf!

Care.
09-27-2002, 04:45 PM#2
Mr.123
I was just about to post a link to that post. This should really help out a lot of people. Slap this into a separate trigger and just call that trigger whenever you need a multiplayer wait. Good Job! :D
11-18-2002, 07:43 PM#3
Guest
Was GoldenUrg ever able to make this into a GUI function?

Care.
12-05-2002, 09:38 PM#4
Azumarril
wow i never thought of that lol
i thought waiting wasn't possible in mp =P
12-06-2002, 12:52 AM#5
The_Cyberdemon1
Well, instead of doing custom text, there are two other ways. (These work on b.net)

1.Make a trigger for each wait, and have the wait be at the beginning of the trigger
Note for 1: This does make it take twice as long. It's really annoying
2.Make it wait the time for each player. Do this action
For every integer a, 1 - number of players, do wait (integer a) X 2.
Note: Not sure if this works. If it does, C&P will be ur best friend.
12-07-2002, 04:13 AM#6
Wakeman
Quote:
Originally posted by The_Cyberdemon1

2.Make it wait the time for each player. Do this action
For every integer a, 1 - number of players, do wait (integer a) X 2.
Note: Not sure if this works. If it does, C&P will be ur best friend.


A simple way to do this is replacing the "wait X seconds" action by:

For integer A = 1 to MaxNoOfPlayersAllowedInTheGame do (if player slot of player (integer A) is NOT equal to playing then do wait X seconds)

A problem is that it also count if the player slot is "computer" instead of "open" or "closed". Otherwise it works fine in multiplayer as well as single player.
01-11-2003, 10:56 PM#7
CBWhiz
Quote:
Originally posted by Heaven
Was GoldenUrg ever able to make this into a GUI function?

Care.


You can, but its very annoying. You'd have to ad dblizzard.j to your map to make a new gui function.

Get this:
W3M Quick Utilities - It fixes the wait but in the map you tell it to. Note that when you use this program, use NORMAL WAITs, not pick every player and wait.
02-08-2003, 07:35 AM#8
Tapek
I use the "Create timer for x seconds", then create a new trigger to continue that trigger with the event "Countdown timer Y expires" its all very tedious and fills your map with junk, but it works.
Alternate Wait Function for Multiplayer - Wc3C.net