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 → Cog problem
Cog problem
2000-12-10, 10:58 AM #1
Well, if you aren't familiar with the TPMTC, 00Mikey gave us permission to use Jedi Ball in the TPMTC.

The problem is Jedi Ball was JK, TPMTC is MotS.

The MotS engine doesn't like the host changing skins...

The patch for the TPMTC fixed this, but we can't seem to get it fixed for Jedi Ball. Here's the cog that's causing the problem, Freddub tried to fix it once.

Originally the host wouldn't change at all, but everyone else would. Now the host can change, but everyone randomly changes skins for no apparent reason in the level.

Any help would be appreciated!
Code:
# Jedi Knight Cog Script
#
# Jball_main.COG (c) 1998 Mike Robert [00Mikey]
#
# Rules :
# -----
#	To move the J-Ball (however it is possible) into your opponents' goal. 
# The catch: kicking the ball ain't gonna work, plus you don't score points, you make the other
# team lose them!  This, in my opinion, promotes more teamwork, as you must concentrate on defense
# as well as offence!  The new force powers also add another level of play to the game as each one
# ties in with Jedi-Ball effectively.
#
# Started: July 20, 1998.
# Finished: 	Version 1: October 98
#		Version 2:	
#
# Version History
#
# 0.1  Examined ctf_main.cog and others [Infiltrate!!! YEAH!!] for the best possible way to create JediBall
# 0.3  Scoring system and basic team controls implemented, this is starting to take shape!
# 0.4  Force powers implemented. (some)
# 0.6  Score Limit refined
# 0.65 Multiple Goals added
# 0.7  Various Bugs fixed
#
# This COG is not reserved by Lucasarts, nor does Lucasarts support JediBall or it's modifications. :-(
#


symbols

thing	    jball			     desc=JBall
thing	    startball1			     desc=startball1
thing	    startball2			     desc=startball2

sector 	    red_goal			     desc=RGoalSect
sector 	    red_goal1			     desc=RGoalSect1
sector 	    red_goal2   		     desc=RGoalSect2
sector 	    red_goal3			     desc=RGoalSect3

sector 	    gold_goal			     desc=GGoalSect
sector 	    gold_goal1			     desc=GGoalSect1
sector 	    gold_goal2			     desc=GGoalSect2
sector 	    gold_goal3			     desc=GGoalSect3

sector      start_room                       desc=start_room
sector      mark_red                         desc=mark_red_team
sector      mark_gold                        desc=mark_gold_team


cog         score_display_cog                desc=score_cog

thing       red_start                        nolink,desc=red_start
thing       red_start1                       nolink,desc=red_start1
thing       red_start2                       nolink,desc=red_start2
thing       red_start3                       nolink,desc=red_start3
thing       red_start4                       nolink,desc=red_start4
thing       red_start5                       nolink,desc=red_start5
thing       red_start6                       nolink,desc=red_start6
thing       red_start7                       nolink,desc=red_start7
thing       gold_start                       nolink,desc=gold_start
thing       gold_start1                      nolink,desc=gold_start1
thing       gold_start2                      nolink,desc=gold_start2
thing       gold_start3                      nolink,desc=gold_start3
thing       gold_start4                      nolink,desc=gold_start4
thing       gold_start5                      nolink,desc=gold_start5
thing       gold_start6                      nolink,desc=gold_start6
thing       gold_start7                      nolink,desc=gold_start7

int	    goal_score=-10		     local
int         captured_red=0                   local
int         captured_gold=0                  local
int         verbose=3                        local
int         time_limit=0                     local
int         score_limit=0                    local
int         level_started=0                  local
int         level_ended=0                    local

int         player                           local
int         leaveplayer=0                    local
int         killer                           local
int         senderRef=0                      local
int         sourceRef=0                      local

flex	    teleball    		     local

int         lock_touch=0                     local
int         play_sounds=1                    local
int         anim                             local
int         dummy                            local
int         teleport_red=0                   local
int         teleport_gold=0                  local

int         ctf_score_red=100                local
int         ctf_score_gold=100               local

int         ctf_suicide=-2                   local
int         ctf_callback=-1                  local
int         ctf_keys=0                       local

template    teleport_particles=+telesparks   local

sound       teleportsnd=ForceThrow01.WAV     local

sound       leadsnd=I00an06z.wav             local
sound       leadsnd2=I00an07z.wav            local
sound       winsnd=I00an03z.wav              local
sound       winsnd2=I00an05z.wav             local

sound       alarmsnd=00AlarmLoop01.WAV       local
sound       successsnd=Accomplish1.WAV       

model       neutral_mdl=theedb.3do               local
model       red_mdl=theedr.3do                 local
model       gold_mdl=kyU0.3do                local

material    rtip_mat=saberred0.mat           local
material    rside_mat=saberred1.mat          local
material    gtip_mat=saberyellow0.mat        local
material    gside_mat=saberyellow1.mat       local

template    tpl_wall=+ssparks_wall           local
template    tpl_blood=+ssparks_blood         local
template    tpl_saber=+ssparks_saber         local

int         numplayers                       local
int         tmp_score_changed                local

int         ban_red=-1                       local
int         ban_gold=-1                      local

int         msgbase=1000                     local

int         modelfix                         local

message     startup
message     activated
message     touched
message     entered
message     shutdown
message     timer
message     killed
message     leave
message     join
message     pulse
message     user0
message     user1
message     user2

# Triggers
#
# 1001 - ICONS
# 1002 - SCORE
# 1003 - KEYS
#
# 10001 - BREAKINGGLASS (C2)
# 10001 - LEVELSIZE (C3)

end

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

code

startup:
   // Debug level
   verbose = 2;

   if(verbose > 2) Print("CTF Startup Evt");

   player = GetLocalPlayerThing();

   // SERVER ONLY startup:
   if(IsServer() | | !IsMulti())
   {
      // Team mode                   (1)
      // No damage to teammates      (2)
      // CTF computes its own score  (4)
      // No custom costumes         (20)
      SetMultiModeFlags(0x27);

      // Auto assign teams          (100)
      // This also disallow the command to change teams
      ClearMultiModeFlags(0x100);

      // Initialize Time limit
      if(GetMultiModeFlags() & 0x8)
      {
         time_limit = GetTimeLimit();
         ClearMultiModeFlags(0x8);
      }

      // Initialize Score limit
      if(GetMultiModeFlags() & 0x10)
      {
         score_limit = GetScoreLimit();
         if(score_limit > 999) score_limit = 0;
	 ctf_score_gold = score_limit;
	 ctf_score_red  = score_limit;
         ClearMultiModeFlags(0x10);
      }

      // Sets the score panels (out of startup :)
      SetTimerEx(0.5, 9980, 0, 0);

      captured_gold = 0;
      captured_red = 0;

      // dummy = SendMessageEx(score_display_cog, User0, ctf_score_red, ctf_score_gold, 0.0, 0.0);
      // Send a TRIGGER_SCORE with its parameters
      SendTrigger(-1, 1002, ctf_score_red, ctf_score_gold, 0, 0);

      // Send the Welcome information to the server player
      SetTimerEx(2, 9996, player, 0);

      // ensure that the score is displayed once in a while even if noone scores...
      KillTimerEx(9997);
      SetTimerEx(90, 9997, 0, 0);

      // Because team mode might have assigned the server player to team 1
      SetPlayerTeam(player, 0);

      // Start flags positions synching
      SetPulse(0.05);
   }

   // Set the Master COG
   SetMasterCOG(GetSelfCOG());

   // CTF Score
   SetPlayerTeam(player, 0);
   SetPlayerScore(player, 0);

   Return;

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

pulse:
	if (modelfix == 2) SetThingModel(player, gold_mdl);
	if (modelfix == 1) SetThingModel(player, red_mdl);
   SyncThingPos(jball);

	if(GetThingSector(jball)==red_goal | | GetThingSector(jball)==red_goal1 | | GetThingSector(jball)==red_goal2 | | GetThingSector(jball)==red_goal3) 
	{
	     //Print RED team Defense thwarted!
	    JKStringClear();
	    jkStringConcatUNIString(msgbase + 12);
            jkStringOutput(-3, -1);

	    ctf_score_red = ctf_score_red + goal_score;    
	    if(ctf_score_red<1) 
	    {
	    	level_ended = 1;
	    	call show_score;
		call end_level;
	    }
	    SetTeamScore(1,ctf_score_red);
	    call score_goal_event;
	    sleep(1);
	    call show_score;
	}

	//What happens when the RED Team scores.
	if(GetThingSector(jball)==gold_goal | | GetThingSector(jball)==gold_goal1 | | GetThingSector(jball)==gold_goal2 | | GetThingSector(jball)==gold_goal3) 
	{
	     //Print GOLD team Defense thwarted!
	    JKStringClear();
	    jkStringConcatUNIString(msgbase + 22);
            jkStringOutput(-3, -1);	
    
	    ctf_score_gold = ctf_score_gold + goal_score;    
	    if(ctf_score_gold<1) 
	    {
	    	level_ended = 1;
	    	call show_score;
		call end_level;
	    }
	    SetTeamScore(2,ctf_score_gold);
	    call score_goal_event;
	    sleep(1);
	    call show_score;
	}
   Return;

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

join:
   if(verbose > 2) Print("CTF Join Evt");

   player = GetSenderRef();

   SetPlayerTeam(player, 0);
   SetPlayerScore(player, 0);

   // Send the Welcome information, but delay it by 2 seconds
   SetTimerEx(2, 9996, player, 0);

   // Send a TRIGGER_SCORE with its parameters
   SendTrigger(player, 1002, ctf_score_red, ctf_score_gold, 0, 0);

   Return;

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

leave:
   if(verbose > 2) Print("CTF Leave Evt");

   leaveplayer = GetSenderRef();

   // Give the player a neutral costume
   SetThingModel(leaveplayer, neutral_mdl);

   Return;

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

entered:
   if(verbose > 2) Print("CTF Entered Evt");

   // Exit if entered: was sent by anything else than a sector
   if(GetSenderType() != 5) Return;

   player = GetSourceRef();
   senderRef = GetSenderRef();

   // CTF must have permanent access to the players' events !!!
   CaptureThing(player);

   // These are the Team selection sectors
   // The player is marked with the correct color, then teleported into the game
   // on the next start point of his color (i.e. cycling through the start points).

   if(senderRef == mark_red)
   {
      if(verbose > 2) Print("Player marked Red");

      SetPlayerTeam(player, 1);
      SetPlayerScore(player, 0);
      SetPlayerKills(player, 0);
      SetPlayerKilled(player, 0);
      SetPlayerSuicides(player, 0);

      // Give the player a red costume
	modelfix = 1;

      // Give the player a red lightsaber
      // First make sure he's got a saber
      SetInv(player, 10, 1);

      // We change the blade color
      jkSetSaberInfo(player, rside_mat, rtip_mat, 0.003, 0.001, 0.100, tpl_wall, tpl_blood, tpl_saber);

      AddDynamicTint(player, 1.0, 1.0, 1.0);
      teleport_red = (teleport_red + 1) % 8;
      StopThing(player);
      TeleportThing(player, red_start[teleport_red]);
      dummy = CreateThingAtPos(teleport_particles, GetThingSector(player), GetThingPos(player), '0 0 0');
      if(play_sounds) dummy = PlaySoundThing(teleportsnd, player, 1.0, -1, -1, 0x80);

      // Callback #03 : New Red Player was marked
      if(ctf_callback != -1)
         dummy = SendMessageEx(ctf_callback, user0, 3, player, ctf_score_red, ctf_score_gold);

      if((level_started == 0) && (time_limit > 0)) SetTimerEx(time_limit * 60, 9998, 0, 0);

      // Lock the score limit so that it cannot be changed anymore...
      level_started = 1;

      Return;
   }
   else
   if(senderRef == mark_gold)
   {
      if(verbose > 2) Print("Player marked Gold");

      SetPlayerTeam(player, 2);
      SetPlayerScore(player, 0);
      SetPlayerKills(player, 0);
      SetPlayerKilled(player, 0);
      SetPlayerSuicides(player, 0);

      // Give the player a gold costume
	modelfix = 2;

      // Give the player a yellow lightsaber
      // First make sure he's got a saber
      SetInv(player, 10, 1);

      // We change the blade color
      jkSetSaberInfo(player, gside_mat, gtip_mat, 0.003, 0.001, 0.100, tpl_wall, tpl_blood, tpl_saber);

      AddDynamicTint(player, 1.0, 1.0, 1.0);
      teleport_gold = (teleport_gold + 1) % 8;
      StopThing(player);
      TeleportThing(player, gold_start[teleport_gold]);
      dummy = CreateThingAtPos(teleport_particles, GetThingSector(player), GetThingPos(player), '0 0 0');
      if(play_sounds) dummy = PlaySoundThing(teleportsnd, player, 1.0, -1, -1, 0x80);

      // Callback #04 : New Gold Player was marked
      if(ctf_callback != -1)
         dummy = SendMessageEx(ctf_callback, user0, 4, player, ctf_score_red, ctf_score_gold);

      if((level_started == 0) && (time_limit > 0)) SetTimerEx(time_limit * 60, 9998, 0, 0);

      // Lock the score limit so that it cannot be changed anymore...
      level_started = 1;

      Return;
   }

   Return;

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

