OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Silgan on 15 Sep 2006, 09:14:07
-
On the mission I am currently creating I have 3 sides (West, East and Resistance). I was wondering how I can make a trigger(s) that says "West Wins", "East Wins or "Resistance Wins" and ends the mission? I know how to do triggers for a mission where there are only 2 sides but not sure how to do it with 3.
-
You should tell more about the conditions to win.
Basically you would put the side of the winner into a string
and then display it may be in a titletext using the format command.
More, when you give us more input. ;)
~S~ CD
-
Yes, how exactly does the team win?
-
Triggers work in exactly the same way no matter how many sides there are. I suspect you're going to need several triggers, and some variables to communicate information between them. As the lads say, we need more information.
Welcome to the forum!
-
The end triggers are the same for all 3 sides, 1 side wins when the other 2 are dead :P.
Welcome to the forum!
Thanks :D, I used to come on the forum a few years back under the name of Doball. The forum has changed since then :).
-
Ah, well in that case
Welcome back!
Is this for SP or MP?
-
It is a multiplayer mission.
-
Bump! I've been forgotten about :P.
-
Here's a solution involving nine (9) triggers. A little clumsy, but the best i could come up with on short notice. It is untested, and you might want to check the syntax. Consider it to be a rough draft, to give you something to work with...
These triggers checks when a side is wiped out completely:
CONDITION: count units side east == 0
ACTIVATION: eastDead=true
CONDITION: count units side west == 0
ACTIVATION: westDead=true
CONDITION: count units side guer == 0
ACTIVATION: guerDead=true
These triggers decides who won the game
CONDITION: eastDead AND westDead
ACTIVATION: guerWin = true
CONDITION: eastDead AND guerDead
ACTIVATION: westWin = true
CONDITION: westDead AND guerDead
ACTIVATION: eastWin = true
These are the ending triggers. I would replace the hint with title text or something, but you'll get the point...
End1
CONDITION: westWin
ACTIVATION: hint "West Victory"
End2
CONDITION: eastWin
ACTIVATION: hint "East Victory"
End3
CONDITION: guerWin
ACTIVATION: hint "Resistance Victory"
NOTICE: I'm not sure if the side command allows you to count units like that. You might want to put all units on each side into arrays, before you can pass them on to a script/trigger like that. Check the COMREF
-
IIRC count units can result in a delay of up to several minutes before the trigger fires. (Although that may only be with groups ...) Use
"alive _x" count units ...
for an instant response. You can put a delay of a few seconds in one of triggers if you want.
-
Here's a solution involving nine (9) triggers. A little clumsy, but the best i could come up with on short notice. It is untested, and you might want to check the syntax. Consider it to be a rough draft, to give you something to work with...
These triggers checks when a side is wiped out completely:
CONDITION: count units side east == 0
ACTIVATION: eastDead=true
CONDITION: count units side west == 0
ACTIVATION: westDead=true
CONDITION: count units side guer == 0
ACTIVATION: guerDead=true
These triggers decides who won the game
CONDITION: eastDead AND westDead
ACTIVATION: guerWin = true
CONDITION: eastDead AND guerDead
ACTIVATION: westWin = true
CONDITION: westDead AND guerDead
ACTIVATION: eastWin = true
These are the ending triggers. I would replace the hint with title text or something, but you'll get the point...
End1
CONDITION: westWin
ACTIVATION: hint "West Victory"
End2
CONDITION: eastWin
ACTIVATION: hint "East Victory"
End3
CONDITION: guerWin
ACTIVATION: hint "Resistance Victory"
NOTICE: I'm not sure if the side command allows you to count units like that. You might want to put all units on each side into arrays, before you can pass them on to a script/trigger like that. Check the COMREF
Sorry its been a while I've been quite busy. Anyway I've set the triggers up how you've said above except I used Macguba's "Alive_X" instead of just count units.
"alive_x" count units side west == 0
"alive_x" count units side east == 0
"alive_x" count units side guer == 0
Sadly it didn't work. It throws back the above conditions because of the "side [side]" part. So I changed it to:
"alive_x" count units sidewest == 0
"alive_x" count units sideeast == 0
"alive_x" count units sideguer == 0
But that didn't work either. It's those 3 triggers that I think are stopping the end triggers working and I'm not sure how to make them work :(. I've attached the .sqm so you can see what I've done.
-
"alive_x" count units side west == 0
These lines should begin:
"alive _x" count units...............
There should be a space between 'alive' and '_x'
Anyway.....I'll have a look at your sqm and see what I can see.
EDIT:
I can't see these lines working ......the side command only works on an Object or Group.
It will return the side that the Object or Group belongs to.
However all the units on a particular side are not necessarily in the same group.
When you changed it to sidewest, sideeast and sideguer, there was no longer any error message because the syntax is then correct, except there are no groups called sidewest, sideeast and sideguer.
There must be another way of doing this, maybe just using the list from a trigger for each side.
EDIT2:
The attached edited mission seems to work.....whether it is what you wanted is another matter :P
Planck
-
"alive_x" count units side west == 0
These lines should begin:
"alive _x" count units...............
There should be a space between 'alive' and '_x'
Anyway.....I'll have a look at your sqm and see what I can see.
EDIT:
I can't see these lines working ......the side command only works on an Object or Group.
It will return the side that the Object or Group belongs to.
However all the units on a particular side are not necessarily in the same group.
When you changed it to sidewest, sideeast and sideguer, there was no longer any error message because the syntax is then correct, except there are no groups called sidewest, sideeast and sideguer.
There must be another way of doing this, maybe just using the list from a trigger for each side.
EDIT2:
The attached edited mission seems to work.....whether it is what you wanted is another matter :P
Planck
The edited mission you attached was exactly what I wanted. Funnily enough I was going to try using the "Present" part of the "[Side] Alive?" triggers but didn't in the end and posted my problem here :P. Anyway thanks for all your help guys :).