Jump to content
kibaBG

Push object script doesn't work on dedicated

Recommended Posts

Hi, I cannot make script work on dedicated. I spawn a boat and want to have the option to push it to the water. 

 

private _actionA = ["<t shadow='2' color='#f5f242'>PUSH</t>", {
params ["_target", "_caller", "_actionId", "_arguments"];
_target setVelocity [(sin(direction _caller))*3, (cos(direction _caller))*3, 0];
},nil, 6, false, true,"", "true", 3,false,"",""];
[_boat, _actionA] remoteExec ["addAction",[0,-2] select isDedicated,_boat];

Works in eden but not on dedi.  Similar script for unbuilding the boat is working ok in dedi. 

//works perfectlly on dedicated 

private _actionB =  ["<t shadow='2' color='#f5f242'>UNBUILD</t>", {
params ["_target", "_caller", "_actionId", "_arguments"];
deleteVehicle _target;
},nil, 6, false, true,"","true", 3,false,"",""];
[_boat, _actionB] remoteExec ["addAction",[0,-2] select isDedicated,_boat];

 

Share this post


Link to post
Share on other sites
On 2/16/2024 at 5:10 AM, kibaBG said:

Hi, I cannot make script work on dedicated. I spawn a boat and want to have the option to push it to the water. 

 


private _actionA = ["<t shadow='2' color='#f5f242'>PUSH</t>", {
params ["_target", "_caller", "_actionId", "_arguments"];
_target setVelocity [(sin(direction _caller))*3, (cos(direction _caller))*3, 0];
},nil, 6, false, true,"", "true", 3,false,"",""];
[_boat, _actionA] remoteExec ["addAction",[0,-2] select isDedicated,_boat];

Works in eden but not on dedi.  Similar script for unbuilding the boat is working ok in dedi. 


//works perfectlly on dedicated 

private _actionB =  ["<t shadow='2' color='#f5f242'>UNBUILD</t>", {
params ["_target", "_caller", "_actionId", "_arguments"];
deleteVehicle _target;
},nil, 6, false, true,"","true", 3,false,"",""];
[_boat, _actionB] remoteExec ["addAction",[0,-2] select isDedicated,_boat];

 

 

That's because your ship is server local.

When you remoteExec addaction for all clients, it's OK but the script of action itself stays local: run on client who called the action. As your boat is on server, you need to remoteExec (on server : 2) also each command of this code which have a local Argument (LA), as setVelocity Simple as that.

 

Note: Now, if you have another player as driver, waiting for your push, he is the owner of the boat. You need to remoteExec setVelocity on his PC, where the boat is owned (target for remote exec is _boat)

not tested.

  • Like 1

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

×