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 request
Cog request
2003-03-24, 6:23 PM #1
First off, this is for my MP rolling level. It'd also lag less if one cog could handle 5 or 10 checkpoints apiece, but if that an impossibility or too amazingly complicated(I can see how it would be with the multiple ghost positions) it's not necessary. Here we go.
I need a few cogs for my rolling level, but this one first off. It would suck to nearly complete the level and die at the very end, with the death returning you back to the starting line, so I request this to anyone willing: I need [a] checkpoint cog(s). If you can make it so it prints a message(something like "Checkpoint 1 crossed," something I can edit) when an adjoin is passed through, then when the person dies later on(from any cause, I guess) it'll count as the person dying normally, except they'll be placed back by the checkpoint at a ghost thing point. The same for Checkpoint 2, 3, 4, etc. up until the player completes the course, where the last checkpoint value is erased to start again.
The only problems I can see with this are having two people die at the same time and being transported to the same ghost position or someone not being able to complete that part of the course and wanting to go back to the start and begin anew, possibly taking a different course. Maybe have a console thing to transport them back? A little teleporter? Any suggestions welcome, but the cog is flat out a must. You will be credited/praised for it, but my skills for returning the favor are limited.
Thank you.
2003-03-24, 9:01 PM #2
This what you need?
Code:
# Written By DSLS_DeathSythe
flags=0x240
symbols
#-----
message	startup
message	activated
message	crossed
message	killed
message	newplayer
message	timer
#-----
sound     check_snd
sound     tele_snd
sound     finish_snd
surface   checkpnt1
surface   checkpnt2
surface   checkpnt3
surface   checkpnt4
surface   checkpnt5
surface   checkpnt6
surface   checkpnt7
surface   checkpnt8
surface   checkpnt9
surface   checkpnt10
surface   finishline
thing     checkpnt_gpos0=-1
thing     checkpnt_gpos1=-1
thing     checkpnt_gpos2=-1
thing     checkpnt_gpos3=-1
thing     checkpnt_gpos4=-1
thing     checkpnt_gpos5=-1
thing     checkpnt_gpos6=-1
thing     checkpnt_gpos7=-1
thing     checkpnt_gpos8=-1
thing     checkpnt_gpos9=-1
thing     startline_gpos=-1
thing     console1=-1
thing     console2=-1
thing     console3=-1
thing     console4=-1
thing     console5=-1
thing     console6=-1
thing     console7=-1
thing     console8=-1
thing     console9=-1
thing     console10=-1
thing     console11=-1
thing     player=-1     local
int       plyr_reach=0  local
#-----
end
#-----
code
#-----
startup:
  player = GetLocalPlayerThing();
return;
#-----
activated:
  plyr_reach = 0;
  PlaySoundLocal(tele_snd, 1.0, 0, 0x0);
  TeleportThing(player, startline_gpos);
return;
#-----
crossed:
  if(GetSourceRef() != player) return;
  if(GetSenderRef() == checkpnt1)
    {
    plyr_reach = 1;
    Call tell_pos;
    return;
    }
  else
  if(GetSenderRef() == checkpnt2)
    {
    plyr_reach = 2;
    Call tell_pos;
    return;
    }
  else
  if(GetSenderRef() == checkpnt3)
    {
    plyr_reach = 3;
    Call tell_pos;
    return;
    }
  else
  if(GetSenderRef() == checkpnt4)
    {
    plyr_reach = 4;
    Call tell_pos;
    return;
    }
  else
  if(GetSenderRef() == checkpnt5)
    {
    plyr_reach = 5;
    Call tell_pos;
    return;
    }
  else
  if(GetSenderRef() == checkpnt6)
    {
    plyr_reach = 6;
    Call tell_pos;
    return;
    }
  else
  if(GetSenderRef() == checkpnt7)
    {
    plyr_reach = 7;
    Call tell_pos;
    return;
    }
  else
  if(GetSenderRef() == checkpnt8)
    {
    plyr_reach = 8;
    Call tell_pos;
    return;
    }
  else
  if(GetSenderRef() == checkpnt9)
    {
    plyr_reach = 9;
    Call tell_pos;
    return;
    }
  else
  if(GetSenderRef() == checkpnt10)
    {
    plyr_reach = 10;
    Call tell_pos;
    return;
    }
  else
  if(GetSenderRef() == finishline)
    {
    Print("You have reached the FINISH");
    PlaySoundLocal(finish_snd, 1.0, 0, 0x0);
    plyr_reach = 0;
    return;
    }
return;
#-----
killed:
  if(GetSenderID != player) return;
newplayer:
  if(plyr_reach > 0)
    {
    SetTimer(0.01);
    }
return;
#-----
timer:
  StopThing(player);
  TeleportThing(player, checkpnt_gpos0[plyr_reach - 1]);
return;
#-----
tell_pos:
  PlaySoundLocal(check_snd, 1.0, 0, 0x0);
  Print("- You have reached CHECK POINT -");
  PrintInt(plyr_reach);
return;
#-----
end

That should do what it sounds like you want.
It doesnt matter if two players teleport to the same spot, they just overlap each other until they move.
I even made it play some sounds when you get to check points and teleport with the consoles and reach the finish line but you have to choose the sounds.
The 11th console is one that you can put at the finish line so the player can start over.
Hope that will do.

------------------


[This message has been edited by DSLS_DeathSythe (edited March 25, 2003).]
Famous last words - "It seemed like a good idea at the time."
2003-03-25, 2:55 AM #3
My GOD man, use arrays!!!

------------------
Createthingatpos(GBK, 0, '0 0 0', '0 0 0');
And when the moment is right, I'm gonna fly a kite.
2003-03-25, 4:00 AM #4
why use arrays when you can copy/paste [http://forums.massassi.net/html/tongue.gif] hehe j/k

------------------
roses are red, violets are blue, I am schizophrenic, and so am I!
roses are red, violets are blue, I am schizophrenic, and I am too!
2003-03-25, 7:04 AM #5
this better?
Code:
# CHECK_POING.COG
# Written By DSLS_DeathSythe
flags=0x240
symbols
#-----
message     startup
message     activated
message     crossed
message     killed
message     newplayer
message     timer
#-----
sound       check_snd
sound       tele_snd
sound       finish_snd
surface     checkpnt1     linkid=1
surface     checkpnt2     linkid=2
surface     checkpnt3     linkid=3
surface     checkpnt4     linkid=4
surface     checkpnt5     linkid=5
surface     checkpnt6     linkid=6
surface     checkpnt7     linkid=7
surface     checkpnt8     linkid=8
surface     checkpnt9     linkid=9
surface     checkpnt10    linkid=10
surface     finishline
thing       checkpnt_gpos0=-1
thing       checkpnt_gpos1=-1
thing       checkpnt_gpos2=-1
thing       checkpnt_gpos3=-1
thing       checkpnt_gpos4=-1
thing       checkpnt_gpos5=-1
thing       checkpnt_gpos6=-1
thing       checkpnt_gpos7=-1
thing       checkpnt_gpos8=-1
thing       checkpnt_gpos9=-1
thing       startline_gpos=-1
thing       console1=-1
thing       console2=-1
thing       console3=-1
thing       console4=-1
thing       console5=-1
thing       console6=-1
thing       console7=-1
thing       console8=-1
thing       console9=-1
thing       console10=-1
thing       console11=-1
thing       player=-1        local
int         plyr_reach=0     local
#-----
end
#-----
code
#-----
startup:
  player = GetLocalPlayerThing();
return;
#-----
activated:
  plyr_reach = 0;
  PlaySoundLocal(tele_snd, 1.0, 0, 0x0);
  StopThing(player);
  TeleportThing(player, startline_gpos);
return;
#-----
crossed:
  if(GetSourceRef() != player) return;
  if(GetSenderRef() == finishline)
    {
    Print("You have reached the FINISH");
    PlaySoundLocal(finish_snd, 1.0, 0, 0x0);
    plyr_reach = 0;
    return;
    }
  plyr_reach = GetSenderID();
  PlaySoundLocal(check_snd, 1.0, 0, 0x0);
  Print("- You have reached CHECK POINT -");
  PrintInt(plyr_reach);	
return;
#-----
killed:
  if(GetSenderID != player) return;
newplayer:
  if(plyr_reach > 0)
    {
    SetTimerEx(0.01, 1, 0, 0);
    }
return;
#-----
timer:
  If(GetSenderID() == 1)
    {
    StopThing(player);
    TeleportThing(player, checkpnt_gpos0[plyr_reach - 1]);
    return;
    }
return;
#-----
end

An updated and much shorter version.

------------------
Famous last words - "It seemed like a good idea at the time."
2003-03-25, 11:24 AM #6
All right...I've got a mess of cogs I need to make sense of and sort out. I've had mild experience with JS, so I understand it a little. I'll get back to you all once I've set everything up, but it looks good so far.

↑ Up to the top!