OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: JasonO on 09 Sep 2006, 21:32:05
-
Hi
I want a script that when there is 1 man left alive a script is executed.
I could do something like !alive w1 and !alive w2... but theres a lot to do and I think there is a better way.
I also want to be able to get the last units name so I can use it in the script thats executed.
I just tried making a trigger with activation West Present and repeat. Then in the activation field i put totalunits = totalunits + 1. I then ran a hint and got 0, which was weird. It should be 2 becasue there is 2 west units in the area.
Can someone point or start me in the right direction?
Cheers :good:
-
Put a trigger which covers the whole playing area.
Set it to anybody present repeatedly
in Condition put:
(count thislist) == 1
On activation you can insert whatever you want to happen
:edit: shortly tested on desert with me vs 3 AI and one trigger, should also work in MP..atleast i see no reason why it shouldn't :edit:
-
Hi
It worked, kinda...
If I dont have any objects added it worked. I removed the objects and made 1 person and it did what I wanted. I tried making it so its only west that triggered it.. but that didnt work either.
EDIT : All the units have addrating -100000 would that stop them from triggering the trigger.
Yep, I made the trigger very very slightly miss the other player out.
Now I just want to be able to do something in my script. How would I get the player name from the person left (aka the winner).
-
ok, here it comes...
in the on activation put:
winner = thislist select 0; [winner] exec "myscript.sqs"
then, in your script:
_winner = _this select 0
hint format ["And the winner is %1", _winner]
-
OK Thanks.
Topic solved :D