Teleport code

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
NachtIntellect
Forum Regular
Posts: 480
Joined: Mon Jun 11, 2012 9:20 am
Location: Bienenstock, Germany

Teleport code

#1

Post by NachtIntellect » Sun Oct 11, 2015 11:09 pm

Alright so, I was wondering if anyone could help me with this, I know I have done something wrong but I can't figure it out and to be honest it's giving me a headache, I have never been good with ACs either, I am a little wary of asking for help on forums, I am just going to leave it at that.

About the script, what this is supposed to do is to teleport a player to a mapspot and teleport them back, Just like in the Zombies map Kino Der Toten which is actually what this is for but there are certain things that need to be met before this happens and well I guess I'll let the script explain it to you, even if it's a bad script I am pretty sure it'll tell you how everything is done.

Code: Select all

int TeleporterCool=1;
int TeleporterLinked=0;
int Power=0; //I am aware there is no way to make this = 1 in these scripts to explain that, the value is in the map that someone else is making but regardless I had thought all of this should've worked

Script 243 Enter
{
 While(True);
 {
 if(ThingCountSector(T_NONE,ActivatorTID(),15)==1 && Power==1 && TeleporterLinked==0) //I want this part to be constantly checked but for some reason it keeps popping up at the start and sometimes it doesn't even work at all
 {
  SetFont("SMALLFONT");
  SetHudSize(800,600,0);
  HudMessage(s:"hold \cfUSE \c-for to link teleporter";HUDMSG_FADEOUT,5,CR_WHITE,400.0,300.0,1.0,0.2);
 }
 if(BT_USE)
 {
  TeleporterLinked=1;
 }
 if(ThingCountSector(T_NONE,ActivatorTID(),16)==1 && Power==1 && TeleporterCool==1 && TeleporterLinked==1)
 {
  SetFont("SMALLFONT");
  SetHudSize(800,600,0);
  HudMessage(s:"hold \cfUSE \c-for to activate teleporter";HUDMSG_FADEOUT,5,CR_WHITE,400.0,300.0,1.0,0.2);
 }
 if(BT_USE)
 {
  TeleporterCool=0;
  TeleporterLinked=0;
  ACS_ExecuteAlways(244,0,0,0,0);
 }
 if(ThingCountSector(T_NONE,ActivatorTID(),16)==1 && Power==0)
 {
 SetFont("SMALLFONT");
 SetHudSize(800,600,0);
 HudMessage(s:"Must turn on the power first";HUDMSG_FADEOUT,5,CR_WHITE,400.0,300.0,1.0,0.2);
 }
 if(ThingCountSector(T_NONE,ActivatorTID(),16)==1 && Power==1 && TeleporterCool==0)
 {
  SetFont("SMALLFONT");
  SetHudSize(800,600,0);
  HudMessage(s:"Teleporter cooling down";HUDMSG_FADEOUT,5,CR_WHITE,400.0,300.0,1.0,0.2);
 }
 if(ThingCountSector(T_NONE,ActivatorTID(),16)==1 && Power==1 && TeleporterLinked==0)
 {
  SetFont("SMALLFONT");
  SetHudSize(800,600,0);
  HudMessage(s:"Must link teleporter first";HUDMSG_FADEOUT,5,CR_WHITE,400.0,300.0,1.0,0.2);
 }
 If(TeleporterCool==0)
 {
  Delay(35*120);
  TeleporterCool=1;
 }
 }
 Delay(1);
}

Script 244 (Void) //Don't think there's any problem with this at all, I tested it and it works
{
 Delay(35*5);
 if(ThingCountSector(T_NONE,1000,16)==1)
 {
  Thing_Move(1000,5,0);
  Delay(35*30);
  Thing_Move(1000,1,0);
 }
 if(ThingCountSector(T_NONE,1001,16)==1)
 {
  Thing_Move(1001,6,0);
  Delay(35*30);
  Thing_Move(1001,2,0);
 }
 if(ThingCountSector(T_NONE,1002,16)==1)
 {
  Thing_Move(1002,7,0);
  Delay(35*30);
  Thing_Move(1002,3,0);
 }
 if(ThingCountSector(T_NONE,1003,16)==1)
 {
  Thing_Move(1003,8,0);
  Delay(35*30);
  Thing_Move(1003,4,0);
 }
}
Last edited by NachtIntellect on Sun Oct 11, 2015 11:17 pm, edited 1 time in total.
Did you just bite me? Come here, I will bite you back bastard.

