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-07-2016, 12:12 PM #2
anthonything
Space Ninja
    /*You need some sort of frozen variable for this*/
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) //dosomething
01-08-2016, 06:43 PM #3
seanhellen
Are you high?
Hi - i have added this to the gsc, but couldn't get it to work...

    
Scoring(player)
{
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) self iprintlnbold("Something");
}


This prints "something" when a player spawns as I have put player thread Scoring(player); in onplayerspawned
I had player.Frozen bool already so thats fine but I'm not sure what to do now :(

Another thought I had was can I use the damage trigger to give "proper" points instead of a death trigger. But setting the scorelimit to match a team number would get a bit complex I think...for me anyways :P
01-08-2016, 09:20 PM #4
anthonything
Space Ninja
Originally posted by seanhellen View Post
Hi - i have added this to the gsc, but couldn't get it to work...

    
Scoring(player)
{
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) self iprintlnbold("Something");
}


This prints "something" when a player spawns as I have put player thread Scoring(player); in onplayerspawned
I had player.Frozen bool already so thats fine but I'm not sure what to do now :(

Another thought I had was can I use the damage trigger to give "proper" points instead of a death trigger. But setting the scorelimit to match a team number would get a bit complex I think...for me anyways :P


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.
}
01-09-2016, 12:18 AM #5
Originally posted by anthonything View Post
    /*You need some sort of frozen variable for this*/
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) //dosomething


What is up with the and operators there?
01-09-2016, 05:02 AM #6
anthonything
Space Ninja
Originally posted by Rainbow
What is up with the and operators there?


Just means the same as team = team && player.frozen.
01-09-2016, 04:30 PM #7
Originally posted by anthonything View Post
Just means the same as team = team && player.frozen.


Not exactly, it means "team = team & player.frozen" but in most uses, you won't notice a difference
01-09-2016, 05:05 PM #8
seanhellen
Are you high?
Originally posted by Rainbow
What is up with the and operators there?


I was wondering the same Happy
01-09-2016, 06:36 PM #9
anthonything
Space Ninja
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.
01-09-2016, 06:38 PM #10
anthonything
Space Ninja
Originally posted by seanhellen View Post
I was wondering the same Happy


Its shorthand code. If you ever work in a semi-professional environment you will run into code like that often.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo