Jump to content

Recommended Posts

I want to use the Garbage collector, but make sure it does NOT remove the 7 Dead bodies i placed in the editor (Soldier with 0% Health).

 

If you want to recommend me a script, make sure there is a way to NOT delete these Bodies, not delete Stuff in front of peoples faces and only delete Bodies when they have been lying around for a time.

Share this post


Link to post
Share on other sites

Just like crewt said:

removeFromRemainsCollector[unit1,unit2,unit3,unit4,unit5,unit6,unit7]; //etc

 

  • Like 1

Share this post


Link to post
Share on other sites
On 5/21/2017 at 8:47 AM, crewt said:

You can try this one: removeFromRemainsCollector

 

Popped into init.sqf and works, as long as AI death is delayed after game start to allow removeFromRemainsCollector to initialise. Could anybody help with code to delay a

_unit setdamage 1

to a unit or units by say 10 seconds?

Share this post


Link to post
Share on other sites
1 hour ago, anfo said:

 

Popped into init.sqf and works, as long as AI death is delayed after game start to allow removeFromRemainsCollector to initialise. Could anybody help with code to delay a


_unit setdamage 1

to a unit or units by say 10 seconds?

_unit spawn {sleep 10; (_this setDamage 0;};

 

Share this post


Link to post
Share on other sites
12 hours ago, R3vo said:

_unit spawn {sleep 10; (_this setDamage 0;};

 

 

Thanks @R3vo! It appears a ")" was missing but they was easy enough to solve. However can you or somebody else assist me to understand the logic?

First, would this code belong in the unit's init or server init? Second, I read it as when an AI spawns, a 10 second delay of damage 0 (alive) exists?

Share this post


Link to post
Share on other sites

_unit is the parameter you give to the spawned script.

In the script's scope you access to _unit by using the magic variable _this

Basically, what this script does is waiting 10 secondes, and then heal the unit. If you want to kill it you have to use setDamage 1 instead of 0. 

Share this post


Link to post
Share on other sites
12 hours ago, anfo said:

 

Thanks @R3vo! It appears a ")" was missing but they was easy enough to solve. However can you or somebody else assist me to understand the logic?

First, would this code belong in the unit's init or server init? Second, I read it as when an AI spawns, a 10 second delay of damage 0 (alive) exists?

 

Sorry, that was my mistake. Yes a bracket was missing and I typed 0 instead of 1.

Share this post


Link to post
Share on other sites

Thank you to all for your kind input. I try to pick up on code language where I can but it can be difficult sometimes to understand the speak.

Does this code go into the AI init whom I want this to occur? You see I only have 8 AI (out of possibly 100's more) that I want to be excluded from the garbage collector.

 

edit; ah wait, is it something like:

_kill = [unit_1, unit_2];
_kill spawn {sleep 10; (_this setDamage 1);};

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×