Post: scoring
01-06-2016, 10:18 PM #1
seanhellen
Are you high?
(adsbygoogle = window.adsbygoogle || []).push({}); Hi all - in a gamemode Im making, I need to keep a score, but people dont die so I can't use the standard scoring system. A few points;

- TDM mode
- Score is the amount of frozen people on the team - need to be able to add/subtract a point as there is the possibility of un-freezing a teammate.
- When a full team has been frozen, the game ends. so when the score is equal to the team size, the frozen team loses

Tried starting with FriendlyScore = 0; and EnemyScore = 0; and adding/subtracting from that but became very stuck very quickly.

if this gets sorted, I then need to change the proper points system to 1 point to win (easy) and whoever wins, gets the point and the game therefore ends :confused:

Any ideas on how I can go about this?
Thanks
(adsbygoogle = window.adsbygoogle || []).push({});
01-09-2016, 06:54 PM #11
Originally posted by anthonything View Post
Well, i understand that and because a bool is just an unsigned short with either 1 or 0, the bitwise & operator works the same way as the logical for assignment. Most languages accept the complex assignment bitwise operations to bools because of this reason.


They do not work the same way, although it's rather similar.
Take this example:
    
bool retTrue() {
cout << "called retTrue()\n";
return true;
}
int main() {
cout << "Case 1:\n";
bool a = false;
a &= retTrue();

cout << "Case 2:\n";
bool b = false;
b = b && retTrue();
}


The output is:
    
Case 1:
called retTrue()
Case 2:


The second call of retTrue is never reached
01-09-2016, 07:04 PM #12
seanhellen
Are you high?
Originally posted by anthonything View Post
So, that code was intended to be looped. Heres an example:
    
//In init(), add this line: level thread Scoring();


Scoring()
{
for(;Winky Winky
{
team1 = true;
team2 = true;

foreach(player in level.players)
{
if(player.pers["team"] == "axis") team1 &= player.Frozen;
if(player.pers["team"] == "allies") team2 &= player.Frozen;
}

if(team1 || team2){ level iprintlnbold("Someone Won. "); break;}
wait .1;
}
//Some end game function would go here. Your choice.
}


Hi - ye that didn't work either :(
01-09-2016, 07:59 PM #13
anthonything
Space Ninja
Originally posted by Not
They do not work the same way, although it's rather similar.
Take this example:
    
bool retTrue() {
cout << "called retTrue()\n";
return true;
}
int main() {
cout << "Case 1:\n";
bool a = false;
a &= retTrue();

cout << "Case 2:\n";
bool b = false;
b = b && retTrue();
}


The output is:
    
Case 1:
called retTrue()
Case 2:


The second call of retTrue is never reached


Yep. Short circuit evaluation. Ive taught Computer Science for most of this year unofficially and know several languages extensively haha. I've become as most programmers do though, lazy af. I shorthand a lot and don't really explain what i mean too well, but when i was explaining it previously i was implying this ^^, because i knew you understood as well, but i forgot that when other people read this stuff they should be able to understand too.

The following user thanked anthonything for this useful post:

John
01-09-2016, 08:01 PM #14
anthonything
Space Ninja
Originally posted by seanhellen View Post
Hi - ye that didn't work either :(


PM source and ill implement it for you.
01-09-2016, 10:23 PM #15
Originally posted by anthonything View Post
Well, i understand that and because a bool is just an unsigned short with either 1 or 0, the bitwise & operator works the same way as the logical for assignment. Most languages accept the complex assignment bitwise operations to bools because of this reason.


Couldn't be more wrong. A Boolean is an unsigned char, aka a byte. It has a limited bitfield of 1, so it can only be 0 or 1. The Bitwise AND op is for clearing bits, when used with a complimented flag; other wise, it will return 0 if the flag value does not exist, it should not be used with something that does not consist of using the Bitwise system.
01-09-2016, 10:38 PM #16
anthonything
Space Ninja
Originally posted by Bitwise View Post
Couldn't be more wrong. A Boolean is an unsigned char, aka a byte. It has a limited bitfield of 1, so it can only be 0 or 1. The Bitwise AND op is for clearing bits, when used with a complimented flag; other wise, it will return 0 if the flag value does not exist, it should not be used with something that does not consist of using the Bitwise system.


Well in this case, the type doesnt matter, and when i said the unsigned short it was because i always use that for typedef when im doing C, my mistake, and ffs are you kidding me on the bitwise system explanation? It can be used for whatever the hell you want as long as you understand how it works. And, yeah, i know how bitwise works ffs. Im bad at explaining things because i dont really think through shit like most people do, i just assume people get what im trying to say. And that response was intended to just be an explanation on why i used it to begin with so whatever. I dont understand why people have to argue literally everything.
01-15-2016, 08:43 PM #17
seanhellen
Are you high?
well, my original problem still stands. Is there a way of adding points when damaged rather than killed?

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo