Start Page » DragonScript Scripting Language » Behavior Elements: Quick and Easy Development » ECBehaviorAnchorElement
Behavior element behavior adding anchor element support.
Anchoring elements allows to locate elements in a GameWorld using a unique name set by the mapper. This is useful for game commands send by conversations scripts.
This behavior can be used only once on an element.
Element class properties have no prefix.
Sets the anchor name or empty string to not anchor.
<string name='anchorID'>Important Prop</string>
This behavior has no events
This behavior requires no other behaviors.
This behavior does not support optional behaviors.
This behavior does not require persistency.
Since DragonScript Module Version 1.0
This example defines an element for which the user can set the anchor name in the world editor. He can then locate the element in the parent GameWorld using this anchor name.
class MyElement extends BehaviorElementClass public func new() ECBehaviorAnchorElement.new(this) end end
Using element class supporting adding behaviors the behavior can be added like this:
<?xml version='1.0' encoding='UTF-8'?> <elementClass name='MyClass' class='GenericBehaviorElement'> <behavior type='ECBehaviorAnchorElement'/> </elementClass>