Jump to content
Sign in to follow this  
mr_shadow

Addaction help

Recommended Posts

Hey I have question, hope you you have a solution for this.

I have object1 on map that is adding action1.

Action1 is spawning object2 on map and adding action to object2.

Question: How to add action2 for all players nearby to this object?

Problem: only person who pressed on action1 can see action2

Hope you understand what I mean and are able to help, thanks.

Share this post


Link to post
Share on other sites

You probably will want to use nearObjects command.

Could you post some sample code? It will make it easier to help you.

Share this post


Link to post
Share on other sites

My problem is not how to add "player distance object2 <= 3"

Problem: only person who pressed on action1 can see action2

The action2 is adding locally ONLY to person who pressed on action1.

drop.sqf

_pos = getpos player;
objname= "Land_Money_F";


_obj = objname createVehicle _pos;

_obj addAction ["Pickup","Pickup\Pickup.sqf",[],1,true,true,"",""];

dialog.hpp

class RscShortcutButton_1702: RscShortcutButton {
idc = 1702;
text = "Drop";
x = 30 * GUI_GRID_W + GUI_GRID_X;
y = 11 * GUI_GRID_H + GUI_GRID_Y;
w = 6 * GUI_GRID_W;
h = 1.5 * GUI_GRID_H;
colorBackground[] = {0, 0.49, 1, 1};

action = "execVM 'drop.sqf'";
};

Edited by mr_shadow

Share this post


Link to post
Share on other sites

Well, Ive tryed this:

0 = [[_obj, ["Pickup","Pickup\pickup.sqf",[],1,true,true,"",""]],"", true, true] spawn BIS_fnc_MP;

But i still have a problem - now i cant even see the action. Any tip what I'm doing wrong?

---------- Post added at 16:38 ---------- Previous post was at 15:32 ----------

_obj addAction ["Pickup","Pickup\pickup.sqf",[],1,true,true,"",""] spawn BIS_fnc_MP;

is showing action, but only for player who dropped.

Edited by mr_shadow

Share this post


Link to post
Share on other sites

//this function needs to be available to all clients
MyTag_fncMP_pickupAction = {
_obj = _this select 0;
_obj addAction ["Pickup","Pickup\Pickup.sqf",[],1,true,true,"","_target distance _this < 3"];
};


//where ever you add the action use this line instead
[ [_obj], "MyTag_fncMP_pickupAction", true, false] spawn BIS_fnc_MP;

So MyTag_fncMP_pickupAction is called on all clients via BIS_fnc_MP, this function adds the action to the passed object (locally on the clients machine).

Share this post


Link to post
Share on other sites

That works, thanks for help.

Edited by mr_shadow

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  

×