timer:
   // changes in startup would not be synched
   if(GetSenderId() == 9980)
   {
      // initialize both teams scores
      SetTeamScore(1, ctf_score_red);
      SetTeamScore(2, ctf_score_gold);
   }
   else
   // unlock touched: messages
   if(GetSenderId() == 9990)
   {
      lock_touch = 0;
   }
   else
   // play success sound
   if(GetSenderId() == 9994)
   {
      PlaySoundGlobal(successsnd, 1, 0, 4);
   }
   else
   // play alarm sound
   if(GetSenderId() == 9995)
   {
      PlaySoundGlobal(alarmsnd, 1, 0, 4);
   }
   else
   // Time to display the welcome info for a new player
   if(GetSenderId() == 9996)
   {
      if(verbose > 1)
      {
         player = GetParam(0);

         // Print("Welcome to Jedi Knight CTF!");
         jkPrintUNIString(player, msgbase + 1);

         jkStringClear();
         jkStringConcatFormattedInt(ctf_score_red, "RED: %d  (");
         jkStringConcatFormattedInt(GetNumPlayersInTeam(1), "%d pl.) -- ");
         jkStringConcatFormattedInt(ctf_score_gold, "GOLD: %d  (");
         jkStringConcatFormattedInt(GetNumPlayersInTeam(2), "%d pl.)");
         jkStringOutput(player, -1);

         jkStringClear();
         if(time_limit != 0)
            jkStringConcatFormattedInt(time_limit, "Time Limit = %d  ");
         if(score_limit != 0)
            jkStringConcatFormattedInt(score_limit, "Score Limit = %d");
         jkStringOutput(player, -1);
      }
   }
   else
   // Time to display the score
   if(GetSenderId() == 9997)
   {
      // Level Time in seconds
      // PrintFlex(GetLevelTime());
      call show_score;

      // Schedule the next display in 90 seconds
      // but any score change in the mean time will kill this timer anyway
      if(level_ended == 0) SetTimerEx(90, 9997, 0, 0);
   }
   else
   // The event comes from the level's timelimit being reached
   // Just check that a limit has not been reached before...
   if(GetSenderId() == 9998)
   {
      if(level_ended != 0) Return;

      // end the level if the score is not a tie
      if(ctf_score_red != ctf_score_gold)
      {
         if(verbose > 2) Print("CTF Time limit reached");
         level_ended = 2;

         // Callback #02 : Time Limit reached
         if(ctf_callback != -1)
            dummy = SendMessageEx(ctf_callback, user0, 2, -1, ctf_score_red, ctf_score_gold);

         call end_level;
      }
      else
      {
         // if the score is a tie switch to a already reached score_limit
         // so behavior would be the same : first to capture now WINS.
         if(verbose > 2) Print("CTF Time limit reached, but game is a tie");
         score_limit = ctf_score_red;
      }
   }
   else
   // End the level
   if(GetSenderId() == 9999)
   {
      SyncScores();
      jkEndLevel(1);
   }

   Return;

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

killed:
   if(verbose > 2) Print("CTF Killed Evt");

   senderRef = GetSenderRef();
   sourceRef = GetSourceRef();

   // Exit if killed: was sent by anything else than a thing
   if(GetSenderType() != 3) Return;

   // Exit if killed: was sent by one of the flags
   // (powerups send killed: event when taken too...)

   if(senderRef == jball) Return;

   player = senderRef;

   tmp_score_changed = 0;

   // add to the killer score, but only if it is not a suicide
   killer = GetThingParent(sourceRef);
   if(killer != player)
   {
      // and the players are not in the same team
      if(GetPlayerTeam(killer) != GetPlayerTeam(player))
      {
         if(GetPlayerTeam(killer) == 1)
         {
            ctf_score_red = ctf_score_red + 1;
            SetTeamScore(1, ctf_score_red);
            SetPlayerScore(killer, GetPlayerScore(killer) + 1);
            tmp_score_changed = 1;
         }
         else
         if(GetPlayerTeam(killer) == 2)
         {
            ctf_score_gold = ctf_score_gold + 1;
            SetTeamScore(2, ctf_score_gold);
            SetPlayerScore(killer, GetPlayerScore(killer) + 1);
            tmp_score_changed = 1;
         }
      }
   }
   // else it is a player suicide
   else
   {
      if(GetPlayerTeam(player) == 1)
      {
         ctf_score_red = ctf_score_red + ctf_suicide;
         if(ctf_score_red < 0) ctf_score_red = 0;
         SetTeamScore(1, ctf_score_red);
         SetPlayerScore(player, GetPlayerScore(player) + ctf_suicide);
         tmp_score_changed = 1;
      }
      else
      if(GetPlayerTeam(player) == 2)
      {
         ctf_score_gold = ctf_score_gold + ctf_suicide;
         if(ctf_score_gold < 0) ctf_score_gold = 0;
         SetTeamScore(2, ctf_score_gold);
         SetPlayerScore(player, GetPlayerScore(player) + ctf_suicide);
         tmp_score_changed = 1;
      }
   }

   if(tmp_score_changed)
   {
      // dummy = SendMessageEx(score_display_cog, User0, ctf_score_red, ctf_score_gold, 0.0, 0.0);
      // Send a TRIGGER_SCORE with its parameters
      SendTrigger(-1, 1002, ctf_score_red, ctf_score_gold, 0, 0);

      // Announce the score in 3 seconds
      KillTimerEx(9997);
      SetTimerEx(3, 9997, 0, 0);
   }

   Return;

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

shutdown:
   if(verbose > 2) Print("CTF Shutdown Evt");

   Return;

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

score_goal_event:
	
	SendTrigger(-1, 1002, ctf_score_red, ctf_score_gold, 0, 0);
  	SetTimerEx(1, 9994, 0, 0);

	//Teleport the ball to a designated thing's position. (startball 1 or 2)

	teleball = Rand();
	if(teleball > 0.5)
	{
		StopThing(jball);
		TeleportThing(jball,startball1);
	}
	else
	{
		StopThing(jball);
		TeleportThing(jball,startball2);
	}


return;
# ........................................................................................

