Jump to content
Sign in to follow this  
Gloopy

Trigger1 AND Trigger2 returns script error

Recommended Posts

Hello!

I have a problem with some triggers.

I have two triggers, they check (using GetDammage) if a weapons cache (Weapons US) has been blown up (below screenshot)

script_error.JPG

This is working OK as I am getting the obj complete message after destroying the ammo box.

Then I have another Trigger which checks to see if ammo1t and ammo2t are true and if so and if so it ends the mission. For this I am using in the condition field ammo1t AND ammo2t and getting an error of Error and: Type Object, expected Bool.

Screenshot of that trigger below

script_error2.JPG

I'm sure it's quite simple and/or there's a better way to do it.

Any help much appreciated.

-Gloopy biggrin_o.gif

Share this post


Link to post
Share on other sites

Write this as condition of the trigger:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">!(alive ammo1 || alive ammo2)

Share this post


Link to post
Share on other sites

ammo1t and ammo2t should be booleans. A boolean is either true or false.

It seems you have an object that you gave the name ammo1t or ammo2t. Or maybe you use the ammo1t or ammo2t variable elsewhere to point to an object. (Lol im so blind, just see that you named the trigger ammo1t / ammo2t)

Basicly:

[*] Make sure you use the right variables names and dont use the same variable name for different data types (boolean, object, string, array, etc tounge2.gif)

[*] As Raedor pointed out, getdammage is not necessary, you can use  the alive function.

[*] If you want to end the mission when 2 ammo caches are destroyed (ammo1 and ammo2) the condition should be: !(alive ammo1) && !(alive ammo2)

[*] If you want to end the mission if 1 ammo cache is destroyed, doesnt matter which one, the condition should be: !(alive ammo1 && alive ammo2)

@ Raedor,  how does !(alive ammo1 || alive ammo2) work out? I believe this would end the game if 1 of the two conditions would become false, not only after both?

Share this post


Link to post
Share on other sites

Hell yeah,

Thanks guys. I see the issue now.

Will this work with probability of presence. i.e if ammo1 doesn't spawn, it isn't alive so technically the trigger will check it off and when you blow up ammo2 you will still get the End#1 result from the trigger?

Thanks again!

Share this post


Link to post
Share on other sites
Hell yeah,

Thanks guys. I see the issue now.

Will this work with probability of presence. i.e if ammo1 doesn't spawn, it isn't alive so technically the trigger will check it off and when you blow up ammo2 you will still get the End#1 result from the trigger?

Thanks again!

np.

no I believe you will get an error because the alive function expects an object, and not a nil variable or any other data type.

You will have to work around this by scripting or by some specific setup of triggers and init fields etc, but I know very little about the editor, editor placed triggers and inits. Scripts all the way for me tounge2.gif

Actually, Just out of my head, sth like:

trigger condition:

!(isNil "ammo1") && (your conditions)

this will only use the trigger if ammo1 object exists.

Share this post


Link to post
Share on other sites

Cool,

I'll give it a shot.

Cheers

-Gloopy

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  

×