Jump to content
Sign in to follow this  
GeneralTofu

Trigger Activated if unit dies

Recommended Posts

Hi!

I am making a mission where you need to destroy a vehicle and if you don't before it lands then the mission fails. How would I do this? I already used !alive and set task to succeed if you destroy the vehicle but I am not sure how to fail the task if you don't before it lands.

 

Thanks

Share this post


Link to post
Share on other sites

Depends on how you set up the mission.

You could use 2 triggers set to anybody, first one checking if the chopper is dead and mission is set to win.

Condition of Trigger 1 named MyWinCondition1:

!alive YourChopperName

onAct:

_task = ["YourTaskName", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;
deleteVehicle MyLoseCondition1;

 

 

Condition of Trigger 2, checking if chopper is on ground and alive, named MyLoseCondition1:

alive YourChopperName AND isTouchingGround YourChopperName

onAct:

_task = ["YourTaskName", "FAILED",true] spawn BIS_fnc_taskSetState;
deleteVehicle MyWinCondition1;

 

Cheers

Share this post


Link to post
Share on other sites

I have also replied but this piece of shit forum software ate my reply. So here is goes again:

Condition

isTouchingGround heli

On activation

if (alive heli) exitWith {failMission "fail"}; endMission "win";

  • Like 2

Share this post


Link to post
Share on other sites

For some reason the script makes the heli explode when touching the ground... I only used this: 

alive YourChopperName AND isTouchingGround YourChopperName

because i want the trigger to activate a lose through the menu.

Share this post


Link to post
Share on other sites
28 minutes ago, killzone_kid said:

I have also replied but this piece of shit forum software ate my reply. So here is goes again:

Condition

isTouchingGround heli

On activation

if (alive heli) exitWith {failMission "fail"}; endMission "win";

 

...and it shat it out here

 

 

:P

  • Like 1

Share this post


Link to post
Share on other sites

Ok so now I tried this:
Condition

isTouchingGround heli

------

It works and fails the mission but it still blows up the heli...

Share this post


Link to post
Share on other sites

Very unlikely that a trigger condition will blow up any game object.

What do your onAct fields look like?

Is the chopper touching anything with its rotor?

 

Could be anything causing the chopper to be destroyed, the trigger condition most certainly isn't the cause for that.

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites

I don't have anything written in onAct  and moments before touch down i used camera to zoom and see if it was hitting objects, it wasn't.

and now even if the trigger is deleted it still blows up even though it used to work before

Share this post


Link to post
Share on other sites

This is so weird, without changing any triggers or anything 1 time it landed and 1 time the heli just exploded

Share this post


Link to post
Share on other sites

pls do not that the heli is carrying something but it has a drop cargo waypoint and that is where everything explodes
 

Share this post


Link to post
Share on other sites

Guys i still cant fix the heli exploding, im using a drop cargo waypoint and it goes down and explodes, anything i can check?

Share this post


Link to post
Share on other sites

what I dont get is why r you using the drop cargo waypoint? Is the heli carrying another vehicle and tries to drop it and the mission should fail if that vec touches the ground? Or is it just the heli which tries to land somewhere and if the heli touches the ground then the mission should fail?

I m not a pro with waypoint usage. Maybe there is a simple answer for my questions.

 

Maybe you could try

WP Unload or

WP Transport Unload

if you dont carry anything.

Share this post


Link to post
Share on other sites
Guest
2 hours ago, GeneralTofu said:

Guys i still cant fix the heli exploding, im using a drop cargo waypoint and it goes down and explodes, anything i can check?

 

Why does it explode ? Is it just magically exploding while in the air or does it crash into a building or smthg ?

Share this post


Link to post
Share on other sites
18 hours ago, sarogahtyp said:

what I dont get is why r you using the drop cargo waypoint? Is the heli carrying another vehicle and tries to drop it and the mission should fail if that vec touches the ground? Or is it just the heli which tries to land somewhere and if the heli touches the ground then the mission should fail?

I m not a pro with waypoint usage. Maybe there is a simple answer for my questions.

 

Maybe you could try

WP Unload or

WP Transport Unload

if you dont carry anything.

yes the heli is carrying a drone

Share this post


Link to post
Share on other sites
18 hours ago, harmdhast said:

 

Why does it explode ? Is it just magically exploding while in the air or does it crash into a building or smthg ?

as the drone touches the ground it explodes

Share this post


Link to post
Share on other sites

What's happening at that waypoint? Is the chopper landing on top of the drone?

You're being very vague here.

 

Try this in the drones init:

 

_test = [this] spawn {

	params ["_drone"];
	_drone allowDamage false;
	waituntil {isTouchingGround _drone};
	sleep 10;
	_drone allowDamage true;

};

 

Cheers

Share this post


Link to post
Share on other sites
1 hour ago, Grumpy Old Man said:

What's happening at that waypoint? Is the chopper landing on top of the drone?

You're being very vague here.

 

Try this in the drones init:

 


_test = [this] spawn {

	params ["_drone"];
	_drone allowDamage false;
	waituntil {isTouchingGround _drone};
	sleep 10;
	_drone allowDamage true;

};

 

Cheers

It works, the drone doesn't blow up but even when the player shoots the pilot of the heli carrying it the drone is invinclible, is there a way maybe:
If the heli pilot is dead then the drone becomes destroyable but if the heli pilot is alive the drone is invincible?

Share this post


Link to post
Share on other sites
Guest
_test = [this] spawn {

	params ["_drone"];
	_drone allowDamage false;
	waituntil {isTouchingGround _drone || !alive driver YourChoperName};
	sleep 10;
	_drone allowDamage true;

};

Should do the trick

Share this post


Link to post
Share on other sites

You could also use this inside the chopper and/or drone init:

 

this allowdamage false;
this addEventHandler ["Hit",{

	params ["_vehicle"];
	_vehicle allowdamage true;

}];

Will have the vehicle undestroyable unless it's being fired upon. Kinda wonky solution if the first hit is from an AA missile it won't do any damage.

 

Cheers

Share this post


Link to post
Share on other sites
1 hour ago, Grumpy Old Man said:

You could also use this inside the chopper and/or drone init:

 


this allowdamage false;
this addEventHandler ["Hit",{

	params ["_vehicle"];
	_vehicle allowdamage true;

}];

Will have the vehicle undestroyable unless it's being fired upon. Kinda wonky solution if the first hit is from an AA missile it won't do any damage.

 

Cheers


Would Hit EH work at all? Asking because vaguely remembering disabled damage not triggering any damage EHs

  • Like 1

Share this post


Link to post
Share on other sites
7 hours ago, Grumpy Old Man said:

You could also use this inside the chopper and/or drone init:

 


this allowdamage false;
this addEventHandler ["Hit",{

	params ["_vehicle"];
	_vehicle allowdamage true;

}];

Will have the vehicle undestroyable unless it's being fired upon. Kinda wonky solution if the first hit is from an AA missile it won't do any damage.

 

Cheers

 

9 hours ago, harmdhast said:

_test = [this] spawn {

	params ["_drone"];
	_drone allowDamage false;
	waituntil {isTouchingGround _drone || !alive driver YourChoperName};
	sleep 10;
	_drone allowDamage true;

};

Should do the trick

Ok Thanks Guys! It worked!
Here is the finished mission if you guys are interested to play it. (Sorry If I am not allowed to post links)

http://steamcommunity.com/sharedfiles/filedetails/?id=895621994

Share this post


Link to post
Share on other sites
3 hours ago, killzone_kid said:


Would Hit EH work at all? Asking because vaguely remembering disabled damage not triggering any damage EHs

Just tested it, Hit EH does not fire when allowDamage is set to false.

Kinda weird, since the object is still being hit (you'll get impact sounds and visuals).

 

Cheers

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  

×