I am working out bugs in Jawa Tag, so I can finally finish off JK editing and get back to real lilfe. It's rolling right along, but every time I commit suicide, my score goes to -1 no matter what I put in there...
-Tazz
Code:
# Jedi Knight Cog Script # # JT_MAIN.COG # # * This script is losely based on CTF_MAIN.COG and KFY_MAIN.COG. # No code was directly taken from KFY_MAIN.COG, it was merely # used as a reference. Extensive code was taken from CTF_MAIN.COG. # # # Copyright 2001 - Tazz - tazztazz@hotmail.com # Jawa Tag main cog bin is 85 symbols int player=-1 local int jawa=-1 local int timerID=-1 local int r local int num local int oldmodel local thing potential local thing randPlayer local thing leaveplayer local thing joinplayer local model jawa_mdl=jawa.3do local # Scoring Section int became_the_jawa=7 local int suicide=-2 local int kill_jawa=3 local int jawa_score_ok=0 lcoal int hi_score=-1 local int hi_player=-1 local int pulse_score=1 local # Sounds Section sound jawacall=jawa_call.wav local sound scoresnd=ForceThrow01.WAV local sound alarmsnd=00AlarmLoop01.WAV local sound successsnd=Accomplish1.WAV local message startup message timer message join message leave message pulse message killed end # Timer IDs # 5000 = Lock Jawa selection for 30 seconds, then select random jawa # 5001 = Display welcome text/info # 5002 = Person who killed jawa now becomes the jawa # ======================================================================================== code startup: player = GetLocalPlayerThing(); CaptureThing(player); SetMasterCOG(GetSelfCOG()); if(verbose > 2) Print("Jawa Tag: Startup Begun"); // Nobody can become the jawa for 30 seconds If(IsServer()) { SetTimerEx(30, 5000, 0, 0); SetTimerEx(2, 5001, player, 0); } SetPulse(15); Return; # ........................................................................................ join: joinplayer = GetSenderRef(); // Send the Welcome information, but delay it by 2 seconds SetTimerEx(2, 5001, joinplayer, 0); Return; # ........................................................................................ leave: leaveplayer = GetSenderRef(); if(GetInv(leaveplayer, 87) > 0.0) { // Remove the icon // Send a TRIGGER_ICON with its parameters SendTrigger(leaveplayer, 1001, 87, 0, 0, 0); SetInv(leaveplayer, 87, 0.0); //Choose a new jawa in 3 seconds SetTimerEx(5000, 3, 0, 0); } Return; # ........................................................................................ pulse: // Add score and display score occasionally //Make sure we have a current jawa FIRST If(jawa_score_ok < 1) Return; SetPlayerScore(jawa, GetPlayerScore(jawa) + pulse_score); if(GetPlayerScore(jawa) > hi_score) { hi_score = GetPlayerScore(jawa); hi_player = jawa; call check_score_limit; } //Score display count = count + 1; if(count > 2) { count = 0; jkStringClear(); jkStringConcatPlayerName(jawa); jkStringConcatSpace(); jkStringConcatASCIIString(", (the current Jawa) has a score of: "); jkStringConcatInt(GetPlayerScore(jawa)); jkStringOutput(-3, -1); } Return; # ........................................................................................ timer: timerID = GetSenderID(); If(timerID == 5000) //Choose who is going to be the JAWA!! { //Get a random player r = rand(); num = GetNumplayers(); jawa = GetPlayerNum(r * num); //Transform the player //Change model oldmodel = GetThingModel(jawa); SetThingModel(jawa, jawa_mdl); // Set the player's model to fully lit SetThingLightMode(player, 0); //Broadcast text notification -someone became the jawa jkStringClear(); jkStringConcatPlayerName(jawa); jkStringConcatSpace(); jkStringConcatASCIIString("is the Jawa!"); jkStringOutput(-3, -1); //Play the "Jawa Call" globally PlaySoundGlobal(jawacall, 1, 0, 4); // Increment player score SetPlayerScore(jawa, GetPlayerScore(jawa) + became_the_jawa); if(GetPlayerScore(jawa) > hi_score) { hi_score = GetPlayerScore(jawa); hi_player = jawa; call check_score_limit; } //Unlock pulse (to increment score) jawa_score_ok = 1; Return; } Else If(timerID = 5001) { jkStringClear(); jkStringConcatASCIIString("Welcome to Jawa Tag, "); jkStringConcatSpace(); jkStringConcatPlayerName(player); jkStringConcatASCIIString("!"); jkStringClear(); jkStringOutput(player, -1); } Else If(timerID = 5002) { //Transform the player //Change model oldmodel = GetThingModel(jawa); SetThingModel(jawa, jawa_mdl); // Set the player's model to fully lit SetThingLightMode(player, 0); //Broadcast text notification -someone became the jawa jkStringClear(); jkStringConcatPlayerName(player); jkStringConcatSpace(); jkStringConcatASCIIString("is the Jawa!"); jkStringOutput(-3, -1); //Play the "Jawa Call" globally PlaySoundGlobal(jawacall, 1, 0, 4); // Increment player score SetPlayerScore(jawa, GetPlayerScore(jawa) + became_the_jawa); if(GetPlayerScore(jawa) > hi_score) { hi_score = GetPlayerScore(jawa); hi_player = jawa; call check_score_limit; } //Unlock pulse (to increment score) jawa_score_ok = 1; Return; } Return; # ........................................................................................ killed: if(verbose > 2) Print("Jawa Tag: Killed Begun"); killer = GetThingParent(GetSourceRef()); // Exit if killed: was sent by anything else than a player if(GetSenderType() != 10) Return; SetInv(player, 87, 0.0); // Set the player's model to Gouraud lit SetThingLightMode(player, 3); If(killer != jawa) //Killed by another player { // Increment player score SetPlayerScore(killer, GetPlayerScore(killer) + kill_jawa); //Set killer as new jawa jawa_score_ok = 0; jawa = killer; SetTimerEx(.1, 5002, 0, 0); } Else //Suicide { Print("Suicide"); //lower player score SetPlayerScore(jawa, GetPlayerScore(jawa) -1); SetThingModel(jawa, oldmodel); jawa_score_ok = 0; jawa = -1; SetTimerEx(8, 5000, 0, 0); } Return; end
-Tazz
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance
Tazz
Tazz