OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Jakro on 07 Mar 2010, 23:09:51
-
It's simple question and I've come up already with couple of alternatives to work around this, but there must be easier ways than what I've come up so here goes:
I want all of my players get through the mission alive. Mission will fail instantly if somebody dies. I just have end trigger with the conditions (not alive p1) or (not alive p2).. etc. It works fine when I test it in editor, and will work also if I fill every slot in multiplayer. But when playing little short ie. couple of empty slots it for some reasons stops working.
-
I think this will work. Name your players' group by placing
groupname = group this
in each player's initialization. (It has to be in every player's initialization because, as you've discovered, some playable units may never initialize in the game). Run the following code anywhere at the start of the mission, and only at the start:
startingplayercount = count (units groupname)
Then make the conditions for your ending trigger like so:
"alive _x" count units groupname < startingplayercount
Will that work for you? :)
Edit: Actually it's even easier than that. Just take your players group, and group to it an end trigger with a map-wide radius. Select conditions as "whole group--not present." The trigger will activate if it is not the case that every group member is present. If a group member dies, he will be considered not present.
(I know, it's confusing, but I'm 99% certain that you want "whole group--not present", not "any group member--not present").
Edit 2: Arrrgggggh but I forgot that won't work if the unit that you grouped it to is not taken by a player in multiplayer setup. The first method should work for sure.
Or, I think you could simply make the group leader placed in editor non-playable. Group him to the trigger and then give him an initialization of "deletevehicle this." Of course this may confuse players. :confused:
-
Okay, that's similar to what I was thinking. Thanks.