Home   Help Search Login Register  

Author Topic: End game after lives exhausted?  (Read 1279 times)

0 Members and 1 Guest are viewing this topic.

Fallout

  • Guest
End game after lives exhausted?
« on: 05 Sep 2003, 17:27:12 »
I managed to get respawn working nicely in my multiplayer levels thanks to the pinned topic at the top of this board, but now I want to end the level when a certain amount of lives have been used up.

Basically, I have two teams of human players and they have two ways to win. One is to infiltrate the enemy base and destroy a load of computer equipment, and the second is to kill the enemy team enough times to exhaust their life pool. The computer destruction part if set up, but I can't get the life pool to work.

My respawning is set up to respawn back at the respawn_west/east markers. This is what I have that doesn't work:
-A trigger which activates on getdammage player == 1 (I've also tried not alive player)
when this is true it adds one to a variable "deaths_west"
-Another trigger which activates on deaths_west > 9 which then ends the game.

This doesn't work though. I'm new to this scipting business, so I'm thinking the problem is either the variable isn't being added to, because the triggers aren't detecting death (maybe the respawning means the player is never dead nor has a damage of 1), or that the variable just isn't work (I don't know how to initialise one / make it global / etc).

Any help appreciated.  :)

Lut

  • Guest
Re:End game after lives exhausted?
« Reply #1 on: 06 Sep 2003, 06:27:56 »
run a looping script on every computer by putting
[]EXEC "CHECKDEATH.SQS"
in INIT.SQS


;CHECKDEATH.SQS (revised... heh my bad)
Deaths_West = 0
#Loop
@!(ALIVE Player)
Deaths_West = Deaths_West + 1
PUBLICVARIABLE "Deaths_West"
@ (ALIVE Player)
GOTO "Loop"

after this, include a trigger that detects Deaths_West  > 9 that ends the game

« Last Edit: 07 Sep 2003, 11:34:48 by Lut »

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:End game after lives exhausted?
« Reply #2 on: 06 Sep 2003, 20:01:41 »
better to use

@ alive player
and
@ !alive player, so that it stops at each player state

at a guess what was written above will continue to loop while the player is in respawn, because the player is still seen as dead



The following gives you two options

The red text gives you a way of limiting the number of respawns per player

and the blue text limits the number of respawns per side which will be used to end the trigger




It is impossible to limit the number of respawns that an individual player has.
The workaround is to simply relocate the player to another location after he has respawned X times

declare the following variable in the INIT.sqs, which will limit the number of times an individual player is allowed to respawn at his normal respawn area
Lives = 3


set the following variable in the INIT.sqs,  which will later be used to limit the number of respawns for east or west for the endgame trigger
west_reinforments = 0
east_reinforcements = 0



also in the INIT.sqs, enter the following line
[]exec "Respawn.sqs"

Place a marker of type (empty marker) on an island or a fenced area that can be used to isolate the players from the game

lets call this marker Prison




now the script
;;Respawn.sqs"

@time >1
_rebirth = 0

#START
?(side player == west):west_reinforcements = west_reinforcements + 1; publicvariable "west_reinforcements"
?(side playewr == east):east_reinforcements = east_reinforcements +1; publicvariable "east_reinforcements"

? (_rebirth > Lives):goto "DeadnBuried"
@! alive player
_rebirth=rebirth+1
@alive player goto "START"

#DeadnBuried
removeallweapons player
player setpos (getmarkerpos"Prison")
use this section of the script to relocate this individual player to a non playing area
player setpos (getmarkerpos"Prison")
etc etc etc

other possibilities are to run the spectator script, so that this "Killed off" player doesnt get bored



having done all this, now all you have to do is create an endgame trigger waiting for condition
(west_reinforcements>=10) OR (east_reinforcements >=10)

where 10 is the number of respawns you want to allow per side
« Last Edit: 06 Sep 2003, 20:07:25 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123