Forum

> > CS2D > Scripts > Spawn Position
Forums overviewCS2D overview Scripts overviewLog in to reply

English Spawn Position

7 replies
To the start Previous 1 Next To the start

old Spawn Position

Marcell
Super User Off Offline

Quote
Hi!
Anyone can help in this script?
I just want to that after someone die... spawn at a specific point(example hospital) i want this for roleplay server

old Re: Spawn Position

Jynxxx
User Off Offline

Quote
1
2
3
4
5
6
7
x = (50) * 32 + 16 --Write numbers in tiles in ()
y = (50) * 32 + 16

addhook("spawn","_spawn")
function _spawn(id)
	parse("setpos "..id.." "..x.." "..y)
end

You can use this. But it doesn't really need the parenthesis.

old Re: Spawn Position

EP
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
x = 0
y = 0

dead = {}
for i = 1,32 do
	dead[i] = false
end

function _join(id)
	dead[id] = false
end
function _die(id)
	dead[id] = true
end
function _spawn(id)
	if dead[id] then
		parse("setpos "..id.." "..(x*32+16).." "..(y*32+16))
		dead[id] = not dead[id]
	end
end

hooks = {"join","die","spawn"}

for k,v in pairs(hooks) do
	addhook(v,"_"..v)
end

Change the X,Y coordinates (In tile scale) and it will teleport you there after you die. The script deactivates the dead boolean when spawning to not spawn you in the X,Y coordinates at the restartround.

old Re: Spawn Position

EP
User Off Offline

Quote
Go to the map editor and open your map. Then go to the place you want to set the X,Y coordinates in the script. There you will see X|Y position in the bottom of the screen. This is an example of how to get your coordinates: IMG:https://screenshooter.net/data/uploads/ty/dt/fttd.jpg

old Re: Spawn Position

MikuAuahDark
User Off Offline

Quote
1
2
3
4
5
6
7
hx = 0
hy = 0

addhook("die","lolie")
function loldie(id)
	timer(1,"parse","spawnplayer "..id.." "..(hx*32)+16.." "..(hy*32)+16)
end
Setup coordinates:
Spoiler >
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview