Jump to content
Sign in to follow this  
allamawitharifle

Probability of presence and not alive

Recommended Posts

I have a mission with a lot of units probability of presence randomly selected and this seems to be causing chaos when I want to end the mission.

I have a trigger set to opfor present and then the condition field is...

count thislist <= 4 and ({alive _x} count crew armoura1 == 0)[ and ({alive _x} count crew armoura2 == 0)

Then my activation field just runs a simple script.

What I want to do is check that there are no more than 4 units alive in the trigger and that all the crew of the armour is dead and then run the script.

Although the condition field works perfectly when both armoura1 and armoura2 (names given to the vehicles) exist but when they are not present in the mission due to their probability of presence then the trigger doesn't seem to consider the crew as dead so instead just lets the mission hang and will not activate the script.

How can I get around this?

Edited by aLlamaWithARifle

Share this post


Link to post
Share on other sites

try this: but i think this condition will cause trouble, untested, try it but dont get your hopes up.

much better to do this in a script since triggers beheave like scripts andway there is no real difference exept for the practcal one.

added check inside counts if !isNull armoura.... means if existing.

count thislist <= 4 and ({!isNull armoura1 AND alive _x} count crew armoura1) == 0 and ({!isNull armoura2 AND alive _x} count crew armoura2) == 0

Share this post


Link to post
Share on other sites

The [ was an accident, from the [/code] tag, will remove it.

Will give Deomized line a go, shall report back soon :D

Edit - Nope doesn't seem to work, even tried a quick test mission with a trigger checking "isNull armoura1" and just firing a hint on the activation then setting the probability of armoura1 to 0% and that doesn't seem to work. Can't seem to get isNull to activate a trigger at all totally removing armoura1 and it still wouldn't activate the trigger

isNil "armoura1" works when the vehicle's probability is 0%... already tried

({isNil "armoura1" or alive _x} count crew armoura1 == 0)

This now works but only if the vehicle exists from the start and then the crew get killed, however if the vehicle does not exist from the beginning then the trigger doesn't fire.

Edited by aLlamaWithARifle

Share this post


Link to post
Share on other sites

try:

(({(vehicleVarName _x) == "armoura1"} count vehicles) != 0 AND ({alive _x} count crew armoura1) == 0)

or:

({(vehicleVarName _x) == "armoura1" AND ({alive _x} count crew _x) == 0} count vehicles) != 0

Share this post


Link to post
Share on other sites

With both of them the trigger only fires if the crew is dead and the vehicle was there from the start

Share this post


Link to post
Share on other sites

Your condition is failing because in the case that either armoura1 or armoura2 doesn't exist, one or both of those variables are undefined. This means that the engine does not know how to evaluate anything about these variables, leading to a boolean statement that returns neither true nor false. To fix the problem, you will need to declare these variables as null objects in the case that the vehicles don't show up.

In your init.sqf file, put the following code:

if (isNil "armoura1") then {armoura1 = objNull};
if (isNil "armoura2") then {armoura2 = objNull}

Now your original condition will work, as "crew objNull" returns an empty array (whereas "crew <undefined variable>" returns nothing).

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  

×