Jump to content

Photo
- - - - -

How to adress (unnamed) corpses?


  • Please log in to reply
10 replies to this topic
Thread Starter
Mongoose_84
Mongoose_84

    Corporal

  • Members
  • 86 posts

Posted 10 December 2006 - 22:11 #1

I'm just experimenting and getting familiar with the editor and scripting, but now I can't seem to find a satisfying way to rid the battlefield of corpses. Posted Image

I can't get them via trigger ("list"), as it doesn't work on dead units. And if I adress them by their group, it sometimes happens, that they get deleted from it, before I can do so - resulting in every 10th (or so) unit to remain on the map.

And secondly: Does "hiding" bodies really make them disappear and therefore prevents performance from suffering or is there some other command I should use?

Can anyone help?
\"The future of life on earth depends on our ability to take action. Many individuals are doing what they can, but real success can only come if there's a change in our societies and our economics and in our politics. I've been lucky in my lifetime to see some of the greatest spectacles that the natural world has to offer. Surely we have a responsibility to leave for future generations a planet that is healthy, inhabitable by all species.\"

\"Population growth is the single biggest threat to life on earth. No doubt at all. A great number of our major environmental problems [...] are caused by more and more human beings wanting the fresh air of the earth. I'm not one who says that you should let babies die or that you should deny the man in the Brazilian forest the right to grow food for his children, but if we do want a solution to the problem, the correct solution is population control.\"

- Sir David Attenborough

Victor_S.
Victor_S.

    Gunnery Sergeant

  • Members
  • 502 posts

Posted 11 December 2006 - 05:56 #2

I do not think hiding bodies makes them disappear just go underground. As for deleting dead bodies I know how to do it for ofp, but have not tried in arma. Use the delete vehicle command. There are lots of ways to delete them via scripts or triggers, Sorry I can't be of more help right now but I have to go. Just play around with delete vehicle and us the units name.

feersum.endjinn
feersum.endjinn

    Gunnery Sergeant

  • Members
  • 522 posts

Posted 11 December 2006 - 07:44 #3

You can use "killed" event handler to do it.

http://community.bis...addEventHandler
Posted ImagePosted ImagePosted Image

Thread Starter
Mongoose_84
Mongoose_84

    Corporal

  • Members
  • 86 posts

Posted 11 December 2006 - 19:22 #4

Thanks for the replies

@ Victor_S.

I already tried using the deleteVehicle command instead and it worked, but it just doesn't look as smooth as "hiding" them. That's why I would prefer the hideBody command, IF the bodies get deleted that way, too... Maybe anyone knows for sure?

@ feersum.endjinn

I'm not yet familiar with event handling - gonna try it, thanks.
\"The future of life on earth depends on our ability to take action. Many individuals are doing what they can, but real success can only come if there's a change in our societies and our economics and in our politics. I've been lucky in my lifetime to see some of the greatest spectacles that the natural world has to offer. Surely we have a responsibility to leave for future generations a planet that is healthy, inhabitable by all species.\"

\"Population growth is the single biggest threat to life on earth. No doubt at all. A great number of our major environmental problems [...] are caused by more and more human beings wanting the fresh air of the earth. I'm not one who says that you should let babies die or that you should deny the man in the Brazilian forest the right to grow food for his children, but if we do want a solution to the problem, the correct solution is population control.\"

- Sir David Attenborough

Thread Starter
Mongoose_84
Mongoose_84

    Corporal

  • Members
  • 86 posts

Posted 11 December 2006 - 21:20 #5

okay...