show_score:

   if(level_ended == 0)
   {
      if(ctf_score_red > ctf_score_gold)
      {
         PlaySoundGlobal(leadsnd, 1, 0, 4);

         // Print("RED Team Leads by");
         jkStringClear();
         jkStringConcatUNIString(msgbase + 30);
         jkStringConcatSpace();
         jkStringConcatInt(ctf_score_red);
         jkStringConcatSpace();
         jkStringConcatUNIString(msgbase + 38);
         jkStringConcatSpace();
         jkStringConcatInt(ctf_score_gold);
         jkStringOutput(-3, -1);
      }

      if(ctf_score_red < ctf_score_gold)
      {
         PlaySoundGlobal(leadsnd2, 1, 0, 4);

         // Print("GOLD Team Leads by");
         jkStringClear();
         jkStringConcatUNIString(msgbase + 31);
         jkStringConcatSpace();
         jkStringConcatInt(ctf_score_gold);
         jkStringConcatSpace();
         jkStringConcatUNIString(msgbase + 38);
         jkStringConcatSpace();
         jkStringConcatInt(ctf_score_red);
         jkStringOutput(-3, -1);
      }

      if(ctf_score_red == ctf_score_gold)
      {
         // Print("Both teams have");
         jkStringClear();
         jkStringConcatUNIString(msgbase + 32);
         jkStringConcatSpace();
         jkStringConcatInt(ctf_score_red);
         jkStringConcatSpace();

         if(ctf_score_red == 1)
         {
            // Print("point.");
            jkStringConcatUNIString(msgbase + 36);
         }
         else
         {
            // Print("points.");
            jkStringConcatUNIString(msgbase + 37);
         }

         jkStringOutput(-3, -1);

      }
   }
   else
   {
      if(ctf_score_red > ctf_score_gold)
      {
         PlaySoundGlobal(winsnd, 1, 0, 4);

         // Print("RED Team Wins by");
         jkStringClear();
         jkStringConcatUNIString(msgbase + 33);
         jkStringConcatSpace();
         jkStringConcatInt(ctf_score_red);
         jkStringConcatSpace();
         jkStringConcatUNIString(msgbase + 38);
         jkStringConcatSpace();
         jkStringConcatInt(ctf_score_gold);
         jkStringOutput(-3, -1);
      }

      if(ctf_score_red < ctf_score_gold)
      {
         PlaySoundGlobal(winsnd2, 1, 0, 4);

         // Print("GOLD Team Wins by");
         jkStringClear();
         jkStringConcatUNIString(msgbase + 31);
         jkStringConcatSpace();
         jkStringConcatInt(ctf_score_gold);
         jkStringConcatSpace();
         jkStringConcatUNIString(msgbase + 38);
         jkStringConcatSpace();
         jkStringConcatInt(ctf_score_red);
         jkStringOutput(-3, -1);
      }

      if(ctf_score_red == ctf_score_gold)
      {
         // Print("Final Score is a DRAW at");
         jkStringClear();
         jkStringConcatUNIString(msgbase + 32);
         jkStringConcatSpace();
         jkStringConcatInt(ctf_score_red);
         jkStringConcatSpace();

         if(ctf_score_red == 1)
         {
            // Print("point.");
            jkStringConcatUNIString(msgbase + 36);
         }
         else
         {
            // Print("points.");
            jkStringConcatUNIString(msgbase + 37);
         }

         jkStringOutput(-3, -1);

      }
   }

   Return;

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

show_end:
   if(verbose > 0)
   {
      // Space
      jkPrintUNIString(-3, msgbase + 39);

      if(level_ended == 1)
      {
         // Print("--==<< Score Limit Reached >>==--");
         jkPrintUNIString(-3, msgbase + 2);
      }

      if(level_ended == 2)
      {
         // Print("--==<< Time Limit Reached >>==--");
         jkPrintUNIString(-3, msgbase + 3);
      }

      // Space
      jkPrintUNIString(-3, msgbase + 39);
   }

   Return;

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

end_level:

   SyncScores();

   call show_end;

   // until it is time to quit the level
   SetTimerEx(5, 9999, 0, 0);

   Return;

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

