Jump to content
Sign in to follow this  
IAmMarshicus

Trigger run if unit not found?

Recommended Posts

I've searched but couldn't come across anything, so I'm here again asking for assistance.

Basically I've made a unit have a 70% chance of spawning. Although if the unit doesn't spawn I would like a trigger to realise this and run a script. I've tried using "!alive" but that didn't work, so I'm out of ideas.

Can someone help me, please? :)

Share this post


Link to post
Share on other sites
I've searched but couldn't come across anything, so I'm here again asking for assistance.

Basically I've made a unit have a 70% chance of spawning. Although if the unit doesn't spawn I would like a trigger to realise this and run a script. I've tried using "!alive" but that didn't work, so I'm out of ideas.

Can someone help me, please? :)

Have you tried using isNull ?

 isNull obj

Operand types:
   obj: Object
Type of returned value:
   Boolean
Description:
   Checks whether the value is equal to objNull. Note: a==ObjNull does not work, because objNull is not equal to anything, even to itself.

Example:
   isNull objNull , result is true

Category: OFP 

Share this post


Link to post
Share on other sites

To be completely honest with you, I had no idea what to use once "!alive" didn't work. :D

Thanks for helping me out, I'll try it tomorrow when I can think straight.

Share this post


Link to post
Share on other sites

I've been messing about with isnull all night and I couldn't get it to work right, when I tested it I found that isnull objectname reports bool or false not what I was after.

I found isnil "objectname" returns both true or false depending on his probability of presence

Share this post


Link to post
Share on other sites

IsNull checks if the object is objNull.

isNil checks whether a variable with the given name is defined.

If the unit gets created, then the name you have given is initialized to a reference to that unit.

If the unit doesn't get created the name you have given the unit is never initialized to a value and is therefore nil (not defined).

Since that name is nil it could be anything. When you then use isNull and the variable is not defined then it tells you that the result is a bool (it could be both true or false but it can give you the correct answer since it doesn't know it).

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  

×