Forum

> > CS2D > Scripts > Unwalkable areas
Forums overviewCS2D overview Scripts overviewLog in to reply

English Unwalkable areas

4 replies
To the start Previous 1 Next To the start

old Unwalkable areas

xSkyLordx
User Off Offline

Quote
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

old Re: Unwalkable areas

Happy eyes
User Off Offline

Quote
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
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview