Home   Help Search Login Register  

Author Topic: maybe a simple question about Respawning  (Read 1117 times)

0 Members and 1 Guest are viewing this topic.

Whiskey

  • Guest
maybe a simple question about Respawning
« on: 19 Jan 2006, 03:05:20 »
As this is my first post, i hope this hasnt allready been asked. Is the following possible?

Example: West player starts is in a ctf map will name MAP 1, He gets killed. Respawns into a different CTF map will call MAP 2, He then gets killed again and returns to MAP 1 to start the whole process over again.

I have seen the random respawn script and it didnt work at all. I have also tried the west_respawn and west_respawn_1 did not work after the first respawn. The west units continued to respawn over and over again at west_respawn_1 and didn't respawn at west_respawn_2.

Also is it possible to remove a dead body of a player when the player hasnt been named?


 

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:maybe a simple question about Respawning
« Reply #1 on: 19 Jan 2006, 17:10:51 »
I dont understand what you mean by Map 1 and map 2

if you mean different locations on the same mission, then yes it can be done

the basic rundown on how it works

1) use your normal respawn_west, respawn_east markers
2) Add a killed event handler to each Player
3) Have the killed event script, change a boolean from true to false and back to true again after each death
4) Depending on whether that boolean is true or false on respawn would then determine if the unit was to be immediately setpossed to the additional starting point or not.

Something like the following

MISSION EDITOR
1) Create your normal respawn markers and place them at East respawn location No1 and West respawn location No1
2) Create a gamelogic, 1 for east and 1 for west, name then "Elogic" and "Wlogic"
Place these in the alternative spawn locations

INIT.SQS
tx_setpos = false
player addEventHandler ["killed", {_this exec "playerkilled.sqs"}]

PLAYERKILLED.SQS
Player removealleventhandlers "Killed"
if(tx_setpos)then{tx_setpos = false}else{tx_setpos = true}
@ alive Player
player addEventHandler ["killed", {_this exec "playerkilled.sqs"}]
if(tx_setpos)&&(side Player == west)then{Player setpos (getpos Wlogic)}
if(tx_setpos)&&(side Player == east)then{Player setpos (getpos Elogic)}
exit



you can add to this script, eg by giving the player the same loadout that he stareted with on each respawn, tthis would be done in the following way

INIT.SQS would contain the additional code

Quote
tx_Weps = weapons player
tx_mags = magazines player
tx_Primary = primaryweapon player

and the Playerkilled.sqs would look like this


PLAYERKILLED.SQS
Player removealleventhandlers "Killed"
if(tx_setpos)then{tx_setpos = false}else{tx_setpos = true}
@ alive Player
player addEventHandler ["killed", {_this exec "playerkilled.sqs"}]
Removeallweapons Player
{player addMagazine _x} forEach tx_mags
{player addWeapon _x} forEach tx_weps
?(tx_Primary == "M16GrenadeLauncher"): tx_Primary = "M16Muzzle"
?(tx_Primary == "Ak74GrenadeLauncher"): tx_Primary = "AK74Muzzle"
?(tx_Primary == "Ak47GrenadeLauncher"): tx_Primary = "AK47Muzzle"


if(tx_setpos)&&(side Player == west)then{Player setpos (getpos Wlogic)}
if(tx_setpos)&&(side Player == east)then{Player setpos (getpos Elogic)}
exit

NB, the very first thread in this p[articular forum, has tons of posts about MP respawn


Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123