Jump to content
Sign in to follow this  
mr_shadow

[code help] action

Recommended Posts

Hello, does someone know whats wrong with it?

bgate_1 addaction ["Open","open12.sqf",[],1,false,true,"","isro and player distance bgate_1 <= 0.55"];

if (!("itemandroid" in (items player)) ) then


{


isro          = true;
};

---------- Post added at 23:24 ---------- Previous post was at 21:57 ----------

"Has weapon" can't help me because I'm trying to detect item.

This one also is not working

bgate_1 addaction ["open","open12.sqf",[],1,false,true,"","("itemandroid" in (items player)) and player distance bgate_1 <= 0.55"]; 

So does anyone know how can i check for item in inventory?

Edited by mr_shadow

Share this post


Link to post
Share on other sites

isro distance bgate_1 <= 0.55 and player distance bgate_1 <= 0.55

Share this post


Link to post
Share on other sites

It was working without isro, are you sure that the problem is with distance?

Share this post


Link to post
Share on other sites

Isro will work if its a boolean, not if it's an object

---------- Post added at 11:07 AM ---------- Previous post was at 11:06 AM ----------

@OP code

Share this post


Link to post
Share on other sites

If you want to check if two units are within certain distance to a target, you need to check each distance separately. You can't just do "unit1 and unit2 distance...".

isro distance bgate_1 <= 0.55

and

player distance bgate_1 <= 0.55

Share this post


Link to post
Share on other sites

I think isro is a boolean. maybe use some brackets just to be sure thats not the problem...

(isro && ((player distance bgate_1) <= 0.55))

Share this post


Link to post
Share on other sites

Really is this part correct?

         
if (!("itemandroid" in (items player)) ) then 


{ 


isro          = true; 
};  

---------- Post added at 14:48 ---------- Previous post was at 13:59 ----------

This one also is not working

bgate_1 addaction ["open","open12.sqf",[],1,false,true,"","("itemandroid" in (items player)) and player distance bgate_1 <= 0.55"]; 

---------- Post added at 16:36 ---------- Previous post was at 15:15 ----------

So does anyone know how can i check for item in inventory?

Edited by mr_shadow

Share this post


Link to post
Share on other sites

Does this give you any hints?

You're telling the engine BEGIN STRING - ( - END STRING - itemandroid BEGIN STRING ... etc

Wrap "itemandroid" in normal quotes so it reads 'itemandroid'

Edited by cuel

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  

×