can anyone please tell me, why this is working (as a unit's "init"-script):

this addEventHandler ["killed", {hideBody unit_name}]

.. and this is not:

this addEventHandler ["killed", {hideBody this}]

? Because, if i have to name every unit that is created, it doesn't really help...
\"The future of life on earth depends on our ability to take action. Many individuals are doing what they can, but real success can only come if there's a change in our societies and our economics and in our politics. I've been lucky in my lifetime to see some of the greatest spectacles that the natural world has to offer. Surely we have a responsibility to leave for future generations a planet that is healthy, inhabitable by all species.\"

\"Population growth is the single biggest threat to life on earth. No doubt at all. A great number of our major environmental problems [...] are caused by more and more human beings wanting the fresh air of the earth. I'm not one who says that you should let babies die or that you should deny the man in the Brazilian forest the right to grow food for his children, but if we do want a solution to the problem, the correct solution is population control.\"

- Sir David Attenborough

raedor
raedor

    oida ouk eidos

  • Members
  • 5284 posts

Posted 11 December 2006 - 21:27 #6

Try<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addEventHandler ["killed", {hideBody (_this select 0)}][/QUOTE]

Thread Starter
Mongoose_84
Mongoose_84

    Corporal

  • Members
  • 86 posts

Posted 11 December 2006 - 22:02 #7

[quote name='(raedor @ Dec. 11 2006,22:27)']Try<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addEventHandler ["killed", {hideBody (_this select 0)}][/QUOTE][/QUOTE]
Thanks, it works now.

I thought that with "this" (inside the eventHandler's script) i would refer to the unit that the script is run on, but if it refers to the eventHandler itself, then your suggestion makes perfect sense, of course.

So, thanks again!




\"The future of life on earth depends on our ability to take action. Many individuals are doing what they can, but real success can only come if there's a change in our societies and our economics and in our politics. I've been lucky in my lifetime to see some of the greatest spectacles that the natural world has to offer. Surely we have a responsibility to leave for future generations a planet that is healthy, inhabitable by all species.\"

\"Population growth is the single biggest threat to life on earth. No doubt at all. A great number of our major environmental problems [...] are caused by more and more human beings wanting the fresh air of the earth. I'm not one who says that you should let babies die or that you should deny the man in the Brazilian forest the right to grow food for his children, but if we do want a solution to the problem, the correct solution is population control.\"

- Sir David Attenborough

cain2001
cain2001

    Staff Sergeant

  • Members
  • 362 posts

Posted 11 December 2006 - 22:13 #8

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; Select the Unit
_unit = _this select 0
;-Delay the delete after death
~120

; delete the unit
deletevehicle _unit
exit[/QUOTE]


Or something like that.
Don't give me that same old pack of lies
I'll tell you the story how it really is
Want me to carry on?

Thread Starter
Mongoose_84
Mongoose_84

    Corporal

  • Members
  • 86 posts

Posted 11 December 2006 - 23:20 #9

[quote name='(cain2001 @ Dec. 11 2006,23:13)']<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; Select the Unit
_unit = _this select 0
;-Delay the delete after death
~120

; delete the unit
deletevehicle _unit
exit[/QUOTE]


Or something like that.[/QUOTE]
But how do I delay a command within a script? Or can I use a countdown timer on the entire eventHandler somehow?

I'd like the script to wait a few secs first, then hide the body and eventually delete it.

I've been trying to use loops and the "_time" variable, but that can't be it...
\"The future of life on earth depends on our ability to take action. Many individuals are doing what they can, but real success can only come if there's a change in our societies and our economics and in our politics. I've been lucky in my lifetime to see some of the greatest spectacles that the natural world has to offer. Surely we have a responsibility to leave for future generations a planet that is healthy, inhabitable by all species.\"

\"Population growth is the single biggest threat to life on earth. No doubt at all. A great number of our major environmental problems [...] are caused by more and more human beings wanting the fresh air of the earth. I'm not one who says that you should let babies die or that you should deny the man in the Brazilian forest the right to grow food for his children, but if we do want a solution to the problem, the correct solution is population control.\"

- Sir David Attenborough

raedor
raedor

    oida ouk eidos

  • Members
  • 5284 posts

Posted 11 December 2006 - 23:27 #10

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addEventHandler ["killed", {_this select 0 execVM "hideBody.sqf"}][/QUOTE]And then the hideBody.sqf:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">sleep 20;
hideBody _this;[/QUOTE]

Thread Starter
Mongoose_84
Mongoose_84

    Corporal

  • Members
  • 86 posts

Posted 12 December 2006 - 13:24 #11

[quote name='(raedor @ Dec. 12 2006,00:27)']<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addEventHandler ["killed", {_this select 0 execVM "hideBody.sqf"}][/QUOTE]And then the hideBody.sqf:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">sleep 20;
hideBody _this;[/QUOTE][/QUOTE]
thank you once more!

i made it:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
sleep 60;
hideBody _this;
sleep 5;
deleteVehicle _this;
[/QUOTE]

and it seems to work just fine
\"The future of life on earth depends on our ability to take action. Many individuals are doing what they can, but real success can only come if there's a change in our societies and our economics and in our politics. I've been lucky in my lifetime to see some of the greatest spectacles that the natural world has to offer. Surely we have a responsibility to leave for future generations a planet that is healthy, inhabitable by all species.\"

\"Population growth is the single biggest threat to life on earth. No doubt at all. A great number of our major environmental problems [...] are caused by more and more human beings wanting the fresh air of the earth. I'm not one who says that you should let babies die or that you should deny the man in the Brazilian forest the right to grow food for his children, but if we do want a solution to the problem, the correct solution is population control.\"

- Sir David Attenborough