Jump to content

Recommended Posts

Hello,

I'm experiencing a client crash at respawn and I can't really understand why. I've done some troubleshooting and I know for sure the portion of code that causes the crash, but can someone please help me in understanding why?

 

Explanation:

I need to check if an unconscious player do respawn with a medic nearby.

 

Spoiler

Server:

Spoiler


//called at mission start

"respawnCounter" addPublicVariableEventHandler {
  params ["_var", "_params"];
  _params params ["_uid"];

  _protocol = //here I retrive the protocol ID;
  _respawns = "extDB3" callExtension format ["0:%1:doUpdateRespawn:%2", _protocol, _uid];
};

 

Client:

Spoiler


//called at mission start

player addEventHandler ["Respawn", {
  params ["_unit"];

  _pos = getPosATL _unit;
  _isUnconscious = _unit getVariable ["goneUnconscious", 0];

  if (_isUnconscious > 0) then {
    if !(_pos nearEntities ["B_medic_F", 4] isEqualTo []) then {

      respawnCounter = [getPlayerUID _unit];
      publicVariableServer "respawnCounter";
    };
  };

  _unit setVariable ["goneUnconscious", 0];
  [] call BRZ_fnc_handleUnconscious;
}];

BRZ_fnc_handleUnconscious:



//called at mission start, re-called from inside the respawn EH

[{
  params ["_player"];
  _player getVariable "ACE_isUnconscious" isEqualTo true;
},
{
  params ["_player"];
  _player setVariable ["goneUnconscious", 1];
}, [player]] call CBA_fnc_waitUntilAndExecute;

 

 

 

- The above code works as expected if tried locally;

- The extDB3 callExtension works if tried alone on the server;

 

What seems to cause the crash is the BRZ_fnc_handleUnconscious. If I don't call for that code, the crash simply does not happen.

 

The RPT file is not very helpful: simply reports ACCESS VIOLATION, as stated by the crash dialog.

 

Why do a "quick" variable change cause a crash?

 

Thank you.

Share this post


Link to post
Share on other sites

[_player]] call CBA_fnc_waitUntilAndExecute;

At least, there is a typo. Then, what for?

Share this post


Link to post
Share on other sites
1 hour ago, pierremgi said:

[_player]] call CBA_fnc_waitUntilAndExecute;

At least, there is a typo. Then, what for?

Hello pierremgi,

I modified the formatting a bit, so to be less confusing, my fault! There's no typo in there, the second closing bracket closes the argument calling for the function!

What I can't understand is why it causes crashes only is connected to a dedicated, while the server just prompts "player disconnected".

 

Thank you.

Share this post


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

Hello pierremgi,

I modified the formatting a bit, so to be less confusing, my fault! There's no typo in there, the second closing bracket closes the argument calling for the function!

What I can't understand is why it causes crashes only is connected to a dedicated, while the server just prompts "player disconnected".

 

Thank you.

Ah OK, you should try with a simple waitUntil in a scheduled scope. If any wrong code, the impact can be lower. Did you have any report file? (rpt).

Share this post


Link to post
Share on other sites
56 minutes ago, Dedmen said:

any crash caused by a script is a Arma bug

I wouldn’t go as far as to say "any". One can write pretty stupid stuff resulting in crash, there is no way of stopping that

Share this post


Link to post
Share on other sites

Hello and thank you for all your replies!
 

19 hours ago, pierremgi said:

Did you have any report file?

Will post a pastebin this evening (UTC+2)!
 

4 hours ago, Dedmen said:

Well any crash caused by a script is a Arma bug. Did you already report it to the feedback tracker? with the report file?

https://feedback.bistudio.com/w/ft_a3_howto/gamecrash/

Never thought about this, will do some more testing before bothering!

 

3 hours ago, killzone_kid said:

I wouldn’t go as far as to say "any". One can write pretty stupid stuff resulting in crash, there is no way of stopping that

Seems logic to my noob coding experience, but in this particular case I think I've done all correct.. the only thing I run at respawn is the snipped I provided 😓

Thank you again, will update soon.

Share this post


Link to post
Share on other sites
1 hour ago, killzone_kid said:

You are using extension? If extension crashes arma crashes

Yes I do, I'm using extDB3, but as I said before, the query works if I try it alone, even if triggered using the pvEH

Share this post


Link to post
Share on other sites

Deleting and re-downloading the mission seems to solve, I'm trying again tomorrow, thank you.

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

×