Jump to content
Sign in to follow this  
Asung

Using !isNull and isNull as a condition

Recommended Posts

Hello all,

I had a quick question that I didnt find the answer to searching. From what I have read this should work:

I have 6 popup target objects named P1,P2,P3, Z1,Z2,Z3. I am trying to make it so that if p1 appears then so does p2 and p3 but not z1 , z2, z3. If p1 does not appear then p2 and p3 do not appear and z1,z2,z3 appear. Basically if no Ps then Zs, if Zs then no Ps.

p1 has a 15% chance of presence

p2 has " !isNull p1 " in the condition. I think this means "If p1 exists then so does p2"

p3 also has " !isNull p1 " in the condition.

Z1 has the following in the condition " isnull p1 " I think this means If p1 does not exist then z1 exists (and z2, z3 should exist too because z2 and z3 are conditional on z1 see bellow)

Z2 and Z3 has " !isNull z1" in their condition.

This isnt working out for me - can anyone advise?

Share this post


Link to post
Share on other sites

Hi...what do you mean by "appears"? .... and are you trying this the very hard way with triggers?

Share this post


Link to post
Share on other sites

I am putting these values into the condition of each unit inside the editor. I am not using triggers

When I mean appear, I refer to the placement of objects when a mission loads. Effectively I want p1,p2,p3 to be in my mission or z1,z2,z3 in my mission but not both groups. I set p1 to 50% chance presence.

Share this post


Link to post
Share on other sites

Might be much easier to script it than do it the way you are doing it!

Now I'm saying "easier".....but the logic needs to be sorted out.... and at the moment I don't have a very logical brain.

---------- Post added at 12:51 PM ---------- Previous post was at 11:45 AM ----------

After a few coffees it's all clear now. Much simpler than I first thought! :)

Create a little script in your mission folder and add this code to it. Here it's called "script.sqf"... but you can give it a more imaginative name.

script.sqf...

_randnum = floor random 2;

switch (_randnum) do {
case 0: {
	deletevehicle P1;
	deletevehicle P2;
	deletevehicle P3;
};
case 1: {
	deletevehicle Z1;
	deletevehicle Z2;
	deletevehicle Z3;
};
};

In your players init put this...

nul = [] execVM "script.sqf";

Should be easy enough to follow what's going on.

No need for probability of presence... so make sure it's off on all the targets.

Edited by twirly
Spelling

Share this post


Link to post
Share on other sites

Use...

p1 in [url="http://community.bistudio.com/wiki/allMissionObjects"]allMissionObjects[/url] "Static"

or

not (p1 in allMissionObjects "Static")

...instead of isNull.

;)

Share this post


Link to post
Share on other sites
Use...

p1 in [url="http://community.bistudio.com/wiki/allMissionObjects"]allMissionObjects[/url] "Static"

or

not (p1 in allMissionObjects "Static")

...instead of isNull.

;)

I've never used that, but doesn't that cause an undefined variable error when the object p1 does not exist?

Share this post


Link to post
Share on other sites
I've never used that, but doesn't that cause an undefined variable error when the object p1 does not exist?

I'm playing always with -showScriptErrors, but i have never noticed an error like that with that method...

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  

×