I need help. When a player moves over a certain tile frame.. lets say frame 111 or something.. Can anyone post a script or make one for me that when a player moves over a tile he gets damaged for every second he stays on it?
Forum
CS2D Scripts Tile Damage.Tile Damage.
6 replies 1
I need help. When a player moves over a certain tile frame.. lets say frame 111 or something.. Can anyone post a script or make one for me that when a player moves over a tile he gets damaged for every second he stays on it?
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
tile_x = 32 tile_y 785 addhook("second","check_tile") function check_tile() 	for i=1,32 do 		if( player(i,"exists")) then 			if(player(i,"tilex")=tile_x and player(i,"tiley")=tile_y) then 				parse("slap "..i) 			end 		end 	end end
Just try using this as reference:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
TileMaterial = { [0] = "Floor: Soundless", [1] = "Wall", [2] = "Obstacle", [3] = "Wall / No Shadow", [4] = "Obstacle / No Shadow", [10] = "Floor: Dirt", [11] = "Floor: Snow", [12] = "Floor: Step", [13] = "Floor: Tile", [14] = "Floor: Water", [15] = "Floor: Metal", [16] = "Floor: Wood", [50] = "Deadly: Normal", [51] = "Deadly: Explosion", [52] = "Deadly: Toxic", [53] = "Deadly: Abyss" } addhook("movetile","MoveTileHook") function MoveTileHook(ID,X,Y) parse('hudtxt2 '..ID..' 2 "©102255102TILE: '..TileMaterial[tile(X,Y,"property")]..'" 320 220 1') end
1
2
3
2
3
function on_tile(tile, id) 	return tile(player(id, 'tilex'), player(id, 'tiley'), 'frame') == tile end
use this code to check a frame u are standing on
like u said 111
1
2
3
2
3
if on_tile(id, 111) then msg('You on tile 111 WE ALL GONNA DIEE!!') end
Use it
Edit: Ahh forgot about every second damage
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
addhook('second', 'sec') function sec() for id = 1, 32 do if on_tile(111, id) then parse('slap '.. id) end end end
Easy and fast way.
You could go for an easy script like this...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
tile_hurt[0]=1 tile_hurt[43]=100 addhook("movetile","_movetile") addhook("second","_second") function _movetile(id,x,y) 	if tile_hurt[tile(x,y,"frame")]~=nil then 		parse("sethealth "..id.." "..player(id, "health")-tile_hurt[tile(x,y,"frame")]) 	end end function _second() 	for _,id in player(0,"tableliving") do 		if tile_hurt[tile(player(id,"tilex"),player(id,"tiley")]~=nil then 		parse("sethealth "..id.." "..player(id, "health")-tile_hurt[tile(player(id,"tilex"),player(id,"tiley"),"frame")]) 		end 	end end
What are you making?
Its a Tibia Script Lol. cZ Clan
Thank you guys for helping me out !!
1