Jump to content
Sign in to follow this  
splatsh

Check alive, better way?

Recommended Posts

I have this right now:

// Code with spawn of vehicle
// "
// "
// "
// Code with creation of wayoints
// "
// "
// "
// Code with waypoint 2
// Here I have one setWaypointStatements ["true","TheEnd=1;"];
// "
// "
// " 
// Code with delete stuff
if (TheEnd == 1) then {
Delete all stuff
};

Now, how can I at best way check if my spawned stuff is alive all the way from start to the end?

1) Create a trigger to check it

2) With other code to check it (what kind of code can I use then)

Share this post


Link to post
Share on other sites

Is it important for mission control (mission fails/win when all dead) or is it just to delete it?

Share this post


Link to post
Share on other sites

Hi,

_vehicle addEventHandler ["killed", { ...code to execute when vehicle is destroyed... }];

_neo_

Share this post


Link to post
Share on other sites
Myke;1843475']Is it important for mission control (mission fails/win when all dead) or is it just to delete it?

It is just for delete stuff =)

---------- Post added at 07:05 PM ---------- Previous post was at 07:04 PM ----------

Hi' date='

_vehicle addEventHandler ["killed", { ...code to execute when vehicle is destroyed... }];

_neo_[/quote']

Is that for alive and canMove to?

Or I don't need alive and canMove check?

Share this post


Link to post
Share on other sites

Killed EH when the damage is 1, aka the object is dead/destroyed.

Share this post


Link to post
Share on other sites
Killed EH when the damage is 1, aka the object is dead/destroyed.

Thanks.

---------- Post added at 07:44 PM ---------- Previous post was at 07:28 PM ----------

It was no good with that check...

I shoot it so its engine got damage, so the helo landed.

And then the helo got no damage 1.

I need to check if vehicle is alive or canMove

And if it is not alive and can not move, then I need to do some code.

But where to put that code in my code?

And what to use:

- do while...

- If vehicle...

Share this post


Link to post
Share on other sites

Hi again,

_vehicle addEventHandler ["Hit", 
{
  private ["_vehicle"];
  _vehicle = _this select 0;

  if ((!alive _vehicle) || (!canMove _vehicle)) then 
  { 
     _vehicle removeAllEventHandlers "Hit";
     ...more code...
  };
}];

_neo_

Edited by neokika

Share this post


Link to post
Share on other sites
Hi again,

_vehicle addEventHandler ["Hit", 
{
  private ["_vehicle"];
  _vehicle = _this select 0;

  if ((!alive _vehicle) || (!canMove _vehicle)) then 
  { 
     _vehicle removeAllEventHandlers "Hit";
     ...more code...
  };
}];

_neo_

Wow, cool, thanks =)

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
Sign in to follow this  

×