Jump to content

Recommended Posts

Hi,

currently almost finished a revive mod, and it works perfectly with a self-hosted MP mission, however, when I test with friends, ie remote players, sometimes the Damage Handler seems to slip and death happens - when I have code to prevent damage going to 1.

In all my tests self hosted just with AI, the damage handler works perfectly. But with remote players - sometimes it seems it "slips" and a player still dies. I am remoteExec the damage handler on each player.

I have extensive rpt logging with diag_logs in the damage handler (which is remoteExec to the server) and it doesnt make any sense why just occasionally a remote player still dies.
I have tested and tested in multiple environments with self-hosted missions and it works 100%.  

Could it also be that I am self-hosting a game using wireless and this is unreliable? network speed? I would think the damage handler is running on each remote machine (I remoteExec it).

I just wanted to know an efficient method for testing MP without always relying on freinds to log in. Is there a better way?

cheers

Bendy

Share this post


Link to post
Share on other sites

You should (re)read some topics about writing for MP. Eventhandlers don't need to be remoteExecuted for existing objects in editor. Keep that for spawned ones if needed.

So, usually you write it (them) in:

- initPlayerLocal , as far as players are concerned by the script,

- or init.sqf (server + clients)

-  or even init field of an object (referring to this as multiple examples on BIKI, server + clients also)

then it (they) work(s), and the condition for triggered script does the trick.

 

You can read the Argument is Global , so you don't care about locality of the 1st argument (the object you apply the code like for handleDamage event):

this addEventHandler ["HandleDamage", { params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit", "_context"]; }];

 

But... the triggered scripts fire for local event, most of the time. So, depending on what commands/functions you are calling, the effects can be local or global.

like for handleDamage EH : "...however it will only fire when the unit is local to the PC this event handler was added on."

 

 

The best way for testing is to create your own dedicated server. What is working for a dedi, works for a hosted one. The contrary may fail.

Some links:

https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting

https://community.bistudio.com/wiki/Code_Best_Practices

https://community.bistudio.com/wiki/Code_Optimisation

https://community.bistudio.com/wiki/Mission_Optimisation

https://community.bistudio.com/wiki/Multiplayer_Scripting

https://community.bistudio.com/wiki/Arma_3:_Dedicated_Server

https://community.bistudio.com/wiki/Arma_3:_Server_Config_File

 

  • Like 3

Share this post


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

You should (re)read some topics about writing for MP. Eventhandlers don't need to be remoteExecuted for existing objects in editor. Keep that for spawned ones if needed.

So, usually you write it (them) in:

- initPlayerLocal , as far as players are concerned by the script,

- or init.sqf (server + clients)

-  or even init field of an object (referring to this as multiple examples on BIKI, server + clients also)

then it (they) work(s), and the condition for triggered script does the trick.

 

You can read the Argument is Global , so you don't care about locality of the 1st argument (the object you apply the code like for handleDamage event):

this addEventHandler ["HandleDamage", { params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit", "_context"]; }];

 

But... the triggered scripts fire for local event, most of the time. So, depending on what commands/functions you are calling, the effects can be local or global.

like for handleDamage EH : "...however it will only fire when the unit is local to the PC this event handler was added on."

 

 

The best way for testing is to create your own dedicated server. What is working for a dedi, works for a hosted one. The contrary may fail.

Some links:

https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting

https://community.bistudio.com/wiki/Code_Best_Practices

https://community.bistudio.com/wiki/Code_Optimisation

https://community.bistudio.com/wiki/Mission_Optimisation

https://community.bistudio.com/wiki/Multiplayer_Scripting

https://community.bistudio.com/wiki/Arma_3:_Dedicated_Server

https://community.bistudio.com/wiki/Arma_3:_Server_Config_File

 



Thanks Pierre, will test your suggestions!!

Bendy

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

×