Simple Constructible Objectives
This tutorial will teach you how to make an entity that is destructable by one team and reconstructible by the other in W:ET.
fence { spawn { } built final { } decayed final { } death { } }The spawn{} section sets the attributes of the fence, the built final{} section executes when the fence is built, decayed final{} executes when the construction times out, and death{} executes when the fence is destroyed.
spawn { wait 200 constructible_class 2 constructible_constructxpbonus 1 constructible_destructxpbonus 1 setstate fence_materials invisible }The first line of the spawn section is to allow the fence entity to spawn before trying to set attributes. The second line sets the fence to be destroyable by a satchel charge (Change it from '2' to '3' to make it dynamite only) and the third line gives how much XP one gets for constructing it, while the fourth line is how much XP one gets for destroying it. The fifth line sets the materials used to build the fence to be invisible since the fence starts built.
built final { setstate fence default setstate fence_materials invisible } decayed final { setstate fence_materials default setstate fence invisible }Here, when the fence is built ( built final{} ), the fence is set to 'default', which means it is now visible. Also, the materials used to build it are hidden, since the fence was built using those materials. When the construction times out ( decayed final{} ), the materials are set to a visible state, and the fence goes back to being invisible.
death { wm_announce "The fence has been destroyed!" setstate fence_materials default }In this section, which is executed when the fence is destroyed, announces ( wm_announce "" ) that the fence has been destroyed, and makes the materials that are used to build the fence visible once again.