This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
tnhscript:purchaseitem [2009/02/05 23:28] 127.0.0.1 external edit |
tnhscript:purchaseitem [2010/11/23 00:11] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== PurchaseItem ====== | ====== PurchaseItem ====== | ||
- | When turned on, the Item object is duplicated and added to the $$Cart$$ container. If ``[[dromed:property:TrapQVar|Trap\Quest Var]]`` is set, then the purchase price of the item | + | Trap for managing a single item that can be bought from an in-game store. Uses ``[[dromed:link:ScriptParams]]`` links to coordinate with the item being purchased, the store script, and an optional cart to hold the purchased items. |
- | is added to the variable. On ``TurnOff``, the $$Item$$ is subtracted (by ``[[dromed:property:StackCount|Engine Features\Stack Count]]``) from the $$Cart$$ and the purchase price deducted from the quest variable. | + | |
- | On ``Reset``, it removes all of its items from the $$Cart$$. If the $$Item$$ is concrete, then the ``[[dromed:property:StackCount|Engine Features\Stack Count]]`` is the total inventory that is available, and each purchase is always one item. | + | The item controlled by this script is linked using a ``[[dromed:link:ScriptParams]]`` link of type $$Item$$. If the $$Item$$ is concrete, then the ``[[dromed:property:StackCount|Engine Features\Stack Count]]`` is the total inventory that is available, and each purchase is always one item. If the $$Item$$ is an archetype, then the store holds an unlimited supply and each purchase will give you the number of items in the ``[[dromed:property:StackCount|Engine Features\Stack Count]]``. |
- | You should link to the object with the [[ShoppingCart]] script using a ``ScriptParams`` link of type $$Store$$. If that link exists, the ``[[dromed:property:TrapQVar|Trap\Quest Var]]`` property will be read from the store object. | + | This trap is linked to the object with the [[ShoppingCart]] script using a ``[[dromed:link:ScriptParams]]`` link of type $$Store$$. The ``[[dromed:property:TrapQVar|Trap\Quest Var]]`` property will be read from the store object. If a separate container is being used for purchased item, link to it using a ``[[dromed:link:ScriptParams]]`` link of type $$Cart$$. Without a $$Cart$$ link, the $$Store$$ object is used. |
+ | |||
+ | When turned on, the $$Item$$ object is duplicated and added to the $$Cart$$ container. The purchase price of the item is added to the quest variable for the $$Store$$. On ``TurnOff``, the $$Item$$ is subtracted (by ``[[dromed:property:StackCount|Engine Features\Stack Count]]``) from the $$Cart$$ and the purchase price deducted from the quest variable. On ``Reset``, it removes all of its items from the $$Cart$$. | ||
^Inherits | [[GenericTrap]] | | ^Inherits | [[GenericTrap]] | | ||
Line 13: | Line 14: | ||
^Properties | ``[[dromed:property:TrapQVar|Trap\Quest Var]]``, ``[[dromed:property:StackCount|Engine Features\Stack Count]]`` | | ^Properties | ``[[dromed:property:TrapQVar|Trap\Quest Var]]``, ``[[dromed:property:StackCount|Engine Features\Stack Count]]`` | | ||
- | ---- | ||
- | [[index|Back to index]] | ||