Jump to content
Sign in to follow this  
alleycat

How to reference the player that performed the action which called script?

Recommended Posts

I was having the idea of giving a player in coop (all players) to perform an action "draw concealed weapon" which then would give the player that used it a gun and so forth. How do I reference the player that performed the action which called script?

Share this post


Link to post
Share on other sites

ask galz he made an assassination mission where opfor has to blend in with civies until they get a chance to make the kill.. blufor can also seach people for weapons

can't remember the name tho or i'd just point you at the mission

Edited by wheres my rabbit ?

Share this post


Link to post
Share on other sites

Did a bit of logic testing:

_obj = _this select 0;

_caller = _this select 1;

_id = _this select 2;

//remove the action once it is activated

_gen removeAction _id;

if (_obj != _caller) then {hintsilent "Caller is not the same."};

if (_obj == _caller) then {hintsilent "Caller is the same as object"};

This appears to work, however is there a way to prevent an action from being accessible by anyone except the unit that got it? Because right now in a MP game players can walk up to each other and perform actions on each other which, apart from the comedic implications causes the action menu to be full of different (same) actions)

EDIT: The wiki tells about this:

condition: String - (optional, Arma 2 only, default:true) Code that must return true for action to be shown. Special variables "_target" (unit to which action is attached to) and "_this" (caller/executing unit) can be used in the evaluation.

However, using

this addAction ["Draw gun", "draw.sqf",(_this == _target)]

Gives a local variable error

Edited by alleycat

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  

×