Jump to content
Robin Withes

Executing a script on the cursortarget player

Recommended Posts

I want to let medics be able to inject morphine into people.

Script currenty looks like this:

private["_unit"];
_unit = cursorTarget;
if(isNull _unit) exitWith {}; //Not valid
  if(!([false,"Morphine",1] call life_fnc_handleInv)) exitWith {
  ["You need morphine to do this!","#d32df0"] spawn RLG_fnc_RLGNotificationSystem; };
if(player == _unit) exitWith {};
if(!isPlayer _unit) exitWith {};
["Injecting morphine...","#d32df0"] spawn RLG_fnc_RLGNotificationSystem;
player switchMove "AinvPknlMstpSnonWnonDnon_medic_1";
player playMoveNow "AinvPknlMstpSnonWnonDnon_medic_1";
waitUntil{animationState player != "AinvPknlMstpSnonWnonDnon_medic_1";};
_myPosition = getPos player;
if (_unit distance _myPosition > 5) exitWith {["You need to move closer to your target!","#d32df0"] spawn RLG_fnc_RLGNotificationSystem;};
//Here i need to let a script run on _unit

I need to let another script run on the _unit, i would appreciate some help!

Share this post


Link to post
Share on other sites

Can you share your function too? Otherwise try:

//Here i need to let a script run on _unit
[[arguments], _yourFunction] remoteExec ["call", _unit];

 

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

×