Forum

> > CS2D > Scripts > Unwalkable areas
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Unwalkable areas

4 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Unwalkable areas

xSkyLordx
User Off Offline

Zitieren
Hello Everybody, today i did area luas its working but i couldn't unwalkable area, Script is ready ,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
areas={}
areas[1]={x=0,y=0,x2=6,y2=6}

function area(x, y, x2, y2, px, py)
		return px>=x and px <= x2 and py >= y and py <= y2
end

addhook("movetile","detectarea")
function detectarea(id,xx,yy)
for k,v in ipairs(areas) do
if area(v.x,v.y,v.x2,v.y2,xx,yy) then
--Unwalk Script i need this one xD
msg("©255000000AREA")
end
end
end

alt Re: Unwalkable areas

Happy eyes
User Off Offline

Zitieren
I guess best way to do this is to make an array for every players position and setposition into player last position if he walked on unwalkable tile. Script would look like that:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
areas={}
areas[1]={x=0,y=0,x2=6,y2=6}

tile={}
for a=1,32 do
	tile[a]={x=0,y=0}
end

function area(x, y, x2, y2, px, py)
          return px>=x and px <= x2 and py >= y and py <= y2
end

addhook("movetile","detectarea")
function detectarea(id,xx,yy)
	for k,v in ipairs(areas) do
		if area(v.x,v.y,v.x2,v.y2,xx,yy) then
			parse('setpos '..id..' '..tile[id].x*32+16 ..' '..tile[id].y*32+16)
			msg("©255000000AREA")
			return 1
		end
	end
	tile[id].x=xx
	tile[id].y=yy
end
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht