Page 1 of 1

Teleport code

Posted: Sun Oct 11, 2015 11:09 pm
by NachtIntellect
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);
 }
}

RE: Teleport code

Posted: Mon Oct 12, 2015 12:11 am
by ibm5155
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

RE: Teleport code

Posted: Mon Oct 12, 2015 12:17 am
by NachtIntellect
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.

RE: Teleport code

Posted: Mon Oct 12, 2015 12:23 am
by ibm5155
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

RE: Teleport code

Posted: Mon Oct 12, 2015 12:28 am
by NachtIntellect
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.

RE: Teleport code

Posted: Mon Oct 12, 2015 7:09 pm
by Vincent(PDP)
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