13lade619
is now a game developer :)
- Reaction score
- 399
Version 1.2
A revamping of the original ItemStruct
Requirements: (Most have their own, check them individually.)
-NewGen
-Latest JassHelper
-AIDS
-Damage
-GT
-TimerUtils
-Status
Documentation.
Sample
Updates
-Initial Release : February 26, 2010, 03:28 PM
-1.1 : February 27, 12:19 PM
>> Used Set/GetItemUserData() instead of hashtables.
-1.2 : Feb. 27, 8:28 PM
>> Optimized Event-response system.
>> Easier Implementation, no more additional textmacros.
A revamping of the original ItemStruct
What's not yet finished:
Code for Recipe Making.. i.e:
count number of items of class ()
count number of items of type ()
if unit has items of type and number ()
do this for every item of type ()
do this for every item of class ()
Requirements: (Most have their own, check them individually.)
-NewGen
-Latest JassHelper
-AIDS
-Damage
-GT
-TimerUtils
-Status
Documentation.
JASS:
.
_____ _ __ _ _ ____ ___
\_ \| |_ ___ _ __ ___ / _\| |_ _ __ _ _ ___ | |_ |___ \ / _ \
/ /\/| __|/ _ \| 039;_ ` _ \ \ \ | __|| 039;__|| | | | / __|| __| __) | | | | |
/\/ /_ | |_| __/| | | | | |_\ \| |_ | | | |_| || (__ | |_ / __/ _| |_| |
\____/ \__|\___||_| |_| |_|\__/ \__||_| \__,_| \___| \__| |_____|(_)\___/ 1.2.1
< Original BuffStruct/ItemStruct Concept and Coding by Jesus4Lyf>
< ItemStruct Mod for BuffStruct by 13lade619>
What is ItemStruct 2.0?
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
ItemStruct 2.0 is designed for rapid item development for maps. It is designed to automatically
create the needed object data to reduce hassle. You can run functions on acquisition and dropping
of said items. You can also have event-responses associated with the item039;s holder.
What ItemStruct 2.0 will not automatically do for you:
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
1. You need save and reload the map for the object data to be created.
2. You will need to manually put the items to their respective shops via the Object Editor.
How to implement?
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Requires : AIDS, Damage, GT, optional TimerUtils
1. Create a new trigger named ItemStructHeader. Go to 039;Edit -> Convert
to Custom Text039;, and replace everything that039;s there with this script.
2. Create a new trigger immediately after ItemStructHeader, named
ItemStructFooter. go to 039;Edit -> Convert to Custom Text039;, and replace
everything that039;s there with the script from the ItemStructFooter.
3. To make an ItemStruct, make a new trigger between ItemStructHeader
and ItemStructFooter, and use the template indicated on the later part of this documentation.
Changes from last version (1.2.1).
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
- Added protection for items not created by the system. I found out that these would randomly fire
rogue drop events and sometimes would result in negative stats.
//=========================================================================================================
// Start Sample
//
//! runtextmacro ItemType("Sword")
//! runtextmacro SetItemClass("HAND")
//! runtextmacro SetItemXY("1","2")
//! runtextmacro SetItemIcon("ReplaceableTextures\\CommandButtons\\BTNSteelMelee.blp")
//! runtextmacro SetItemModel("Objects\\InventoryItems\\TreasureChest\\treasurechest.mdl")
//! runtextmacro SetItemCost("500")
//! runtextmacro SetItemDesc("Buy this awesome sword.")
//! runtextmacro SetItemTip("You now have this cool sword.")
//! runtextmacro SetItemName("Sword")
//! runtextmacro SetItemAbil("ACfl")
//! runtextmacro SetItemCat("Artifact")
//! runtextmacro SetItemCharge("3","1")
//! runtextmacro SetItemStock("3","1","X")
//! runtextmacro ItemStruct()
method onAnySpellCast takes nothing returns nothing
if GetSpellAbilityId() == this.itemAbil then
call BJDebugMsg("itemspell")
else
call BJDebugMsg("anyspell")
endif
endmethod
method onDamageReceived takes nothing returns nothing
if Damage_IsSpell() then
call BJDebugMsg("magic")
elseif Damage_IsAttack() then
call BJDebugMsg("attack")
endif
endmethod
method onDamageDealt takes nothing returns nothing
if Damage_IsSpell() then
call BJDebugMsg("mtk")
elseif Damage_IsAttack() then
call BJDebugMsg("atk")
endif
endmethod
method onAcquire takes nothing returns nothing
call Status[this.unit].modDamageBonus(10)
endmethod
method onDrop takes nothing returns nothing
call Status[this.unit].modDamageBonus(-10)
endmethod
//! runtextmacro EndItem()
//
// End Sample
//=========================================================================================================
__ _
/ _\ _ _ _ __ | |_ __ _ __ __
\ \ | | | || 039;_ \ | __|/ _` |\ \/ /
_\ \| |_| || | | || |_| (_| | > <
\__/ \__, ||_| |_| \__|\__,_|/_/\_\ for Objectdata and others.
|___/
//! runtextmacro ItemType("Identifier")
This must contain a 1 word identifier for the buff. This is
used to create new instances with Identifier.create(unit)
//! runtextmacro SetItemClass("CLAS")
There are 4 predefined Classifications of ItemStructs (can be used as condtions later.
They are ACCS, BOOT, HAND and BODY.
//! runtextmacro SetItemXY("X","Y")
^Positioning on shops.
//! runtextmacro SetItemIcon("path")
^icon on shops.
//! runtextmacro SetItemModel("path")
^model when dropped.
//! runtextmacro SetItemCost("gold")
^Gold cost.
//! runtextmacro SetItemDesc("text")
^Text seen on shops.
//! runtextmacro SetItemTip("text")
^Text seen the inventory.
//! runtextmacro SetItemName("Name")
^Name seen in-game.
//! runtextmacro SetItemAbil("RawCode")
(Optional)
Raw code of the ACTIVE ability used by item.
Do not run this if your item does not have an ability.
//! runtextmacro SetItemCat("Classification")
(Optional)
In-game item classification of the item, defaults to Permanent.
Permanent, Charged, Power Up, Artifact, Purchasable, Campaign or Miscellaneous.
//! runtextmacro SetItemCharge("NumberofCharges","DoesExpire")
(Optional)
Setup a charged item.
Does expire takes 0 for false
1 for true
//! runtextmacro SetItemStock("Max","Replenish","Hotkey")
(Optional)
Setup the stock properties.
Defaults 1 max, 1 sec replenish and no Hotkey.
You can leave the Hotkey blank ("").
//! runtextmacro ItemStruct()
This denotes the end of the object data configuration for an item,
and the start of the struct that will be instanciated for
each instance of an item.
You may use the optional event response methods here, which
are listed later.
//! runtextmacro EndItem()
This denotes the end of the ItemStruct.
_ _ _
/\/\ ___| |_| |__ ___ __| |___
/ \ / _ \ __| 039;_ \ / _ \ / _` / __|
/ /\/\ \ __/ |_| | | | (_) | (_| \__ \
\/ \/\___|\__|_| |_|\___/ \__,_|___/
CREATE / DESTROY METHODS
In Order of Execution,
use this.unit to refer to the itemholder.
method onCreate takes nothing returns nothing
^Fires on struct creation.
method onAcquire takes nothing returns nothing
^Fires when the item is acquired by unit.
method onDrop takes nothing returns nothing
^Fires when the item is dropped/sold.
method preDestroy takes nothing returns nothing
^Fires just before the ItemStruct is destroyed.
EVENT RESPONSE METHODS
method onAnySpellCast takes nothing returns nothing
Fires when the itemholder (this.unit) casts any ability.
You can check if the ability that was casted was this item039;s ability
by using:
if GetSpellAbilityId() == this.itemAbil
method onDamageReceived takes nothing returns nothing
Fires when the itemholder takes damage.
(Optional if you use Damage System)
You can use the Damage System to detect damage types.
Damage_isPhysical()
Damage_isSpell()
Damage_isAttack()
method onDamageDealt takes nothing returns nothing
Fires when the itemholder deals damage.
(Optional if you use Damage System)
You can use the Damage System to detect damage types.
Damage_isPhysical()
Damage_isSpell()
Damage_isAttack()
Sample
JASS:
//! runtextmacro ItemType("Sword")
//! runtextmacro SetItemClass("HAND")
//! runtextmacro SetItemXY("1","2")
//! runtextmacro SetItemIcon("ReplaceableTextures\\CommandButtons\\BTNSteelMelee.blp")
//! runtextmacro SetItemModel("Objects\\InventoryItems\\TreasureChest\\treasurechest.mdl")
//! runtextmacro SetItemCost("5")
//! runtextmacro SetItemDesc("Buy the awesome SWORD")
//! runtextmacro SetItemTip("You now have this cool sword.")
//! runtextmacro SetItemName("Sword")
//! runtextmacro SetItemAbil("ACfl")
//! runtextmacro SetItemCat("Artifact")
//! runtextmacro SetItemCharge("3","1")
//! runtextmacro SetItemStock("3","1","X")
//! runtextmacro ItemStruct()
method onAnySpellCast takes nothing returns nothing
//casting events.. for the item or for any cast.
//Event Responses for ability casts work here.
if GetSpellAbilityId() == this.itemAbil then
call BJDebugMsg("itemspell")
else
call BJDebugMsg("anyspell")
endif
endmethod
method onDamageReceived takes nothing returns nothing
//can be used for defense items.
//Event Responses for receiving damage work here.
if Damage_IsSpell() then
call BJDebugMsg("magic")
elseif Damage_IsAttack() then
call BJDebugMsg("attack")
endif
endmethod
method onDamageDealt takes nothing returns nothing
//can replicate orb effects.
//Event Responses for dealing damage work here.
if Damage_IsSpell() then
call BJDebugMsg("mtk")
elseif Damage_IsAttack() then
call BJDebugMsg("atk")
endif
endmethod
method onAcquire takes nothing returns nothing
//add bonuses, refer to this.unit
call Status[this.unit].modDamageBonus(50)
endmethod
method onDrop takes nothing returns nothing
//remove bonuses, refer to this.unit
call Status[this.unit].modDamageBonus(-50)
endmethod
//! runtextmacro EndItem()
Updates
-Initial Release : February 26, 2010, 03:28 PM
-1.1 : February 27, 12:19 PM
>> Used Set/GetItemUserData() instead of hashtables.
-1.2 : Feb. 27, 8:28 PM
>> Optimized Event-response system.
>> Easier Implementation, no more additional textmacros.