froggyluv 2130 Posted August 25, 2016 This one so confusing I confuse myself just attempting it..so basically I'd like to create an Unit (Agent) who has the magical power to walk around and effect other lower troops subskills as long as he is alive. So here is the trigger script based off of another one that does work but where im losing it is getting the script to fire for agent ANd then have the end of the script fire per Unit only once. Thats the problem, I need it to be always active or somewhat repeatable but only hit the effected unit one time. Anyways.. Agent.sqf _agent = this select 0; // The Agent who's power radiates out to sameside troops as skill increase_effected = this select 1; // The unit effected_agent_West = False; // to determine side affiliation_agent_East = False;// to determine side affiliation_agent_Ind = False;// to determine side affiliationif (side _agent == west) then {hintc "Agent Is westie!"; _agent_West = true}; //Give variable name once side is determinedif (side _agent == east) then {hintc "Agent Is Eastie!"; _agent_East = true};if (side _agent == independent) then {hintc "Agent Is Indie!"; _agent_Ind = true};_wz = createTrigger ["EmptyDetector", getPos _agent]; //name of trigger to both attach to agent and then delete when agent is dead_wz setTriggerArea [300, 300, 0, false]; //apply to all friendly units within 300m_wz setTriggerTimeout [0, 0, 0, false];_wz attachto [_agent,[0,0,0]]; if (_agent_west) then { _wz setTriggerActivation ["west ", "PRESENT", false]; } else {}; if (_agent_east) then {_wz setTriggerActivation ["east", " PRESENT", false];} else {};if (_agent_Ind) then {_wz setTriggerActivation ["Independent", " PRESENT", false];} else {};_wz setTriggerStatements ["this", nul = [this select 1] execVM "SkillBump.sqf"; // effected to fire the skillchange script skillBump.sqf _this select 0;_SfaA =_this skillFinal "aimingAccuracy";_sFx = _sFaA * 2; //skill bonus to unit by doubling it_enhancedUnit = true; // Target that this unit is already skill bump Share this post Link to post Share on other sites
das attorney 857 Posted August 25, 2016 Try this (untested though) :) fnc_magicalLoop = { while {not isNull _this and {alive _this}} do { _friends = (_this nearEntities ["CAManBase",20]) select { side _x == side _this and {not (_x isEqualTo _this)} and {isNil {_x getVariable "enchanted"}} }; systemChat format ["normal friends %1", _friends]; if not ([] isEqualTo _friends) then { _friend = selectRandom _friends; systemChat format ["magic friend %1", _friend]; _SfaA = _friend skillFinal "aimingAccuracy"; _sFx = (_sFaA * 2) min 1; _friend setskill ["aimingAccuracy",_sFx]; _friend setVariable ["enchanted",true] }; uiSleep (20 + random 20); }; }; and put this in his initline (assuming it's for SP) this spawn fnc_magicalLoop; edit: oops forgot to set the skill at the end Share this post Link to post Share on other sites
froggyluv 2130 Posted August 25, 2016 Interesting and way more elegant looking -so this is using a 20m radius yes? The systemchat is running and calling out Magic friends (lmao) but they're not getting the Aimingaccuracy bump. Edit: Actually it works awesome - much better than what i was attempting and i can build off this. Trying to make 'Chess piece'units that effect the game world by their very presence. Such as Great Commander, Terrorizer etc Thanks again! Share this post Link to post Share on other sites
das attorney 857 Posted August 25, 2016 No problem mate :) (sorry about forgetting the skill set at first - my bad) 1 Share this post Link to post Share on other sites