Jump to content
Sign in to follow this  
tophe

Check if a unit doesn't exist.

Recommended Posts

Sorry for entering this thread again. Made a mistake in the topic title of the old one... there is no way for me to remove that thread

I want to check if a unit is either present in a trigger or doesn't exist at all... Both conditions should return True.

Like this:

Act: Blufor - present

Condition: this && (unit1 in thislist or isNull unit1) && (unit2 in thisList or isNull unit2)

So what I need is for every parenthesis  to return TRUE if the unit is either in the list or doesn't exist at all.

I can't get it to work. I debugged by putting a parenthesis  with a unit that isn't placed on the map,

and the trigger wouldn't set off.

It was still waiting for the non-existent unit to be in the list.  

Share this post


Link to post
Share on other sites

Get rid of the first condition (this &&) and you should be all set.

After all, the condition "this" will only be true if the main condition of the trigger is fulfilled (e.g. BLUFOR present), which will never be true at the same time as the "isNull" condition.

But are you sure you want to test for "isNull", and not for (!alive)?

I'm not sure what your exact scenario is, but if you're looking for dead units, those aren't totally removed from the game right away (which would make isNull true). If I remember right, they will turn into null objects at some point, but you should probably do some further testing of that before you implement that condition.

Share this post


Link to post
Share on other sites

Thank you.

What I need is the trigger to go off when all player units are inside it. The number of player units may vary with the amount of players...

So that's why I wanted the trigger to go when unit1 and unit2 are either in it or doesn't exist at all.

The !alive won't work if a unit never was in the mission.

Share this post


Link to post
Share on other sites

i think you have it right you are just not setting up the mission

correctly, isnull is looking for a object so if you don't init the object to

start with it can't possibly work.....eg:

make sure both units are on the map to start with and named unit1 and unit2.

then delete unit2 with a trigger "deletvehicle unit2" and then walk into your main trigger to see if it works.

Share this post


Link to post
Share on other sites

I though isNull just checked if something was nothing...

The thing is that I can't add and delete the units, since the units present will be the ones the playes pick in the lobby.

Is there any other way of checking of a unit doesn't exist?

Share this post


Link to post
Share on other sites

then put "disabledAI = true"

in the description.ext

Share this post


Link to post
Share on other sites

Well.. that I have done...

What I need is to check what units doesn't exist. There are 5 spots...

If there are only 3 players I need to check which units are not in the game.

The trigger is supposed to go off ONLY when all players are in it.

So I wanted the trigger to treat a non-existent unit as present in the trigger.  

(unit1 in thislist or dontExist unit1) && (unit2 in thislist or dontExist unit2) etc...

That way the trigger will only go off when all players are in it, no matter if all 5 units are played or only one.

Share this post


Link to post
Share on other sites

I just checked and "disabledAI = true" dosn't init the object anyway so you might need to add something like...

"if(not(isplayer this))then{deleteVehicle this}"

to each init line of the units....not sure how that effects jip but

should get you onto then next problem.

make sure you remove "disabledAI = true" from the description.ext

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  

×