Forum

> > CS2D > Scripts > Unbreakable Walls
Forums overviewCS2D overview Scripts overviewLog in to reply

English Unbreakable Walls

13 replies
To the start Previous 1 Next To the start

old Unbreakable Walls

Kirito2K
User Off Offline

Quote
Hi all,
I want a script that make the wall unbreakable if the player build it in a custom tile ..

Example :
IMG:https://dl-web.dropbox.com/get/mc_happytown%20V.1.2.4_00000.jpg?_subject_uid=206196589&w=AABhoF7pA7COyxZP-9gh_65jPxiev0Ee4z8QKgBN21NEDQ


You see the yellow tiles? ,when some player build a wall on them the wall won;t break , i mean if i attack him he won't get hurt or in another way i mean "Unbreakable wall" , so i hope one of us users can help me .

Edited ..
edited 1×, last 23.12.14 03:41:32 am

old Re: Unbreakable Walls

Ajmin
User Off Offline

Quote
1
2
3
4
5
6
addhook("objectdamage","ob")
function ob(od,dmg,id)
if object(od,"type")==3 then  ----object type 3 is Wall I !
return 1
end
end

This script is for unbreakable wall I.

Hope i helped
edited 1×, last 22.12.14 05:59:11 pm

old Re: Unbreakable Walls

_Yank
User Off Offline

Quote
1
2
3
4
5
6
7
special_tile = 2 -- change it to the tile frame number in the tileset
addhook("objectdamage","___")
function ___(oid, damage, id)
	if tile(object(oid,"tilex"),player(oid,"tiley"),"frame") == special_tile then
		return 1
	end
end

old Re: Unbreakable Walls

DC
Admin Off Offline

Quote
@user _Yank: You're checking the x position of the object but the y position of the player (with the object id). Both should be the object position.

old Re: Unbreakable Walls

eledah
User Off Offline

Quote
1
2
3
4
5
6
7
8
special_tile_x = {1, 2, 3}
special_tile_y = {1, 2, 1}
addhook("objectdamage", "_objectdamage")
function _objectdamage(objectID)
     for i = 1, #special_tile_x do
          if (object(objectID, 'x') / 32) == special_tile_x[i] and (object(objectID, 'y') / 32) == special_tile_y[i] then return 1 end
     end
end
The one that user _Yank posted works with tileframe, this one works with coordinations

old Re: Unbreakable Walls

_Yank
User Off Offline

Quote
user DC has written
@user _Yank: You're checking the x position of the object but the y position of the player (with the object id). Both should be the object position.

Oh yeah, I forgot do change it as I firstly wrote player.

@user Kirito2K: Use @user eledah one if you can't use mine.

old Re: Unbreakable Walls

Kirito2K
User Off Offline

Quote
I dont know how to use it , give me example please ..
edited 1×, last 23.12.14 03:44:22 am

old Re: Unbreakable Walls

eledah
User Off Offline

Quote
If you want to use user _Yank's version
1-Open CS2D
2-Map editor
3-Select your tileset
4-Hold your mouse on your wanted tile, it will give you a number(e.g Tile#123), place in here
1
special_tile = 123

And for mine
1-Open CS2D
2-Map editor
3-Load your map
4-Hold your mouse on your wanted tile in the map you want to have this script enabled on, it will show its coordinations(e.g Tile Position 55 | 22). Put the 1st number in special_tile_x and the second one in special_tile_y
1
2
special_tile_x = {55}
special_tile_y = {22}
And if you want to add a few more tiles, just do the same
1
2
special_tile_x = {55, 33, 11}
special_tile_y = {22, 44, 99}
-This will affect tiles (55,22), (33,44), (11,99)-

old Re: Unbreakable Walls

_Yank
User Off Offline

Quote
1
2
3
4
5
6
7
special_tile = 2 -- change it to the tile frame number in the tileset
addhook("objectdamage","___")
function ___(oid, damage, id)
     if tile(object(oid,"tilex"), object(oid,"tiley"),"frame") == special_tile and object(oid,"type") == 5 then
          return 1
     end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview