Jump to content
Sign in to follow this  
-FW- Shaanguy

nearestObject cant give a name in addaction condition!?

Recommended Posts

TestIDS = [];

TestIDS = TestIDS + [player addAction["<img image='MyPicture.paa' width='32' height='32'/> Pickup Something", "Pickup_Something.sqf", [], 1, false, false, "", "count (_name = nearestobjects [_target, ["CLASSNAME"],  5]) != 0  && _name getVariable 'something' = 4"]];

the problem here is that i cant give a name, i wanted to if the object is locked or getVariable "something" < 5

then the addaction appears, O_o ....................................

Share this post


Link to post
Share on other sites
player addAction
[
"<img image='MyPicture.paa' width='32' height='32'/> Pickup Something", 
"Pickup_Something.sqf", 
[], 
1, 
false, 
false, 
"", 
"{_x getVariable 'something' isEqualTo 4} count (nearestObjects [getPos _target,'CLASSNAME',5]) > 0"
];

Share this post


Link to post
Share on other sites

used this:

player addAction
[
   "<img image='' width='32' height='32'/> Pickup Something", 
   "Pickup_Something.sqf", 
   [], 
   1, 
   false, 
   false, 
   "", 
   "{_x getVariable 'test' > 1} count (nearestObjects [getPos _target,'Land_PaperBox_closed_F',5]) > 0"
];  

i did this setVariable ["test" 1]; in the init of the object

but still the addaction does not appears, am i doing something wrong here?

Share this post


Link to post
Share on other sites

You are chekcing for _x getVariable 'test' is-bigger-then 1, and 1 is not bigger then 1. ;)

Share this post


Link to post
Share on other sites

Posted By t-800a

You are chekcing for _x getVariable 'test' is-bigger-then 1, and 1 is not bigger then 1.

oh yeah my mistake, but i tried this:

player addAction
[
   "<img image='' width='32' height='32'/> Pickup Something", 
   "Pickup_Something.sqf", 
   [], 
   1, 
   false, 
   false, 
   "", 
   "{locked _x == true} count (nearestObjects [getPos _target,'C_Offroad_01_F',5]) > 0"
];  

Share this post


Link to post
Share on other sites
Shaanguy;2879819']i did this setVariable ["test" 1]; in the init of the object

Did you actually write it exactly like this? Because it's gotta be this setVariable ["test"' date='[/b'] 1];

Also, since ArmA 3, locked does not return a boolean, but a number depending on the locked state as vehicles can also be locked for player only etc.

So, instead of "locked _x == true", you have to check for "locked _x == 2". Be aware though that if locked == 1 (default state), it's still different from e.g. 2 even though 1 and 2 may both mean "is locked".

And the types parameter for nearestObjects has to be an array, so try this as action condition:

"{locked _x == 2} count (nearestObjects [getPos _target,['C_Offroad_01_F'],5]) > 0"

Edited by Heeeere's Johnny!

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  

×