Forum

> > CS2D > Scripts > How to creat unwalkable tiles?
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch How to creat unwalkable tiles?

6 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt How to creat unwalkable tiles?

if
User Off Offline

Zitieren
Like when player walks onto tile id 23,
the player returns 1.
Like tibia's water.
1
2
3
function walkable(x, y, safe, water)
	return tile(x, y, 'walkable') and (water or tile(x, y, 'frame') ~= 34) and not (safe and gettile(x, y).SAFE)
end
Don't know how it works.

---
And what is the code to make a text show on the screem without fading
1× editiert, zuletzt 16.09.11 19:06:10

alt Re: How to creat unwalkable tiles?

Cure Pikachu
User Off Offline

Zitieren
Maybe something like this, I never took the time to test it:
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
27
28
29
30
31
32
33
function checkwalkableframe(x,y,f)
	if tile(x,y,"walkable") and tile(x,y,"frame") == f then
		return 1
	end
	return 0
end

function initArray(m,v)
	local array = {}
	for i = 1, m do
		array[m] = v
	end
	return array
end

lastx = initArray(32,0)
lasty = initArray(32,0)

addhook("leave","resetvars")
function resetvars(i)
	lastx[i] = 0
	lasty[i] = 0
end

addhook("move","teleback")
function teleback(id,x,y)
	if checkwalkableframe(x,y,23) == 1 then
		parse("setpos "..id.." "..lastx[id].." "..lasty[id])
	else
		lastx[id] = x
		lasty[id] = y
	end
end
1× editiert, zuletzt 23.09.23 18:02:41

alt Re: How to creat unwalkable tiles?

if
User Off Offline

Zitieren
The last 4 th line has error.
table index is nil.

I just need to know how to make player return to his previous pos.
2× editiert, zuletzt 17.09.11 19:22:05
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht