Keeping Score
by Norris Bonner · in Technical Issues · 07/05/2006 (1:01 am) · 2 replies
Hello,
I dont actually need the code but I would like to know what would be the best way to go about what I am trying to do here.
I am working on a single player game and have a score system that needs to be updated with more than one source.
-> player score is incremented by a certain value when a bot is killed.
-> player score is incremented by a certain value when a certain object is picked up.
-> player score is incremented by a certain value when a building is destroyed.
-> player score is incremented by a certain value when a boss is defeated.
-> player score is incremented by a certain value if the level is beaten within a certain amount of time.
With all these different variables that updates one score what do you think I should do? I was thinking about just righting a function game.cs to handle all the passing of each variable but what do you guys think? Right now I am only using:
I got this from one of the tutorials and it increases the score when the SoulItem is picked up by the player. I also have another Guitext display for the number of souls picked up and that is where $soulScore is going. It seems that if I keep using this method that I will not be able to add all the other variables that increment the score.
Thanks for any help.
I dont actually need the code but I would like to know what would be the best way to go about what I am trying to do here.
I am working on a single player game and have a score system that needs to be updated with more than one source.
-> player score is incremented by a certain value when a bot is killed.
-> player score is incremented by a certain value when a certain object is picked up.
-> player score is incremented by a certain value when a building is destroyed.
-> player score is incremented by a certain value when a boss is defeated.
-> player score is incremented by a certain value if the level is beaten within a certain amount of time.
With all these different variables that updates one score what do you think I should do? I was thinking about just righting a function game.cs to handle all the passing of each variable but what do you guys think? Right now I am only using:
function SoulItem::onCollision(%this, %obj, %col)
{
if(%col.getClassName() $= "Player")
{
%client = %col.client;
%client.score += 50;
$soulScore++;
commandToClient(%client, 'SetScoreCounter', %client.score);
commandToClient(%client, 'SetSoulCounter', $soulScore);
%obj.delete();
}
}
I got this from one of the tutorials and it increases the score when the SoulItem is picked up by the player. I also have another Guitext display for the number of souls picked up and that is where $soulScore is going. It seems that if I keep using this method that I will not be able to add all the other variables that increment the score.
Thanks for any help.
About the author
#2
07/18/2006 (10:10 am)
Thanks for the post. That sounds A LOT easier than what I imagined it to be!
Associate Anthony Rosenbaum
-> player score is incremented by a certain value when a bot is killed. --- stock torque sends the client of the shooter in the bullet
-> player score is incremented by a certain value when a certain object is picked up. --already handled in example
-> player score is incremented by a certain value when a building is destroyed. --- again just be assured the bullets have the client of the shooter as a property
-> player score is incremented by a certain value when a boss is defeated. --- again bullets with clients
-> player score is incremented by a certain value if the level is beaten within a certain amount of time. --- similar but not to hard, let me elaborate
if there is only one player you can go thru the ClientGroup to get the only client the player than call the function as normal
for(%i = 0; %i < ClientGroup.getcount(); %i++) { %cl = ClientGroup.getobject(%i); // commandToClient(%cl, 'SetScoreCounter', %cl.score); }or of course it is just a single person you could cut to the chase