Page 1 of 1

Spawnpoints as teleport destinations ?

Posted: Fri Feb 11, 2005 4:35 pm
by Kalti
Ehrm... can I use targetnamed spawnpoints as teleport destinations ?

Just checking, as I'll need a sequential destination for a teleport.

Posted: Fri Feb 11, 2005 5:05 pm
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.

Posted: Sun Feb 13, 2005 4:25 pm
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 ?

Posted: Sun Feb 13, 2005 6:13 pm
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.

Posted: Mon Feb 14, 2005 2:46 pm
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

Posted: Mon Feb 14, 2005 8:14 pm
by Rookie One.pl
Yeah, it could be much more simple, but would you risk telefragging? :twisted: :P

Posted: Mon Feb 14, 2005 11:35 pm
by lizardkid
telefraggin wont matter much, if omeone is stupid enough to camp there to get telefragged i think they deserve it.

Posted: Tue Feb 15, 2005 12:09 am
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.

Posted: Tue Feb 15, 2005 10:29 am
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.

Posted: Tue Feb 15, 2005 12:27 pm
by Elgan
yeah i know, Thats why i wasnt sure if it wud be of help.

Posted: Tue Feb 15, 2005 9:03 pm
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:

Posted: Tue Feb 15, 2005 11:42 pm
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?

Posted: Wed Feb 16, 2005 7:32 am
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.

Posted: Wed Feb 16, 2005 8:04 am
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 .