SphereCommunity
Breakable Wall - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Breakable Wall (/Thread-Breakable-Wall)



Breakable Wall - Leonidas - 01-30-2015 05:08 PM

Hello, I am trying to create a wall that is breakable over time.

The player has to be in war mode and once they begin double clicking the wall it starts to break and finally remove. Can someone help me out?


RE: Breakable Wall - Jim - 01-30-2015 06:47 PM

i don't konw if it is ok for you, the following :

//difine a type "t_wall_breakable", the wall will be remove in 5 seconds after first-doubleclicking by player
[TYPEDEF t_wall_breakable]
ON=@DCLick
if !(<src.flags>&statf_war)
src.message peace mode?
return 1
endif
SRC.MESSAGE hitting the wall!
link=<src>
if (<timer>>=0)
return 1
else
timer=5
return 1
endif

ON=@Timer
link.message broken the wall!
remove
return 1

//attach the type to the item "TEVENTS=t_wall_breakable"
[ITEMDEF i_wall_stone_aged_breakable]
ID=i_wall_stone_aged
TEVENTS=t_wall_breakable

//maybe add the distance judgement after war mode judgement.
if (<distance> > 1)
src.message too far away!
return 1
endif


RE: Breakable Wall - Leonidas - 01-31-2015 08:06 AM

Thanks man! That'll do the job.

But is there a way so if the player stops double clicking the wall then the timer stops?

I'd like it so they have to double click the wall like 15 times for it to break. if thats possible


RE: Breakable Wall - azmanomer - 01-31-2015 09:02 AM

[TYPEDEF t_wall_breakable]
ON=@DCLick
if !(<src.flags>&statf_war)
src.message peace mode?
return 1
endif
SRC.MESSAGE hitting the wall!
src.tag0.breakingwall ++
if (<tag0.breakingwall>==15)
remove
src.message broken the wall!
tag.breakingwall
return 1
else
src.message <eval 15-<src.dtag.breakingwall>> left to breake the wall!!
endif


RE: Breakable Wall - XuN - 01-31-2015 07:27 PM

You should think about adding a time check or people with Razor/Assist/Injection/etc will break walls in less than 1second


RE: Breakable Wall - Leonidas - 02-01-2015 06:55 AM

Will do, thank you guys!