HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How to make cinematics work in multiplayer:

05-18-2002, 11:51 PM#1
Guest
Currently, Warcraft III has a nasty bug when it comes to multiplayer maps and the wait function. Basically, with multiple people in the game, the program will skip over a wait function when it is found, once for each person in the game. Thus, I have found that I can make cinematics (and other functions that use waits) work by doing the following:

Step 1:
Create an integer variable named numUsers.

Step 2:
During map initialization, set numUsers to equal the maximum number of players in your map.

Step 3:
Set up a set of triggers in the following manner:
Events:
Time - Every 5 seconds of game time
Conditions:
(Player 1(Red) slot status) Not equal to Is playing)
Actions:
Turn off (This Trigger)
Set variable numUsers = numUsers - 1

Step 4:
Whenever the game requires a wait function, replace the wait function with the following:
For each (Integer A) from 1 to numUsers, do (Wait X seconds)


This will cause the game to send out one wait function for each player in the game. In multiplayer, this will skip all but one of the wait functions, causing the wait function to work just as it does in single player (and in single player, since the for 1 to 1 function just executes once, the wait function will also execute once.)


Hope that helps you multiplayer map makers out there. When I get home, I'll go into detail on how to add colored text to a map. ;)

-Dark Chrono
05-19-2002, 05:26 AM#2
Vaderman
Nice, it actually works, now to stop random ppl getting stuck when using cinematics and not being able to move their screen...
05-21-2002, 03:38 AM#3
dataangel
Eh, I'm looking at your code but I don't quite understand why it works. Every five seconds it checks if player 1 dropped or not if I'm not mistaken. Are you saying set this up for each indivudal player?

Yeah...that would kinda make sense. Although, it's worth noting though that alot of map makers only ever have cinematics at the _opening_ of their map, in which case you should do this check just once (not every 5 seconds) for optimization purposes ;)

I also think it maybe possible so that whenever you're about to play a cinematic, call a custom trigger that does this right before the cinematic plays, rather than every 5 seconds. That'd also make this more efficient. I'll need to experiment myself though.
05-21-2002, 03:55 AM#4
Guest
That's true, you could optimize it that way. I had it set up every 5 seconds because it was combined with a trigger on one of my maps to not only set up this variable, but also give any units of a leaving player to an allied player. Also, I used cinematics throughout the entire map, so it would actually end up being more work for me to call a 'check players' function before every cinematic. As always, my suggestions can most certainly be optimized to fit a different map.
05-21-2002, 03:49 PM#5
Guest
Thanks alot Chronos!!! I was about to release my map this morning with a slightly broken cinematic :p. Good thinking, surprised i didnt think of it myself! I had been fustrated with it for a long time and was beggining to think that the wait function wasn't going to the other players because when im by myself the cinema works,but multiplayer it would always go too fast.

My map is AssassinX's Commando Wars Beta.

It is a very good map, ive had several good comments on this map. Im pretty sure all bugs have been work out except a few minor ones. Those minor ones dont even affect gameplay. So Im gonna go home this afternoon and fix the cinema and post the map on here.

thx alot again
05-21-2002, 04:07 PM#6
Guest
ok why you dont use for each integer A from 1 till 12 do if player[A] equal to is playing numUsers = numUsers + 1 else do nothing to check how many players r playing
secound your trigger just causes the game to make mass waits so if 4 players in the trigger will do wait(int) wait(int) wait(int) wait(int) ... so y u just dont copy your wait trigger 100 times 1 of them will work ...
05-21-2002, 04:28 PM#7
Mr.123
This may work as well.

Set NumUsers = (Number of players in (All players controlled by a User player))
05-21-2002, 04:57 PM#8
Guest
Setting the variable to 'number of user players' actually does NOT work. The reason for this is, if someone disconnnects, despite the fact that they aren't playing anymore, the game still considers them a user player, and thus someone leaving your game would cause excess wait statements.
05-21-2002, 06:11 PM#9
Guest
y do u think that if you make 5 wait functions with 5 players in game that every player get 1 wait functions ..?
05-22-2002, 05:02 PM#10
Guest
anyone ever thought of why the wait functions do not work like they should?

i think i found out:
lets say u have a <unit-ownedbyplayer-dies> event. u can use <triggering-unit> as long as u do no wait action.
all actions u do after the wait statement using <triggering-unit> wont work anymore (<triggering-unit> refers to everything but the triggering unit because it could have been (and in this case it is) removed from game and stuff).

so if u do a wait statement the game should actualy save all of those event variables and a lot of other stuff too i guess.

can u agree? or not? duno but thats what i think

and to be not totaly off topic:
u could work around this wait thing with a unit and 2 regions. spawn in the one modify walk speed and launch a trigger as soon as the unit reaches the 2nd region. i never tried that because it is just too stuped :)
05-22-2002, 06:30 PM#11
Guest
the trigger after the wait work but not the wait =)
05-25-2002, 02:13 PM#12
Guest
I have 10 players in my map but one player im using as a nuetral controller. In numUsers do I have take that player into account? or only the user players?
05-25-2002, 08:19 PM#13
Guest
Only the user player slots that are currently filled. Thus if it's a 4-player map, but only 2 people are playing, you should only make 2 wait conditions.
07-30-2002, 07:30 PM#14
Equilibrium
Does this include the Wait functions in transmissions? I assume it does, that seems to be the problem in a lot of maps.

So, how do I solve that? I make it don't wait and then add one of those wait things after the transmission?
07-30-2002, 08:26 PM#15
Karma Patrol
Wow, thats not very optimized.

I did it in my map like so:

Event: Every 2 seconds of the game

Action: For int A from 1 to numplayers do:

If(player(for loop int A) slot status is equal to has left the game) then set numplayers = numplayers-1 else do nothing