Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → LMS Cogs, Scoring problem HELP!
LMS Cogs, Scoring problem HELP!
2001-07-19, 9:24 PM #1
[pre]# Jedi Knight Cog Script
#
# lms2.cog
#
# Last Man Standing
#
# This cog was written by Malace Nathrack Aka Chris Aires. The scoring part of the cog was added by sirblack. This cog belongs to the LMS project and should not be used by other parties without their concent.
#

symbols

thing player0
thing player1
thing player2
thing player3
thing player4
thing player5

sector limbo

thing start0
thing start1
thing start2
thing start3
thing start4
thing start5

int points=5

int numplayers local
int numkilled=0 local
int n local

int victim local
int killer local

int status0=-1 local
int status1=-1 local
int status2=-1 local
int status3=-1 local
int status4=-1 local
int status5=-1 local
int stat local

message startup
message killed
message join
message leave
message entered

end

# ========================================================================================

code

# .................................................................................................

startup:
SetMasterCOG(GetSelfCOG()); // is this really doing anything?
#SetMultiModeFlags(0x4); // let us set our own scores (hopefully)
numplayers = GetNumPlayers();
Sleep(.5);
print("startup");

for(n = 0; n < 5; n = n + 1)
{
if(GetLocalPlayerThing() == player0[n]) status0[n] = 0;
}

n = rand() * 5;
TeleportThing(GetLocalPlayerThing(), start0[n]);

// TeleportThing(GetLocalPlayerThing(), start0);
Return;

# .................................................................................................

killed:
print("killed");
victim = GetSenderRef();
killer = GetThingParent(GetSourceRef()); // GetSourceRef() is the projectile

if(GetThingType(victim) != 10) Return; // if it isn't a player, return

for(n = 0; n <= 5; n = n + 1)
{
if(victim == player0[n]) status0[n] = 1;
}
If(GetThingSector(victim) == limbo)
{
if(killer != victim)
{
print("limbo, player kill");
// SetPlayerScore(killer, GetPlayerScore(killer) - 1);
// SetPlayerKills(killer, GetPlayerKills(killer) - 1);
// SetPlayerKilled(victim, GetPlayerKilled(victim) - 1);
} else {
print("limbo, self kill");
// SetPlayerSuicides(victim, GetPlayerSuicides(victim) - 1);
}
}
else
{
numkilled = numkilled + 1;

if(killer != victim)
{
// SetPlayerScore(killer, GetPlayerScore(killer) - 1);
} else {
// SetPlayerScore(victim, GetPlayerScore(victim - 1));
}

if((numkilled + 1) == numplayers)
{
call winround;
}
}
score=GetThingScore(player[n]);
Printint(score);

Return;

# .................................................................................................

join:
print("join");
// remember this isn't called when the host starts the game
numplayers = GetNumPlayers();

for(n = 0; n <= 5; n = n + 1)
{
if(GetSenderRef() == player0[n]) status0[n] = 0;
}

n = rand() * 5;
TeleportThing(GetSenderRef(), start0[n]);

// for(n = 0; n <= 5; n = n + 1)
// {
// if(GetSenderRef() == player0[n]) TeleportThing(GetSenderRef(), start0[n]);
// }
Return;

# .................................................................................................

leave:
print("leave");
numplayers = GetNumPlayers();
if(GetThingSector(GetSenderRef()) == limbo) numkilled = numkilled - 1;
for(n = 0; n <= 5; n = n + 1)
{
if(GetSenderRef() == player0[n]) status0[n] = -1;
}
if((numkilled + 1) == numplayers)
{
call winround;
}
Return;

# .................................................................................................

winround:
print("winround");
numkilled = 0;
for(n = 0; n <= 5; n = n + 1)
{
if(status0[n] != -1)
{
status0[n] = 0;

if(!(GetThingFlags(player0[n]) & 0x200))
{
SetInv(player0[n], 2, 1);
SetInv(player0[n], 3, 0);
SetInv(player0[n], 4, 0);
SetInv(player0[n], 5, 0);
SetInv(player0[n], 6, 0);
SetInv(player0[n], 7, 0);
SetInv(player0[n], 8, 0);
SetInv(player0[n], 9, 0);
SetInv(player0[n], 11, 50); // energy cells
SetInv(player0[n], 12, 0); // power cells
SetInv(player0[n], 13, 100); // battery
SetInv(player0[n], 15, 0); // rail charges
SetInv(player0[n], 60, 100); // shields
HealThing(player0[n], 100);
AutoSelectWeapon(player0[n], 1);
}

if(GetThingSector(player0[n]) != limbo && !(GetThingFlags(player0[n]) & 0x200))
{
SetPlayerScore(player0[n], GetPlayerScore(player0[n]) + points);
} else {
TeleportThing(player0[n], start0[n]);
}
}
}
Return;

# .................................................................................................

entered:
print("entered");
if(GetSenderRef() != limbo) Return;

victim = GetSourceRef();

for(n = 0; n <= 5; n = n + 1)
{
if(victim == player0[n]) stat = status0[n];
}

if(stat == 0)
{
n = rand() * 5;
TeleportThing(victim, start0[n]);
}

if(numplayers == 1) TeleportThing(victim, start0);

Return;
end

[/pre]

Something is wrong with the scoring and Sirblack quit on me before finishing...


------------------
"Look Beyond what you think, and then you will begin to learn." ~Chris Aires~
2001-07-19, 10:48 PM #2
Can you be a bit more specific? What exactly is wrong with the scoring?

Raynar


------------------
... the Jedi I admire the most, met up with Darth Maul, now he's toast ...
Rbots - a project to develop a working Bot for Jedi Knight... download the latest development version here
Pagewizard_YKS: "making your own lightsaber doesn't make you a nerd... "
Raynar - the man with a 10.75" ePenis

↑ Up to the top!