Thanks GraemeBB. Still doesn’t give me the value back… I remember one of your videos saying about "Setters’ and “Getters” so I created this:
game_manager := class(creative_device):
var DefaultScore : int = 10
var Score : int = 0
GetScore(Agent:agent)<suspends>:void=
Sleep(0.5)
set Score = ScoreManagerAdd.GetCurrentScore(Agent)
Sleep(0.5)
SetScore(Agent:agent, ScoreToSet:int)<suspends>:void=
Sleep(0.5)
ScoreManagerAdd.SetScoreAward(ScoreToSet)
ScoreManagerAdd.Activate(Agent)
Sleep(0.5)
OnBegin<override>()<suspends>:void=
… You’ll recognise the code before this…
NewCustomPlayer:CustomPlayer = CustomPlayer{MyAgentObj:=Agent}
if(set PlayersMap[PlayerObj] = NewCustomPlayer):
spawn{GetScore(Agent)}
if(Score = 0):
Print("Player was loaded as NEW PLAYER")
spawn{SetScore(Agent, DefaultScore)}
spawn{GetScore(Agent)}
NewCustomPlayer.InitPlayer(Score)
It prints and returns the score var back as 0. I just don’t understand how this is not a bug? It shouldn’t be this difficult just to get the current score of the Agent when you pass in SM.GetCurrentScore(Agent) - surely?