Spawnpoints as teleport destinations ?

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
Kalti
Major
Posts: 325
Joined: Sun Mar 16, 2003 11:46 am
Contact:

Spawnpoints as teleport destinations ?

Post by Kalti »

Ehrm... can I use targetnamed spawnpoints as teleport destinations ?

Just checking, as I'll need a sequential destination for a teleport.
Image
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Sure, just take the spawnpoint's .origin property as the destination. I'd recommend you to make a trigger checking if the spawnpoint's not occupied by a player to prevent telefragging.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
User avatar
Kalti
Major
Posts: 325
Joined: Sun Mar 16, 2003 11:46 am
Contact:

Post by Kalti »

Thanks, I have placed a trigger multiple around the origin destination... how do I hook that up to the part where I can check if the location is in use ?

And can I name an alternative location when the original location is in use ?
Image
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

From the top of my head. You can remove the trigger_multiple from the map. Call the following thread like this for each teleporter (the teleporter being a trigger_multiple):

Code: Select all

$teleport_trigger thread teleport_setup $your_spawnpoint
The thread itself:

Code: Select all

teleport_setup local.destination:
	self.destination = local.destination
	local.ent = spawn trigger_multiple origin self.destination.origin
	local.ent setsize ( -16 -16 0 ) ( 16 16 96 ) // spawnpoint dimensions
	local.ent.occupied = 0
	local.ent setthread spawn_occupied_check
	while (1)
	{
		self waittill trigger
		local.player = parm.other
		self thread safe_teleport local.player
	}
end

spawn_occupied_check
	local.player = parm.other
	while (local.player isTouching self && isAlive(local.player))
	{
		self.occupied = 1
		waitframe
	}
	self.occupied = 0
end

safe_teleport local.player:
	while (local.player isTouching self && isAlive(local.player) && self.destination.occupied)
		waitframe
	local.player.origin = self.destination.origin
end
Should work. ;) You can modify the script so that it chooses a random spawnpoint as a destination.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
User avatar
Kalti
Major
Posts: 325
Joined: Sun Mar 16, 2003 11:46 am
Contact:

Post by Kalti »

ow... that's way more complicated then my 4 lines of n00b script...

It seem as I may be better of posting my test map with the mapsource included and hope any of you guys will be so kind to take a look at it.

I'll get back on that later
Image
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Yeah, it could be much more simple, but would you risk telefragging? :twisted: :P
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

telefraggin wont matter much, if omeone is stupid enough to camp there to get telefragged i think they deserve it.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Elgan
Site Admin
Posts: 890
Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:

Post by Elgan »

can i ask why?

or if u need a specific point as u can make a player respawn using local.player respawn? dont know if that wud help.
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Remember that respawning a player resets his stats like health, ammo, weapons etc. I'm not sure whether Kalti would want it.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Elgan
Site Admin
Posts: 890
Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:

Post by Elgan »

yeah i know, Thats why i wasnt sure if it wud be of help.
User avatar
Kalti
Major
Posts: 325
Joined: Sun Mar 16, 2003 11:46 am
Contact:

Post by Kalti »

Thanks guys.

I am looking to steer clear from the telefragging as I personally find it irritating and perhaps even sloppy. But that's just me.

Elgan; I was hoping to use 'normal' spawnpoints as teleport destinations if it could be done at random... however, I don't want to give players the benefit of resetting their health, so I decided (just now) to use separate destinations. Thanks though ;)

The idea behind the testmap is simple but very difficult for me to script... It's one teleport leading into a completely sealed off room. The room is square of shape and in each corner I've placed a teleport leading to a destination somewhere in the map.

Image

The first teleport (which leads into the room) has been placed in an altar with a secret door (I know... lame) After a player has entered this first teleport the door should be closed and locked to prevent additional players entering the altar and/or teleport. (also to prevent telefrags on the teleport destination in the room)

The room itself should only allow one player at a time. Floor, ceiling and the 4 walls are script_objects (placed before the actual structure of the building) which should be 'hidden' from the start until a player enters the room. Besides 'showing' the script_objects, a sound should start playing when a player enters the room.

I've placed a trigger_multiple in the room to check for players. As soon as a player enters one of the 4 available teleports the secret door in the altar should be unlocked, the walls, ceiling and floor of the room should be 'hidden' and the sound stopped.

Although I can get certain parts of this test map scripted I don't have the experience to do this efficiently and cleanly(as short as possible; if & else statements and such...) Seeing Rookie_One's "destination in use? script" made my heart sank into my shoes... I'm still trying to understand it and trying to get it to work at the same time though.

Off course I want the 4 teleport destinations leading out of the room telefrag proof... preferably using an alternative destination if the original one is in use (1 of the 4). But atm I'm stuck working out how I should script the hiding and showing of the script_objects when a player enters the room.

I have some sort of a map standing by, for any of you interested, but for now it's just the bsp and map source (without any script!).

Image

User-Teleport_test.pk3

Btw. I can understand if you guys rather see me struggling on this some more... your right actually, but I planned to thank you guys for the help so far as I felt I wasn't quite ready to post the mapsource, but my reply went on into boredom, so I chose to add the mapsource anyway :wink:
Image
Elgan
Site Admin
Posts: 890
Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:

Post by Elgan »

u cud get their health and reaply it when they respawn. Cant get the ammo though:(

i wud go with rockie script. maybe..


are u trying to just teleport someone to a random spawnpoint of any type anywhere in the map?
User avatar
Kalti
Major
Posts: 325
Joined: Sun Mar 16, 2003 11:46 am
Contact:

Post by Kalti »

Elgan wrote:...are u trying to just teleport someone to a random spawnpoint of any type anywhere in the map?
Yes, that was the idea... but I settled with just the 4 different destinations.
Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

If you give each of the spawnpoints targetnames and use $alter_spawnpoint_1 disablespawn you can stop other players from spawning at them . If the spawnpoints did have targetnames then you could use thier origins as teleport destinations . That would have to be done in a custom map I don't think you could script that because maps don't have spawnpoints with targetnames in most cases .
Image
Post Reply