Jump to content
Sign in to follow this  
wontial

Conditions for not being "in" the vehicle?

Recommended Posts

I feel bad about posting a thread twice a day, but I've searched the forum, armaholic, ofpec, wiki and looked up comrefs and tried to figure out on my own to no avail. Just a little bit of help and I'll be a very happy man :)

I have an addaction command assigned to the init line of a tank named tankm. The code are as follows

repair = this addAction ["Emergency Field Repair","repair\repair.sqf",[],1,false,true,"","(damage tankm > 0.5) && (engineer distance tankm) < 4 && (player == engineer)"];

So basically, I'm trying to get Emergency Field Repair action to pop up when all these criterias are met - Tank is efficiently damaged, the engineer is close to the tank, and only the engineer gets the action menu.

On top of this, I want it so that the engineer receives the menu only AFTER when he exits the vehicle. Yes, currently the menu pops up even when he's in the vehicle and thats not a very desirable situation.

I tried... engineer !in tankm, != engineer in tankm, unassignvehicle tankm, leavevehicle and few others...just not sure what codes are right for this situation.

Share this post


Link to post
Share on other sites

(vehicle engineer) == engineer 

but anyway, using the builtin special variables of addaction (_this and _target)

repair = this addAction ["Emergency Field Repair","repair\repair.sqf",[],1,false,true,"","(damage _target > 0.5) && (_this distance _target) < 4 && (typeOf _this) == 'US_Soldier_Engineer_EP1' && (vehicle _this) == _this"];

here only the US engineer class can ever see the action, and only when vehicle is damaged more than 0.5 and engineer is less than 4 away and engineer is on foot.

more classnames here for other factions like USMC etc..

http://forums.bistudio.com/showthread.php?t=73241

Share this post


Link to post
Share on other sites

oh...wow...I never thought this "==" would do the job... so simple and I had no idea. Guess I'll never forget the uses of this command. :) As for the unit class, I've made my own version of repairing vehicle and another repair action of the game's engineer class seemed redundant. And I couldn't figure out how to remove it, but now it doesn't really matter.

Anyway, thank you so much for the advice Demonized, your replies have helped me time and again on other different threads too. Kudos to you.

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  

×