ScoreItems and point persistence in LMS
Posted: Sat Apr 30, 2016 11:16 am
Hi, I am trying to redone the LMS point system for needs of my own mod. But for some reason, ScoreItems do not work as they should. Also, I need to somehow make data persistent between rounds.
In my enter script, I give each player a unique TID:
Each time player scores the code goes as it follows:
Array of points has the proper values, but for some reason, ScoreItems do not (not even when I give them via GiveInventory, the activator of the script is also the player who should receive the points). When I check them with the CheckActorInventory, I always get 0.
This problem can be solved with the points array, but I also need to tackle something else. Each time a LMS round is over and the pointlimit is not hit, the COUNTDOWN phase kick in and after that the whole map and every script is unloaded and then OPEN and ENTER scripts are run. Since the point of the revamped point system is to work between rounds, I need to somehow save the player's score so it won't be zeroed.
As I intend to evaluate pointlimit hit in the COUNTDOWN phase (loop through player scores, check wheter the reached the cvar pointlimit and then Exit_Normal(0), in the OPEN script it should work even with the sv_noexit), I can safely zero the points right before I end the map manually.
I guess your general response would be "use cvar", but does cvar support arrays? I have no interest in copypasting switch statement for eight players not to mention this would be pretty stupid if the max number of the players should rise.
Thanks for help
In my enter script, I give each player a unique TID:
Code: Select all
int player = PlayerNumber();
Thing_ChangeTID(0, PLAYERTID + player);
Code: Select all
points[player] += score; // player = PlayerNumber()
GiveActorInventory(PLAYERTID + player, "ScoreItem", score);
This problem can be solved with the points array, but I also need to tackle something else. Each time a LMS round is over and the pointlimit is not hit, the COUNTDOWN phase kick in and after that the whole map and every script is unloaded and then OPEN and ENTER scripts are run. Since the point of the revamped point system is to work between rounds, I need to somehow save the player's score so it won't be zeroed.
As I intend to evaluate pointlimit hit in the COUNTDOWN phase (loop through player scores, check wheter the reached the cvar pointlimit and then Exit_Normal(0), in the OPEN script it should work even with the sv_noexit), I can safely zero the points right before I end the map manually.
I guess your general response would be "use cvar", but does cvar support arrays? I have no interest in copypasting switch statement for eight players not to mention this would be pretty stupid if the max number of the players should rise.
Thanks for help