Home   Help Search Login Register  

Author Topic: Deleting player bodies  (Read 2036 times)

0 Members and 4 Guests are viewing this topic.

Mr.BoDean

  • Guest
Deleting player bodies
« on: 06 Jul 2004, 07:01:33 »
Ok, so I've got my scripts for deleting AI bodies, but what about the bodies of the players left behind before they respawn? I've de-pbo'ed a few missions but can't seem to find it.    :-X      Is it the same or what?

Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
Re:Deleting player bodies
« Reply #1 on: 06 Jul 2004, 11:15:42 »
the way I do it is:
make sure all playable units have a name in the editor...I use ap1.ap2, etc
make a global trigger
(axis a 0, axis b 0, activated by none)
condition: !alive ap1
on activation: [ap1] exec "ap.sqs"
;;ap.sqs
_body = _this select 0
?(_body == FlagOwner FlagE) or (_body == FlagOwner FlagW):Goto "Flag"
?(_body != FlagOwner FlagE) and  (_body != FlagOwner FlagW):Goto "Delete"
#Flag
~30
DeleteVehicle _body
#Delete
~15
deleteVehicle _body
exit  

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Deleting player bodies
« Reply #2 on: 06 Jul 2004, 14:39:27 »
you could simply add a Killed eventhandler to every unit
Much more efficient than having lots of triggers

if its only Players on your map, not ai, then you could simply add the event handler to the player in the init.sqs

and then if there are no complications such as a ctf flagrunner etc etc simply have a wait period and then delete the body

player addEventHandler ["killed", {_this exec "removebody.sqs"}]

REMOVEBODY.sqs
Quote
_body = _this select 0
~ 30
deletevehicle _body
exit
Quote
« Last Edit: 06 Jul 2004, 14:45:32 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Mr.BoDean

  • Guest
Re:Deleting player bodies
« Reply #3 on: 06 Jul 2004, 19:16:04 »
you could simply add a Killed eventhandler to every unit
Much more efficient than having lots of triggers

if its only Players on your map, not ai, then you could simply add the event handler to the player in the init.sqs

and then if there are no complications such as a ctf flagrunner etc etc simply have a wait period and then delete the body

player addEventHandler ["killed", {_this exec "removebody.sqs"}]

REMOVEBODY.sqs

Thanks Terox.  You mentioned if they were just player units....Ok, I'm currently running the following script for AI units that are made with the "createunit" command and have
this addeventhandler [{killed},{_this exec {rid.sqs}}] in the init. part of their createunit line. It works well, though I haven't tested it yet in a MP setting.


Quote
_unit = _this select 0

~60 + (random 30)
_unit removealleventhandlers "killed"
;removeallweapons _unit
AA1 action ["hidebody", _unit]
~5
deletevehicle _unit

exit

Is it necessary to have the "removealleventhandlers" part, because that would obviously affect player units.  i.e., I'm wondering if I could just have the player units run this script, too. ?
Or should I make a separate one?

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Deleting player bodies
« Reply #4 on: 06 Jul 2004, 20:45:52 »
normally the players addeventhandler killed runs a respawn script

lets say that you have all units AI and players running the "Killed.sqs" from the killed eventhandler

A combined script would look like the following



KILLED.sqs
Quote
_body = _this select 0
?!(local Player): goto "REMOVEBODY"
?(Player != _body):goto "REMOVEBODY"
Player removealleventhandlers "killed"

@alive player
player addEventHandler ["killed", {_this exec "killed.sqs"}]

#REMOVEBODY
~ 30 + (Random 30)
deletevehicle _body
exit


I dont actually know if you need to remove the eventhandler and re add it to the player after he has died, never tried it out

NB>>> Any AI that is controlled by a player, is local to the players machine

the lines

?!(local Player): goto "REMOVEBODY"
?(Player != _body):goto "REMOVEBODY"


should take care of that for ya!


« Last Edit: 06 Jul 2004, 20:51:10 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Mr.BoDean

  • Guest
Re:Deleting player bodies
« Reply #5 on: 08 Jul 2004, 18:56:56 »
Thanks, terox. Ok, so I got this to work for me , the player after changing "player" to this in the unit's init. line. Otherwise it didn't work. However, when testing with AI units ...they delete once but not after multiple respawns. Not sure if that would be different ingame with humans as players.  :-\

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Deleting player bodies
« Reply #6 on: 08 Jul 2004, 20:16:08 »
It works fine for players, because the addeventhandler is added to the player on respawn, not a unit

, what you will probably have to do is add the eventhandler to the ai units when they become alive again, just like you would the player.

Simply change player for

_unit = _this select 0
_unit addeventhandler "killed" etc etc
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123