Author Topic: Detecting when someone's score changes?  (Read 891 times)

Iban told me that it was GameConnection::incScore but that didn't work for me. Is there any way to detect if someone's score changes?

What are you using it for? There could be another way, depending on what the score will represent.
Also, post the function that you used.

Code: [Select]
package blah
function GameConnection::setScore(%client,%flag)
{
parent::setScore(%client,%flag);

//do stuff
}
};

This is better than incScore because it works when you set the score and when you just increase it.

Code: [Select]
package blah
function GameConnection::setScore(%client,%flag)
{
parent::setScore(%client,%flag);

//do stuff
}
};

This is better than incScore because it works when you set the score and when you just increase it.
Using this, is there any way you can make it do stuff every time the score increments by 2? For example, when you kill someone you get one point. But, for every two points you get something happens.

On a side note: Is there any way to detect if a player has respawned. Also, is there a list of all these things like GameConnection::setScore?
« Last Edit: June 04, 2011, 01:27:02 AM by Daenth »

You could check to see if the score afterwards is a multiple of two.

You could check to see if the score afterwards is a multiple of two.
How could you do that?

How could you do that?

Code: [Select]
if(%flag / 2 $= mFloatLength(%flag / 2, 0)) {
//do stuff
}

Code: [Select]
if(%flag / 2 $= mFloatLength(%flag / 2, 0)) {
//do stuff
}
Code: [Select]
if(%flag % 2 == 0)

Code: [Select]
if(%flag % 2 == 0)

Damn you... adding to my //'d out section of main scripts

Damn you... adding to my //'d out section of main scripts
Haha, you do that to!

Haha, you do that to!

Well yes. Any important, short scripting tricks I hear of, I add to a list at the bottom of my main one for safe keeping. If I should forget it, it's there.

Few more questions if you guys don't mind. =P
On a side note: Is there any way to detect if a player has respawned. Also, is there a list of all these things like GameConnection::setScore?

EDIT: What is %flag used for?
« Last Edit: June 05, 2011, 10:28:51 PM by Daenth »

Few more questions if you guys don't mind. =P
gameConnection::spawnPlayer(%client)

Few more questions if you guys don't mind. =P
EDIT: What is %flag used for?
%flag is what the score is being changed to. Just rename it to %score if it makes it easier for you.

Is there any way to detect if a player has respawned.

Code: [Select]
if(isObject(%client.player)) //check if they have a player object
//if they do, that means they've spawned, do stuff