Home   Help Search Login Register  

Author Topic: Last Man standing  (Read 1413 times)

0 Members and 1 Guest are viewing this topic.

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Last Man standing
« 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:
« Last Edit: 09 Sep 2006, 22:09:41 by JasonO »

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: Last Man standing
« Reply #1 on: 09 Sep 2006, 23:00:24 »
Put a trigger which covers the whole playing area.

Set it to anybody present repeatedly

in Condition put:

Code: [Select]
(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:

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Last Man standing
« Reply #2 on: 09 Sep 2006, 23:41:09 »
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).

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: Last Man standing
« Reply #3 on: 10 Sep 2006, 00:08:27 »
ok, here it comes...

in the on activation put:
Code: [Select]
winner = thislist select 0; [winner] exec "myscript.sqs"

then, in your script:
Code: [Select]
_winner = _this select 0
hint format ["And the winner is %1", _winner]

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Last Man standing
« Reply #4 on: 10 Sep 2006, 00:29:02 »
OK Thanks.

Topic solved :D