Forum

> > CS2D > Scripts > If player on tile (id) then slap each secound
Forums overviewCS2D overview Scripts overviewLog in to reply

English If player on tile (id) then slap each secound

7 replies
To the start Previous 1 Next To the start

old If player on tile (id) then slap each secound

EndDead
User Off Offline

Quote
Lets say the id is 1 and that id is from the tile-set, actully i don't want to slap but i will change whatever.

Pretty simple, but I am still not perfect in lua

in other words:
Check what tile ID is the player on and do a command/parse every secound/always.


Thanks in advance...

old Re: If player on tile (id) then slap each secound

EndDead
User Off Offline

Quote
user DC has written
If you want to do it with scripting anyway: This is the stuff you should use:

• cs2d lua hook second Lua hook
• a for loop that loops over all living players (cs2d lua cmd player(0,"tableliving")) in that hook
• cs2d lua cmd player to get the tilex / tiley and health of the players
• cs2d lua cmd parse with cs2d cmd sethealth if the tilex and tiley values are the ones that you are looking


is that for all tiles that the ID of it 1? or only for the tilex and tiley, cause i need the whole tiles with that id to have the effect,
if you havn't got me, Go to the editor move your mouse on a tile from the tile selection it will get something like "tile 1#, floor - dirt",
see the number 1#? i ment that.. if you understod me, gimme an example so i dont do any errors,
thanks in advance.

omg has written
ust put hurt entities over the tiles; no need for scripting

I know almost every thing about mapping. i just wanted it on a script for a reason.
edited 1×, last 12.08.12 09:54:35 pm

old Re: If player on tile (id) then slap each secound

EndDead
User Off Offline

Quote
user DC has written
In that case you can use the command cs2d lua cmd tile(x,y,"frame") with x=cs2d lua cmd player(id,"tilex") and y=cs2d lua cmd player(id,"tiley")


Well thanks, but i also said:
EndDead has written
if you understod me, gimme an example so i dont do any errors


thanks in advance, and sorry for being noobish or something.

old Re: If player on tile (id) then slap each secound

EndDead
User Off Offline

Quote
user SkullzOrig has written
addhook ("walkover, phurt")
walkover == tile x, y
phurt [player .. id .. dmg]

Idk, something like that I guess.


I dont think it's correct.

Btw i found an example:
Water in tiba, when you step in it you move back.
thats fine but if you can add a secound hook and slap it would be better...
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview