Forum

> > CS2D > Scripts > Tile Damage.
Forums overviewCS2D overview Scripts overviewLog in to reply

English Tile Damage.

6 replies
To the start Previous 1 Next To the start

old Tile Damage.

iCe4147
User Off Offline

Quote
Hey Guys,

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?

old Re: Tile Damage.

DannyDeth
User Off Offline

Quote
1
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
However, you cannot use mutliple tiles with this script. Someone else can improve it, if they like. Imma go continue my garden work.

old Re: Tile Damage.

RAVENOUS
BANNED Off Offline

Quote
you can't use a certain frame, but you can use the material of it, like wood, tile, stone, deadly, water etc.

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
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
More >

old Re: Tile Damage.

Infinite Rain
Reviewer Off Offline

Quote
1
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
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
addhook('second', 'sec')
function sec()
 for id = 1, 32 do
  if on_tile(111, id) then
   parse('slap '.. id)
  end
 end
end

old Re: Tile Damage.

Apache uwu
User Off Offline

Quote
I'm pretty sure he wants it dynamically that's why it's in the scripts section.

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
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?

old Re: Tile Damage.

iCe4147
User Off Offline

Quote
@Textual Context

Its a Tibia Script Lol. cZ Clan

Thank you guys for helping me out !!
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview