Jump to content
Sign in to follow this  
Ice_Rhino

Trigger not working on deaths of AI

Recommended Posts

I am creating a mission where at the beginning there is up to 5 lookouts. These lookouts are named opf_lookout_1 to _5. Two of these have the Probability of 50% of being present at mission start. I have a trigger that contains the following condition

!alive opf_lookout_1 && !alive opf_lookout_2 && !alive opf_lookout_3 && !alive opf_lookout_4 && !alive opf_lookout_5

However, When I kill all present, the trigger does not fire the hint message that I have. Is this something to do with the ones that do not spawn?

Any assistance appreciated as always

Toni

Ice Rhino

Share this post


Link to post
Share on other sites

However, When I kill all present, the trigger does not fire the hint message that I have. Is this something to do with the ones that do not spawn?

I haven't tried it, but it may be as "alive someUnit" may not work if someUnit is undefined.

So what you could do for these two units is initialize them as "ofp_lookout_... = objNull" and formulate your condition like this:

... && {isNull opf_lookout_1 || {!alive opf_lookout_1}} && ...

That way, the condition returns true if the unit is undefined OR if it is dead.

Edited by waltenberg

Share this post


Link to post
Share on other sites

Hi W,

What is the syntax I need for "ofp_lookout_... = objNull" part

Thanks for your help so far

Toni

IR

---------- Post added at 16:27 ---------- Previous post was at 16:25 ----------

Oh I think I know what you mean. I will try it

Thanks

IR

Share this post


Link to post
Share on other sites

{
!isNil {_x} &&
{!alive _x}
}count [opf_lookout_1, opf_lookout_2, opf_lookout_3, opf_lookout_4, opf_lookout_5]
==
{
!isNil {_x}
}count [opf_lookout_1, opf_lookout_2, opf_lookout_3, opf_lookout_4, opf_lookout_5]

count how many exist and are dead == how many exist

isNil checks whether the variable exist, if one of the lookouts has not spawned then the variable will be Nil.

The {} around alive make sure alive is not checked if the variable is Nil, otherwise it would throw an error.

Share this post


Link to post
Share on other sites

I have this in the init field for the 2 maybe present units. Units in question are named opf_lookout_4 & _5;

this setCaptive true; this addWeapon "Binocular"; this setCombatMode "BLUE"; this disableAI "ANIM"; 0 = this spawn {waitUntil {time > 0}; _this switchMove "AmovPknlMstpSoptWbinDnon"};opf_lookout_4 = objNull;

this setCaptive true; this addWeapon "Binocular"; this setCombatMode "BLUE"; this disableAI "ANIM"; 0 = this spawn {waitUntil {time > 0}; _this switchMove "AmovPknlMstpSoptWbinDnon"};opf_lookout_5 = objNull;

I then have in the trigger;

!alive opf_lookout_1 && !alive opf_lookout_2 && !alive opf_lookout_3 && {isNull opf_lookout_4 || {!alive opf_lookout_4}} && {isNull opf_lookout_5 || {!alive opf_lookout_5}}

However, it does not fire the hint when the three static and if present optionals are dead or not present

Any Ideas?

Share this post


Link to post
Share on other sites

Start you ArmA 3 with the startup parameter "-showScriptErrors" and run your script again. If you see a box popping up on the top half of your screen, make a screenshot and post it here

OR

go into ArmA 3 folder somewhere at "C:\Users\[yourName]\AppData\Local\Arma3" (I guess, not at my PC atm)

and open the latest "...RPT" file, which is the logfile. Scroll to the bottom until you read something like "error at position..." and copy paste the lines, so we can see the errors if there are some.

Share this post


Link to post
Share on other sites

Started it up with the scripts switch on load of ARMA 3. Loaded the editor, loaded mission, ran mission, killed all visible that relevant to the script but there was nothing was displayed and nothing appeared in the .RPT file anywhere that I could tell.

What now?

---------- Post added at 18:36 ---------- Previous post was at 18:35 ----------

I am going to try Larrow's suggestion now

---------- Post added at 18:37 ---------- Previous post was at 18:36 ----------

In the trigger I guess I put this code??

Share this post


Link to post
Share on other sites
Larrow, where do I put this PHP code?

It's a trigger condition.

Edited by 2nd Ranger

Share this post


Link to post
Share on other sites

Thanks Larrow, that seems to work now

Again, thanks to all

T

IR

Edited by Ice_Rhino

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  

×