Kaisoft 10 Posted November 27, 2011 Hello people!. I want one specific unit activate an "addaction". I would like to do on this way... if is possible. if ( player == nameunit ) then {goto "fix"} else {goto "nofix"}; #fix object setdamage 0; exit; #nofix hint "you can not fix this object"; exit; Those units are engineers. But i thought it would be possible if i use "iskindof" engineers. I tried make it alone, but i can´t... Share this post Link to post Share on other sites
buliwyf 4 Posted November 27, 2011 I would put the addAction on the vehicle. And than do following: ID01=this addAction [("<t color='#009900'>" + ("Repair vehicle") +"</t>"), "repair.sqf",[],0,false,true,"","typeOf player == 'USMC_SoldierS_Engineer'"]; repair.sqf: private["_obj","_id"]; _obj = _this select 0; _id = _this select 2; _obj removeAction _id; _obj setDamage 0; ;) Share this post Link to post Share on other sites
Kaisoft 10 Posted November 27, 2011 It works fine. But in my mission nobody knows which is the target. I would like everyone to see that "addaction" and when it being activated, it says "You can not fix that object because you are not an expert". It can be a track for continue the mission. People would say.. "hey man.. what is this?, can anyone take a look?" :) Sorry if i am insistent and thank you so much. PD: Please i need to know how can i check when a unitname is player. Share this post Link to post Share on other sites
Strikor 10 Posted November 27, 2011 For one unit you could use something like: if (player != p12) exitwith {hint "whatever"}; or for a specific class: if (typeof player != "US_Soldier_Engineer_EP1") exitwith {hint "whatever"}; Share this post Link to post Share on other sites
buliwyf 4 Posted November 27, 2011 (edited) In my example only the class USMC_SoldierS_Engineer can see the addAction and repair the vehicle... you are right... Delete the part in the addAction: typeOf player == 'USMC_SoldierS_Engineer' And the repair.sqf (think you have to edit the classname of the engineer?!): private["_obj","_caller","_id"]; _obj = _this select 0; _caller = _this select 1; _id = _this select 2; if(typeOf _caller != "USMC_SoldierS_Engineer")exitWith{"No Engineer!"}; _obj removeAction _id; _obj setDamage 0; _caller sideChat "You repaired the vehicle."; :cool: Edited November 27, 2011 by Buliwyf Share this post Link to post Share on other sites
Kaisoft 10 Posted November 27, 2011 Yeah, it works as expected. One more question. How i insert more conditions? i have tried this: if (player != p12) or (player != p13) or (player != p14) exitwith {hint "whatever"}; There are three engineers, but it isn´t works. ---------- Post added at 08:11 PM ---------- Previous post was at 07:59 PM ---------- Ok, i have been trying it and i have solved it alone! The problem was here: if ((player != p12) AND (player != p13) AND (player != p14)) exitwith {hint "whatever"}; Thank you guys so much. Share this post Link to post Share on other sites
iceman77 18 Posted November 27, 2011 are _caller and _id set variables by BIS? Share this post Link to post Share on other sites
buliwyf 4 Posted November 27, 2011 are _caller and _id set variables by BIS? No... take a look here: http://community.bistudio.com/wiki/addAction ...in the examples you find it. ;) Share this post Link to post Share on other sites