Jump to content
seth0351

Object addaction -> sever executed script

Recommended Posts

So the idea here is to walk up to a door, place a breaching charge and have a SLAM mine spawn in and detonate in 5 seconds. The door is a simple object to prevent it from having an action (to mimic it being locked) so I used an invisible wall in front of the door as the object with the addaction. The problem is with the dedicated server, if I run the command via console on the server it executes fine but the addactions don't work. I've tried remoteexect as well to no avail. Is there another way to call a script from a client on the server?

Script:
 

// [[gate_8,wall_8],"breach.sqf"] remoteExec ["execVM",0];
// nul = [gate_6,wall_6] execVM "breach.sqf";

_gate = _this select 0;
_wall = _this select 1;

if(_gate == gate_7) then
{
mine = createVehicle ["ACE_SLAMDirectionalMine_Timer_Ammo", [(getpos _gate select 0)-.4,(getpos _gate select 1),(getpos _gate select 2)-2.4], [], 0, "NONE"];
sleep 5;
mine setdamage 1;
deletevehicle _wall;
_gate animate ["Door_1_rot", 1];
} else
{
if(_gate == gate_8 || _gate == gate_1) then
{
mine = createVehicle ["ACE_SLAMDirectionalMine_Timer_Ammo", [(getpos _gate select 0)+.4,(getpos _gate select 1)-.3,(getpos _gate select 2)-.9], [], 0, "NONE"];
sleep 5;
mine setdamage 1;
_gate animate ["Door_1_rot", 1];
deletevehicle _wall;
} else
{
mine = createVehicle ["ACE_SLAMDirectionalMine_Timer_Ammo", [(getpos _gate select 0)-.4,(getpos _gate select 1)+.3,(getpos _gate select 2)-.9], [], 0, "NONE"];
mine setdir 180;
sleep 5;
mine setdamage 1;
deletevehicle _wall;
_gate animate ["Door_1_rot", 1];
};
};

Share this post


Link to post
Share on other sites

Does the action appear, or does it simply do nothing? Could you post the syntax you used?

Share this post


Link to post
Share on other sites

I'm having a very similar problem in addaction for an object for all players when the object is spawned on initServer. If it helps, as OP hasn't posted his syntax yet, here's mine and maybe someone can suggest the correct method.



_paperwork = createVehicle ["Land_Document_01_F", [getPosATL _x select 0, getPosATL _x select 1, getPosATL _x select 2], [], 0, "NONE"];
            _paperwork setDir (getDir _x);
            _myAction = ["Interact",Test_fnc_delegateInteraction, ["1", "2"], 6, true, true, "","side _this == west", 3, false];
[
    [_paperwork, _myAction],
    {
        params ["_paperwork", "_myAction"];
        _paperwork addAction _myAction;
    }
] remoteExec ['call',-2, true];

This does not work, however if I take that into the debug console and server execute it works properly.

 

(some caveats; I have mine setup as initServer has _this call fn_initserver, and within fn_initServer I'm calling object spawns and addactions. Perhaps its an issue of extending to far out from the originating initServer? 

Share this post


Link to post
Share on other sites

I'm having a very similar problem in addaction for an object for all players when the object is spawned on initServer. If it helps, as OP hasn't posted his syntax yet, here's mine and maybe someone can suggest the correct method.



_paperwork = createVehicle ["Land_Document_01_F", [getPosATL _x select 0, getPosATL _x select 1, getPosATL _x select 2], [], 0, "NONE"];
            _paperwork setDir (getDir _x);
            _myAction = ["Interact",Test_fnc_delegateInteraction, ["1", "2"], 6, true, true, "","side _this == west", 3, false];
[
    [_paperwork, _myAction],
    {
        params ["_paperwork", "_myAction"];
        _paperwork addAction _myAction;
    }
] remoteExec ['call',-2, true];

This does not work, however if I take that into the debug console and server execute it works properly.

 

(some caveats; I have mine setup as initServer has _this call fn_initserver, and within fn_initServer I'm calling object spawns and addactions. Perhaps its an issue of extending to far out from the originating initServer? 

 

I had the same problem until I used remoteExec ["addAction", [0,-2] select isDedicated,true]

 

On the other hand, I'm still unable to remoteExec an animation (working in SP).

Share this post


Link to post
Share on other sites

I had the same problem until I used remoteExec ["addAction", [0,-2] select isDedicated,true]

 

On the other hand, I'm still unable to remoteExec an animation (working in SP).

Yeah that's not working either.

here's the code snippet changed; 

 

[_paperwork,["Interact",{ ["1", "2"] spawn Test_fnc_delegateInteraction;},[], 10, true, true, "",
            "side _this == west", 3, false]] remoteExec ["addAction", ([0,-2] select (isMultiplayer && isDedicated)), true];

also tried

remoteExec ["addAction", [0,-2] select |#|isDedicated, true];

Update: also tried this (note changing "addAction" to 'addAction')

remoteExec ['addAction', ([0,-2] select (isMultiplayer && isDedicated)), true];

but that resulted in an error of missing a bracket at the pound sign. 

Suggestions?

 

edit 2: It was the conditional statement that was failing.

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

×