// CTF Callback interface
// This will allow the other COG to do some level specific actions on CTF events.
// Another script may SendMessageEx() here, passing its own cog reference in p0.
// p1 should contain -1 or the time_limit (counting from message reception)
// p2 should contain -1 or the new verbose level
// p3 should contain -1 or the play_sounds value
//
// CTF_MAIN will always send it a User0 when an important CTF event occurs,
// with the following parameters:
//
// p0 = 00 : Score Limit Changed          p1 = new score limit
// p0 = 01 : Score Limit Reached          p1 = player who last scored
// p0 = 02 : Time Limit Reached
//
// p0 = 03 : New Red Player was marked    p1 = player who was marked
// p0 = 04 : New Gold Player was marked   p1 = player who was marked
//
// p0 = 10 : Red Flag Taken               p1 = player who took the flag
// p0 = 11 : Red Flag Returned            p1 = player who returned the flag
// p0 = 12 : Red team captured the flag   p1 = player who scored
// p0 = 13 : Red flag lost by Gold team   p1 = player who was killed
// p0 = 14 : Red flag auto returned home
// p0 = 15 : Red Flag ReTaken             p1 = player who took the flag
// p0 = 20 : Gold Flag Taken              p1 = player who took the flag
// p0 = 21 : Gold Flag Returned           p1 = player who returned the flag
// p0 = 22 : Gold team captured the flag  p1 = player who scored
// p0 = 23 : Gold flag lost by Red team   p1 = player who was killed
// p0 = 24 : Gold flag auto returned home
// p0 = 25 : Gold Flag ReTaken            p1 = player who took the flag
//
// p2 = red score and p3 = gold score for all messages.

user0:
   ctf_callback                      = GetParam(0);
   if(GetParam(1) != -1)
   {
      time_limit  = GetParam(1);
      KillTimerEx(9998);
      SetTimerEx(time_limit * 60, 9998, 0, 0);
   }

   if(GetParam(2) != -1) verbose     = GetParam(2);
   if(GetParam(3) != -1) play_sounds = GetParam(3);

   Return;

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

// CTF Keys interface
// This allows a per level use of the CTF Keys
// The CTF Keys powerups cogs will manage this.

user1:
   ctf_keys = 1;

   Return;

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

// this is just a quick hack to communicate the keys bins contents
// from client to server, because they are not synched...

user2:
   SetInv(GetParam(0), GetParam(1), GetParam(2));
   SetInvAvailable(GetParam(0), GetParam(1), GetParam(2));
   Return;

end


[Too much scrolling - Hideki]



[This message has been edited by Hideki (edited December 11, 2000).]
2000-12-11, 4:11 PM #2
Try this. I hope it works to some extent.

Code:
host cog

startup:

if(IsServer())
{
   numPlayer = 1;
   clients0[0] = GetLocalPlayerThing();
   his_model0[0] = hostsModel;
}

joined:

if(IsServer())
{
   clients0[numPlayer] = GetSenderRef();
   //check for his team and model here as joinersModel
   his_model0[numPlayer] = joinersModel;

   SendTrigger(-1, someID1, 0, 0, 0, 0);

   for(i=0; i<=numPlayer; i++) SendTrigger(-1, someID2, clients0[numPlayer], his_model0[numPlayer], 0, 0);

   numPlayer++;
}

client cog
startup:

   SetPulse(0.01);

trigger:

if(GetSourceRef() == someID1)
{
   numPlayer = 0;
}
else
if(GetSourceRef() == someID2)
{
   clients0[numPlayer] = GetParam(0);
   his_model0[numPlayer] = GetParam(1);
   numPlayer++;
}

pulse:

for(i=0; i<numPlayer; i++) SetThingModel(clients0, his_model0);



------------------
http://millennium.massassi.net/ - Millennium

[This message has been edited by Hideki (edited December 11, 2000).]
2000-12-11, 8:26 PM #3
Thats quite a big cog, sorry I can't help [i am not a cogger]
2000-12-12, 3:05 AM #4
Actually...I think that MotS engine supports skin changing,cuz MotS is modified from JK,no commands deletad,but added some...

------------------
He loves best who prayed best,
all things both great and small,
for the dear God who loved us,
He may ain't love at all.
WHAT?
2000-12-12, 12:03 PM #5
You don't know about it, try and see if it works or not.

------------------
http://millennium.massassi.net/ - Millennium

↑ Up to the top!