I would like to question how each player have an independent score in game.
Please see the following game.
I set one score manager device on the level and prepare the following code on verse:
This code means:
1, More than two Trigger Device and one Score Manager Deviced is prepared
2, Create “Await” task of Trigger Device
3, I would like to make a game that when a player shoots the right Trigger Device, plus 1 to this player. While, when he shoots the wrong Trigger Device, minus one to the player.
In other words, On this game, if more than two player join, each player should have each score.
However, with the above code, as the attached movie shows, it seems that the score of score manager device is updated by all player’s shoot and give its score to players as “AwardScore” and “PenaltyScore” method is executed. (In this video, player “KG12121” is me. My score is initially “0”. My shoot in this video hits wrong Trigger Device, so My score is updated to “-1”. However, this video shows that my score is to “-4”. Perhaps until my shoot, the score magaer device is updated by other players and the score is given to me)
I would like to have each player’s score updated independently by this player’s shoot result.
How do I revise this code and setting of the Level?
I believe score managers are supposed to give individual score, are you sure the score in the scoreboard (opened using the show map key) is also bugged ?
I noticed that the HUD Info Boxscoreboard can be random sometimes.
I tried with my two player to confirm whether it is bug.
The answer seems to be YES. I shoot with one player updating the score then shoot with another. The result that the score is also updated for both of two player. And result screen show these score, so it is a bug, I think.
The Official Document show that “Activate” method grants score to agent but this “score” is not independent with my way. Do you have other way to realize what I want to do?
Ok you might be right but I think I found something else in your code
PenaltyScore<public>(QAgent:?agent) : void =
set PlayerScore = PlayerScore - 1
if(Agent := QAgent?):
ScoreManagerDevice.SetScoreAward(PlayerScore) # indenting is bad
ScoreManagerDevice.Activate(Agent) # indenting is bad
It would be really strange that it comes from this but can you try to fix this ?
Maybe it’s your trigger_device that’s triggering for everybody, you could add Prints to know where it might come frome
I use the same score variable “PlayerScore” every time AwardScore/PenaltyScore method are executed, this is the reason. I will revise my code, but there is another problem:
In my game, more than two player play. And AwardScore/PenaltyScore method work when Trigger Device is shoot (Score is grant to QAgent)
So, I will prepare more than two “PlayerScore” variable.
prop_teleport := class(creative_device):
@editable
TriggerCard : []trigger_device = array{}
var PlayerScore : int = 0
var PlayerScore2 : int = 0
var PlayerScore3 : int = 0
var PlayerScore4 : int = 0
var PlayerScore5 : int = 0
@editable
ScoreManagerDevice<public> : score_manager_device = score_manager_device{}
However, the content of QAgent depends on player’s action (shoot). How should I linke “PlayerScore” variable with each player?
The point is that a player to whom score is granted is QAgent (Player shooting the correct or wrong Trigger Device)
With PlayerScore : [player]int = map{}, How should I set QAgent and grant score to each player (who shoots) in AwardScore/PenaltyScore method?
If you have a good way, please tell me some advise.
This is some basic coding, I think you have to learn about those, they might talk about it in the doc, or you can just look up for associative arrays on internet