Teleport Pads

 

Mark a start position, drop the end pad, Voila! You have a one way teleporter. You could modify this so that you can destroy the pads (give them health and a die function. see the entity reference for details) You will prbably want to limit this in some way. Credit goes to Sorak for the Idea . Most of the code is mine, bar the teleport function which is almost identical to the one for teleporters in maps


Fairly easy one. Theres a new file with code in it (telepad.c) in the resources section. and then you need to modify g_local.h for a few more variables you will need. The other file is g_cmds.c so that you can actually do it.

g_local.h changes:

  1. Add the fields below to the client structure, just after qboolean update_chase;
2.                 vec3_t         telestart;
3.                 int            telestarted;
  1. Finally add the code below to the end of the file, just before the last }
5.                 edict_t        *teletarget;

As way of an explanation, telestart stores the start point of a new teleporter. Telestarted is a flag to tell you if a start position has be given. teletarget is for the teleporter start pad to store the end pads details.

g_cmds.c:

Find the code below in g_cmds.c

        else if (Q_stricmp (cmd, "wave") == 0)
               Cmd_Wave_f (ent);
        else if (Q_stricmp(cmd, "playerlist") == 0)
               Cmd_PlayerList_f(ent);

and insert the code below , just after it, before the else statement which follows

        else if (Q_stricmp (cmd, "setteleend") == 0)
               Cmd_Throw_End_Position(ent);
        else if (Q_stricmp (cmd, "showtelestart") == 0)
               Cmd_Show_Start_Position (ent);
        else if (Q_stricmp (cmd, "settelestart") == 0)
               Cmd_Mark_Start_Position (ent);
 

To round things off with this file add these prototypes just after the include lines

void Cmd_Throw_End_Position(edict_t *ent);
void Cmd_Show_Start_Position(edict_t *ent);
void Cmd_Mark_Start_Position(edict_t *ent);

Add telepad.c to your project/makefile, and compile it. showtelestart brings up a small flash where the start is, and the other two set the start and end points.


Resources


Skunkworks Tutorials