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 → last surface walked on respawn
last surface walked on respawn
2001-07-16, 4:51 AM #1
Seifer wrote this cog to cause the player in jk mp to respawn on the last surface walked on. the only problem is that i have a verybasic knowledge of cog and i'm not sure how to implement it. anybody know how?

here's the code:
Code:
killed:

dist = 10000;
curPos = GetThingPos(player);
for(i=0; i<GetSurfaceCount; i=i+1)
{ 
if(GetSurfaceFlags(i) & 0x1) 
{ 
checker = VectorDist(curPos, SurfaceCenter(i)); 
if(checker < dist) 
{ 
dist = checker; 
closest = i; 
floor = CreateThingAtPos(ghost,
GetSurfaceSector(closest), GetSurfaceCenter(closest),
'0 0 0'); 
} 
} 
} 
} 

newplayer: 

TeleportThing(player, floor); 
Destroything(floor);


any help would be appreciated. thanks
"the mouse is my chisel."
MotS mp:
Little House of Hazards
Surface Disposal Outpost
2001-07-16, 1:53 PM #2
Add the code to 'kyle.cog' to the start of the sections already listed. ( 'killed:' & 'newplayer:' )

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

[This message has been edited by Raynar (edited July 16, 2001).]
Pagewizard_YKS: "making your own lightsaber doesn't make you a nerd... "
Raynar - the man with a 10.75" ePenis
2001-07-16, 2:28 PM #3
Raynar is right I think. I can see some problems with that already...say, you fell in a bit and broke your skull open..then you respawn in a pit. Sure makes things difficult to get back out.
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2001-07-16, 3:09 PM #4
I remember writing 90% of that code [http://forums.massassi.net/html/smile.gif] though not for this specific use.

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

[This message has been edited by Hideki (edited July 16, 2001).]
2001-07-16, 3:27 PM #5
Emon: you could always just do a quick check to see if the current sector is flagged as 'pit' or not. And if so, just ignore the 'teleport()' function.

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
2001-07-16, 8:02 PM #6
lol Hideki .... yeah [http://forums.massassi.net/html/biggrin.gif] , and no Emon ..... that is not the case, most of the time , you don't come near the pit bottom it self.
2001-07-16, 8:45 PM #7
ok, so i add the code for killed at the start of killed, and the code for newplayer at the beginning of where it says new player in the kyle.cog, without erasing what it alrady says there? i can make sure that the player doesn't hit the bottom of something and get trapped there. that's not a problem at all.
"the mouse is my chisel."
MotS mp:
Little House of Hazards
Surface Disposal Outpost
2001-07-16, 8:45 PM #8
thanks, by the way.
"the mouse is my chisel."
MotS mp:
Little House of Hazards
Surface Disposal Outpost
2001-07-17, 4:50 AM #9
yeah, when i do that, i get a kyle that still respawns at the walkplayer, has no weapons or shields, but he does have force powers. like i said, i don't know a lot about cog. should i be running the game differently? [http://forums.massassi.net/html/confused.gif]
"the mouse is my chisel."
MotS mp:
Little House of Hazards
Surface Disposal Outpost
2001-07-17, 10:37 PM #10
Hmmm maybe it's Teleporting so fast that it hasen't had time to respawn.

First change the ghost template to something like a box that you can see, secondly under newplayer put Sleep(0.025);

Then see if it acculy creates the template and if it will teleport now.

and BTW just add it onto the exists killed and newplayer.
2001-07-18, 4:37 AM #11
I think the problem is that he put the code somewhere in newplayer so that the:

call init_kyle;

call init_multi_kyle

aren't being executed anymore. I'm sure if you posted it we could find the error.
2001-07-18, 5:09 AM #12
here's the code the way i have it.
Code:
killed:
   dist = 10000;
   curPos = GetThingPos(player);
   for(i=0; i<GetSurfaceCount; i=i+1)
   { 
   if(GetSurfaceFlags(i) & 0x1) 
   { 
   checker = VectorDist(curPos, SurfaceCenter(i)); 
   if(checker < dist) 
   { 
   dist = checker; 
   closest = i; 
   floor = CreateThingAtPos(ghost,
   GetSurfaceSector(closest), GetSurfaceCenter(closest),
   '0 0 0'); 

   if(player != GetSenderRef()) Return;

   if(IsMulti())
   {
      CreateBackpack(player);
      ClearActorFlags(player, 0x2000);
   }

   // clean up force powers stuff
   if(blindingEffectHandle!=-1)
   {
      freeColorEffect(blindingEffectHandle);
      blindingEffectHandle = -1;
   }
   ClearActorFlags(player, 0x800);
   KillTimerEx(27);
   force_blinding = 0;

   ClearActorFlags(player, 0x40000);

   if(griptrackID != -1)
   {
      StopKey(player, griptrackID, 0.1);
      griptrackID = -1;
   }

   Return;

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

damaged:
   if(GetParam(1) == 32) call make_bubbles;

   ReturnEx(GetParam(0));
   Return;

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

make_bubbles:
   playersector = GetThingSector(player);
   playerpos    = VectorAdd(GetThingPos(player), '0 0 0.075');

   for(bub = 1; bub < 1 + 3 * rand(); bub = bub + 1)
   {
      CreateThingAtPosNR(bubble_tpl[3 * rand()], playersector, VectorAdd(playerpos, VectorScale(VectorNorm(VectorSet(rand()-0.5, rand()-0.5, rand()-0.5)), 0.05)), '0 0 0');
      Sleep(0.05);

      // Don't create too many bubbles over the network...
      if(!IsMulti())
      {
         CreateThingAtPos(bubble_tpl3, playersector, VectorAdd(playerpos, VectorScale(VectorNorm(VectorSet(rand()-0.5, rand()-0.5, rand()-0.5)), 0.05)), '0 0 0');
         Sleep(0.05);
      }
   }

   Return;

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

newplayer:
   TeleportThing(player, floor); 
   Destroything(floor);
   
   call init_kyle;

   // If it's multiplayer
   if(IsMulti()) call init_multi_kyle;

   // Start Bubbles
   SetTimerEx(2 + 5 * rand(), 2, 0, 0);
   
   

   Return;

i'm extracting the cog, editing it like above, then placing it in my project directory's cog folder. what could it be that i'm doing wrong? i've never edited the kyle.cog before, so i have no clue


[This message has been edited by adrenal_medulla (edited July 18, 2001).]
"the mouse is my chisel."
MotS mp:
Little House of Hazards
Surface Disposal Outpost
2001-07-23, 11:48 AM #13
i'm still stuck on this one so any more help would be appreciated greatly. [http://forums.massassi.net/html/confused.gif]
"the mouse is my chisel."
MotS mp:
Little House of Hazards
Surface Disposal Outpost

↑ Up to the top!