Teleporters Help

Have questions about CoD/UO mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Teleporters Help

Post by Nightmare » February 21st, 2006, 2:56 am

Hey, I was wondering if any of you guys had any knowledge on how to make teleporters that could send you from on place to another by walking into a trigger. Thanks

Pedsdude
Site Admin
Site Admin
Posts: 15914
Joined: October 15th, 2004, 7:18 pm
Location: UK

Post by Pedsdude » February 21st, 2006, 1:57 pm

I know it's possible, and I have it in pp_solar (thanks to Plazma's work), but I personally don't know how to do it :P
Image
Image

Luke
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 1774
Joined: May 31st, 2005, 12:42 am
Location: Cornwall, UK

Post by Luke » February 21st, 2006, 3:50 pm

Found some info @ modsonline, haven't tested it yet but you could try it:
In the editor, go to your departure point, draw out a decent size brush and texture it trigger, right click in 2d view, go down and make it trigger_multiple.
with the trigger still selected press n and enter these values
Key = target Value = gohere
Key = targetname Value = enter
Press n again to close the entity box
(Thats it for the trigger, press esc.)

Navigate your way in the editor to where you want to be teleported to.
Right click in the 2d view and create a script_origin (a red cube should appear)
With that still selected, press n and enter these values
Key = targetname Value = gohere
Press n again to close the entity box
You can rotate the red cube until the arrow faces the direction you wish to be facing when teleported.

With the script_origin still selected go back to the trigger and select them both, now hold down the Ctrl key and hit the k key to connect them. Press esc.

If you have things correct you should now see a red line connecting trigger and red cube.

(I think thats it for the mapping bit)

Compile,

Make a .gsc containing this script (just call it teleport)
.....................................................................................

main()
{

entTransporter = getentarray("enter","targetname");
if(isdefined(entTransporter))
{
for(lp=0;lp entTransporter[lp] thread Transporter();
}


}


Transporter()
{
while(true)
{
self waittill("trigger",other);
entTarget = getent(self.target, "targetname");

wait(0.10);
other setorigin(entTarget.origin);
other setplayerangles(entTarget.angles);
wait(0.10);
}
}

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13315
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Post by Drofder2004 » February 21st, 2006, 6:49 pm

Map and Pk3

Edit...

Changed my mind. I was impressed by the technique that was used in lukes post, it made coding a little easier (although mapping slightly harder).

Ok, so make your teleport triggers and give them a targetname of enter.k
Now Make the place where you want each teleporter to go to by using a script_model. (right click, script<model)
and give that a targetname of whatever you want.

Now go back to the teleporters and give them a new key and value.
Key:target
Value:<enter the targetname of the script_model you want to teleport to>

Now simply use this script..

Code: Select all

main()
{
entTransporter = getentarray("enter","targetname");

if(isdefined(entTransporter))
{
for(i=0;i<entTransporter.size;i++)
entTransporter[i] thread Transporter();
}
}

Transporter()
{
while(1)
{
self waittill("trigger",user);
entTarget = getent(self.target, "targetname");

wait .1;
user setorigin(entTarget.origin);
wait .1;
}
} 
You can have as many teleporters as you like without having to touch the code. I have 8 teleports on my map ;)

Have Fun.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Guest

Post by Guest » February 21st, 2006, 9:07 pm

can you juse teleporters in mp or only in sp

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13315
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Post by Drofder2004 » February 21st, 2006, 9:28 pm

Anonymous wrote:can you juse teleporters in mp or only in sp
My map is an MP map so, yes MP and SP.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Rince
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 623
Joined: February 15th, 2005, 1:04 pm

Post by Rince » February 21st, 2006, 9:39 pm

omg drof =O msn 2 night teleporters for denmark :-)~

Pedsdude
Site Admin
Site Admin
Posts: 15914
Joined: October 15th, 2004, 7:18 pm
Location: UK

Post by Pedsdude » February 21st, 2006, 10:43 pm

lol rince :)
Image
Image

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13315
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Post by Drofder2004 » February 21st, 2006, 11:12 pm

Rince wrote:omg drof =O msn 2 night teleporters for denmark :-)~
Depends what time my brother comes off PC.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » February 22nd, 2006, 12:21 am

Drofder, thank you sooo much man! It works! Luke, I tried your way but it didnt work for me, thanks anyway!

Luke
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 1774
Joined: May 31st, 2005, 12:42 am
Location: Cornwall, UK

Post by Luke » February 22nd, 2006, 1:09 am

Nightmare wrote:Drofder, thank you sooo much man! It works! Luke, I tried your way but it didnt work for me, thanks anyway!
Good :) what i posted was just what i found on modsonline.com, don't get the wrong idea that i know what i'm talking about :P

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13315
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Post by Drofder2004 » February 22nd, 2006, 1:19 pm

Luke wrote:
Nightmare wrote:Drofder, thank you sooo much man! It works! Luke, I tried your way but it didnt work for me, thanks anyway!
Good :) what i posted was just what i found on modsonline.com, don't get the wrong idea that i know what i'm talking about :P
Your way does work Luke if the code was corrected ;)

Code: Select all

{
for(lp=0;lp entTransporter[lp] thread Transporter();
}
That is meant to be a for loop, but it skips out the essentials in the loop. Its meant to look like this...

Code: Select all

{
for(i=0;i<entTransporter.size;i++)
entTransporter[i] thread Transporter();
}
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

leveller
CJ Fan
CJ Fan
Posts: 156
Joined: June 25th, 2005, 12:24 pm

Post by leveller » February 22nd, 2006, 4:43 pm

This is what i use for my own maps,

make a triggermultiple :

Code: Select all

Key = targetname Value = transporter_01
For the scripting i use this

Code: Select all

main()
{
thread Transporter_01();
}

Transporter_01()
{
	while(1)
	{
		players = getentarray("player", "classname");

		for(i=0;i<players.size;i++)
		{
			finishtrig = getent ("transporter_01","targetname");
			finishtrig waittill ("trigger",user);

		user setOrigin( (-152, 736,1000) );

		}
	wait .5;
	}
}
i use the :

Code: Select all

user setOrigin( (-152, 736,1000) );
in the script, so i can set it to an other position without having to recompile the map again.

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13315
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Post by Drofder2004 » February 22nd, 2006, 4:56 pm

leveller wrote: i use the :

Code: Select all

user setOrigin( (-152, 736,1000) );
in the script, so i can set it to an other position without having to recompile the map again.
I dont think you need the for loop with the while loop as the loop will find the "user" of the trigger anyway.

As I said in another post, using a for loop with players is bad in a map file because if a player join after that loop has been run, they will not be part of the loop (and anything inside the loop will not work).

The way you posted was the roughly the same as what I posted before I edited, (except without the for loop). I prefer the way that I have posted simply because it can support hundreds of teleporters without a single modification to the code, just means a bit more mapping.

:)
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

leveller
CJ Fan
CJ Fan
Posts: 156
Joined: June 25th, 2005, 12:24 pm

Post by leveller » February 22nd, 2006, 5:13 pm

its been a while sinds i made the script,

but i remember that i use to have the script without the loop, and for some reason, (i would have to try it again)
i didnt like the way the script ran, and it worked better to my liking with the loop in it.

Could be it had someting to do with sending individual messages to the user who used the transporter.

I'll come back on, after i tried it again.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests