OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Mad Pup on 28 Jan 2010, 00:23:17

Title: stopping triggers once dead [SOLVED]
Post by: Mad Pup on 28 Jan 2010, 00:23:17
Hi Mad Pup again (sorry for the sudden burst of questions), I would like to know, how to have a trigger, stop executing once an AI civilian is dead. For example, I make a trigger, that executes every time you enter it's boundries, and it has a civilian man in the middle. And once I kill that civilian, the trigger stops executing, even though you exit the boundries, and come back in.
Title: Re: stopping triggers once dead
Post by: Krieg on 28 Jan 2010, 13:26:39
I think that trigger editing should solve your problem.

Name your old trigger "atrigger"

Add new trigger.

Make it the same size as the one you want to execute while civilian is present.

Place it close to your old trigger.

Group the civilian with the new trigger, open it up and edit it to following:

Vehicle (can only be done when vehicle (i.e. soldier, civilian, Tank etc.) is grouped with trigger)
Once
Not Present

In "On Activation" field write "deleteVehicle atrigger" (of course, without the quotation marks).
____________________________________________________________________________________________

Hope that helps,
Krieg
Title: Re: stopping triggers once dead
Post by: Mad Pup on 30 Jan 2010, 01:22:36
Yay! It Worked!  :D
Thanks Once Again Krieg!  :good:
Title: Re: stopping triggers once dead [SOLVED]
Post by: savedbygrace on 31 Jan 2010, 04:11:54
Just to help keep unnecssary trigger amounts down you could simply add the check inside the condition field.
Code: [Select]
Condition: this && (alive unitname)That way the script will check for unit presence and the life status of a particular unit.

You could also do it this way...
Code: [Select]
Condition: ? (player distance unitname < 1) and !(alive unitname)
OnActivation: Deletevehicle triggername
You can adjust the distance to your requirements and execute additional code after the deletion by using a semicolon. (If you need to) It will also reduce the amount of triggers used throughout your mission as well as reduce the clutter formed by group lines.

Title: Re: stopping triggers once dead [SOLVED]
Post by: Mad Pup on 31 Jan 2010, 04:16:32
Thanks savedbygrace! I'll look into it.

Mad Pup