{{tag>dragonscript behavior}} [[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[dragengine:modules:dragonscript:abstractions|Abstraction Layers: How you want to build your Game]] >> [[dragengine:modules:dragonscript:behavior_elements|Behavior Elements]] >> **ECBehaviorStashable** * [[behaviors_use_cases|Behaviors Explained: By Use-Case]] * [[behaviors_a_to_z|Behaviors Explained: From A to Z]] ====== ECBehaviorStashable ====== Behavior element behavior adding support for elements to be placed in [[behavior_inventory|ECBehaviorInventory]]. ====== Instance Counts ====== This behavior can be used only once on an element. ====== Element Class Properties ====== Element class properties have the prefix ''stashable.'' . ===== image ===== Set image to display in inventory screens. * Full name: ''stashable.image'' * Type: string * Default Value: empty string * Expected File Type: ''*.webp'', ''*.png'', ''*.jpg'' (all image modules) * Example (*.deeclass) inventory.webp ===== video ===== Set video to display in inventory screens. * Full name: ''stashable.video'' * Type: string * Default Value: empty string * Expected File Type: ''*.webm'' (all video modules) * Example (*.deeclass) inventory.webm ===== name ===== Set name to display in inventory screens. * Full name: ''stashable.name'' * Type: unicode string * Default Value: empty string * Example (*.deeclass) Cool Tool ===== description ===== Set description to display in inventory screens. * Full name: ''stashable.description'' * Type: unicode string * Default Value: empty string * Example (*.deeclass) A cool tool every adventurer needs. ====== Events ====== ===== addedToInventory ===== Stashable has been added to inventory. ===== removedFromInventory ===== Stashable has been remove from inventory. ====== Required Behaviors ====== This behavior requires no other behaviors. ====== Optional Behaviors ====== This behavior does not support optional behaviors. ====== Persistency ====== This behavior does not required element class to be persistable (setPersistable). ====== API Documentation ====== #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorStashable.html,ECBehaviorStashable~@#. Since DragonScript Module Version ''1.0'' ====== Use Cases ====== * Allow element to be placed in an elment supporting [[behavior_inventory|ECBehaviorInventor]]. ====== Element Class Example ====== This example defines an element which contains a resources. class MyElement extends BehaviorElementClass public var ECBehaviorStashable stashable func new() stashable = ECBehaviorStashable.new(this) end end ====== Behavior Factory ====== Using element class supporting adding behaviors the behavior can be added like this: Cool Tool ====== Live Examples ====== * [[https://github.com/LordOfDragons/deexamples|DEExamples Repository]]