User avatar
ibm5155
Addicted to Zandronum
Posts: 1641
Joined: Tue Jun 05, 2012 9:32 pm
Location: Somewhere, over the rainbow

RE: Teleport code

#2

Post by ibm5155 » Mon Oct 12, 2015 12:11 am

you want to teleport the player but you're not using the teleport function?
you just need the teleportfunction, this function will teleport the player who started the script to a tid x.
like teleport(1,0,true); will teleport the player to the tid 1 (that should be set to a destination teleport on doom builder)
I Always set the teleport tag to zero, it never worked for me, and some mods broke when played on older/newer version of zdoom/zandronum
Projects
Cursed Maze: DONE, V2.0
Zombie Horde - ZM09 map update: [3/15/13]
Need help with English? Then you've come to the right place!

<this post is proof of "Decline">

User avatar
NachtIntellect
Forum Regular
Posts: 480
Joined: Mon Jun 11, 2012 9:20 am
Location: Bienenstock, Germany

RE: Teleport code

#3

Post by NachtIntellect » Mon Oct 12, 2015 12:17 am

ibm5155 wrote: you want to teleport the player but you're not using the teleport function?
you just need the teleportfunction, this function will teleport the player who started the script to a tid x.
like teleport(1,0,true); will teleport the player to the tid 1 (that should be set to a destination teleport on doom builder)
I Always set the teleport tag to zero, it never worked for me, and some mods broke when played on older/newer version of zdoom/zandronum
Thing_Move also seems to do the trick for me or is it limited in some way that I don't know about? Besides I am not looking to teleport one player, I'd want to teleport each player (The mod only allows 4 people to play) who is on sector 16 as the script states.
Last edited by NachtIntellect on Mon Oct 12, 2015 12:20 am, edited 1 time in total.
Did you just bite me? Come here, I will bite you back bastard.

User avatar
ibm5155
Addicted to Zandronum
Posts: 1641
Joined: Tue Jun 05, 2012 9:32 pm
Location: Somewhere, over the rainbow

RE: Teleport code

#4

Post by ibm5155 » Mon Oct 12, 2015 12:23 am

well, I never used thing_move, but just an example as zombie horde uses.
teleport_group is used to teleport all the players, this is used to teleport like on ze06, when the elevator closes the door, it teleports everyone to their specific positions in a new sector.

and also, here're all the teleport functions http://zdoom.org/wiki/Category:Teleport_specials

hmm, thing_move sounds like teleport_group
Last edited by ibm5155 on Mon Oct 12, 2015 12:24 am, edited 1 time in total.
Projects
Cursed Maze: DONE, V2.0
Zombie Horde - ZM09 map update: [3/15/13]
Need help with English? Then you've come to the right place!

<this post is proof of "Decline">

User avatar
NachtIntellect
Forum Regular
Posts: 480
Joined: Mon Jun 11, 2012 9:20 am
Location: Bienenstock, Germany

RE: Teleport code

#5

Post by NachtIntellect » Mon Oct 12, 2015 12:28 am

ibm5155 wrote: well, I never used thing_move, but just an example as zombie horde uses.
teleport_group is used to teleport all the players, this is used to teleport like on ze06, when the elevator closes the door, it teleports everyone to their specific positions in a new sector.

and also, here're all the teleport functions http://zdoom.org/wiki/Category:Teleport_specials

hmm, thing_move sounds like teleport_group
I thankyou for trying to help but that was not the part of the script I am looking to for help, the part of the script I am looking for help on is Script 243, Script 244 which has thing move in it works fine, there's no need to change or modify it.
Did you just bite me? Come here, I will bite you back bastard.

User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

RE: Teleport code

#6

Post by Vincent(PDP) » Mon Oct 12, 2015 7:09 pm

BT_USE is just a constant number, so doing "if(BT_USE)" will always return true because BT_USE is greater than 1.

See this article on how you get which button a player is pressing:
http://zdoom.org/wiki/GetPlayerInput
Last edited by Vincent(PDP) on Mon Oct 12, 2015 7:10 pm, edited 1 time in total.
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

Post Reply