Page MenuHomeFeedback Tracker

HandleScore always showing 1 when triggered with addScore
New, WishlistPublic

Description

If you set handlescore event handler on the server and run addScore on the server, no matter what is the amount you wish to add, EH always says 1 even though the right amount is added.

Additionally, if handlescore EH is added on client, addscore executed on client will trigger it but again with value of 1

Details

Legacy ID
2265661521
Severity
None
Resolution
Open
Reproducibility
Always
Category
Scripting
Steps To Reproduce

//server
playerserver addeventhandler ["handlescore", {diag_log _this}];
playerserver addscore 20;

EH handler will show something like

[B Alpha 1-1:1 (KK) REMOTE,<NULL-object>,1]

but the MP score will be 20.

can achieve the same on client, only the score will not add to total

player addeventhandler ["handlescore", {systemchat str _this}];
player addscore 20;

[B Alpha 1-1:1 (KK),<NULL-object>,1]

kinda redundant functionality.

Event Timeline

Killzone_Kid edited Additional Information. (Show Details)
Killzone_Kid set Category to Scripting.
Killzone_Kid set Reproducibility to Always.
Killzone_Kid set Severity to None.
Killzone_Kid set Resolution to Open.
Killzone_Kid set Legacy ID to 2265661521.May 7 2016, 7:36 PM

I believe that addScore should never trigger HandleScore, or otherwise minimally have a boolean passed to the event code that says if it was triggered manually.

The most likely use for HandleScore is to cancel out all score changes done by the engine, so as to manage scores manually via addScore.

there was recent note on changelog, stating that HandleScore can now be triggered by script. This was added deliberately, addScore didnt trigger handlescore before.

I guess I'm going to stick to my trusty "_player addScore (_newTotal - score _player)"...