Jump to content
Isaac Lemoal

setAnimSpeedCoef not working on multiplayer, help.

Recommended Posts

setAnimSpeedCoef which works in singleplayer doesnt work in multiplayer, here is the input i put in "[_this, 0.65] remoteExec ["setAnimSpeedCoef", 1];" if this is wrong feel free to correct me as i would very much like this script to work, thanks in advance.

Share this post


Link to post
Share on other sites
11 hours ago, pierremgi said:

[_this, 0.65] remoteExec ["setAnimSpeedCoef", 0];

 

 

Thank you for replying. Unfortunetly it doesn't work, would there be anything else i need to add in order for the script to work ?

Share this post


Link to post
Share on other sites
1 minute ago, Isaac Lemoal said:

Thank you for replying. Unfortunetly it doesn't work, would there be anything else i need to add in order for the script to work ?

Where your _this variable comes from?

Share this post


Link to post
Share on other sites
37 minutes ago, pierremgi said:

Where your _this variable comes from?

i used the script here https://community.bistudio.com/wiki/setAnimSpeedCoef and replaced "player" with "_this"

Share this post


Link to post
Share on other sites

_this is a magic variable. You can't use it if it doesn't refer to something (object like player or unit here)
So, the question remains: what is _this?

Share this post


Link to post
Share on other sites
40 minutes ago, pierremgi said:

_this is a magic variable. You can't use it if it doesn't refer to something (object like player or unit here)
So, the question remains: what is _this?

its in the init field of a playable unit

Share this post


Link to post
Share on other sites

In int field of any object (unit, playable unit, vehicle or else),

1 you don't have to remoteExec the code because it runs on every server + clients (at start)

2 the magic variable is this, not _this for these fields.

so,

this setAnimSpeedCoef 0.65;

 

and that's OK.

Share this post


Link to post
Share on other sites
2 hours ago, pierremgi said:

In int field of any object (unit, playable unit, vehicle or else),

1 you don't have to remoteExec the code because it runs on every server + clients (at start)

2 the magic variable is this, not _this for these fields.

so,

this setAnimSpeedCoef 0.65;

 

and that's OK.

It doesn't work, on single player it does and there is an actual difference of speed of animation but whenever i host the server locally or on a server it just doesn't work and i don't know why.

Share this post


Link to post
Share on other sites
7 hours ago, Isaac Lemoal said:

It doesn't work, on single player it does and there is an actual difference of speed of animation but whenever i host the server locally or on a server it just doesn't work and i don't know why.

Probably because locality changes when a player joins on a playable unit.

Try:

this setAnimSpeedCoef 0.65;
this addEventHandler ["Local", {
  params ["_entity", "_isLocal"];
  if (_isLocal) then {[_entity,0.65] remoteExec ["setAnimSpeedCoef",0]};
}];

No other idea.

  • 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

×