Weapon Equip System

XxShadyxX

I abused the rep system.
Reaction score
81
I'm making a Equip System.
I am still new to Jass and vJass but know enough to start this. Anyway I have this:
JASS:
scope WEInit initializer Init

    private struct equip
    
        integer eq      //ItemType rawcode
        integer req     //Item Requirement Level 
        integer icon    //Item Icon
        integer stat    //Item Ability
        integer type    //Item Attack/Defense type
        integer db      //Item Defense Bonus
        integer ab      //Item Attack Bonus
        integer asb     //Item Strength Bonus
        integer aab     //Item Agility Bonus
        integer aib     //Item intelligence Bonus
        integer ms      //Item Movement Bonus
        integer as      //Item Attack Speed Bonus
        integer hp      //Item Health Bonus
        integer mp      //Item Mana Bonus
        integer slot    //Item Slot

    endstruct
    

    
    private function Init takes nothing returns nothing
        // _____________________________________
        local equip RecruitsSword=equip.create()
        local equip RecruitsArmor=equip.create()
        // Recruits Sword
        set RecruitsSword.req=5
        set RecruitsSword.eq='i000'
        set RecruitsSword.icon='a001'
        set RecruitsSword.stat='a002'
        set RecruitsSword.type='a003'
        set RecruitsSword.db=0
        set RecruitsSword.asb=5
        set RecruitsSword.slot=1
        //______________________________________
        // Recruits Armor
        set RecruitsArmor.req=5
        set RecruitsArmor.eq='i001'
        set RecruitsArmor.icon='a004'
        set RecruitsArmor.stat='a005'
        set RecruitsArmor.type='a006'
        set RecruitsArmor.db=100
        set RecruitsArmor.slot=3
        //______________________________________
        
    endfunction

endscope


Now I need to add the information to a hashtable and be able to load it in the system. My questions are:

a) How should I go along doing this?
b) Is using a Stack the best method?
 

XxShadyxX

I abused the rep system.
Reaction score
81
A system so I can set all the info I need for a certain item, like what stats it has, then be able to have a Event where if a item is used, and it goes through the system finds the right one, and adds the stats.
And another part of the system for when a ability is cast (The system adds a ability on a seperate Unit I will have that will be for equipment that will show a Icon of the item that is equiped... etc...) on the equipment Unit and it unequips the item and the stats from the Hero.
 

Nestharus

o-o
Reaction score
84
I suggest a class diagram first so you can identify your problem and be able to figure out exactly where your methods and types need to go.

For example, can a weapon of no type and shape have an attack? no ^_^, meaning the attacks would go into the weapons themselves (unless weapons share the same type of attack).

Put data where it belongs (even if there's no info in it, it's still the wrong spot ^_^).

Understanding how to do proper OOP is key in this ;).
 

XxShadyxX

I abused the rep system.
Reaction score
81
OOP?
I'm sorry I have done this in GUI and its time for me to make it in vJass.
The GUI version I guess is a GUI version of a stack
So I need to have to have everything in there? Also, how do I make it so I can just do a line of Custom script and set everything in 1 line, and then a system can add it to the hashtable to the system could use?
 

Nestharus

o-o
Reaction score
84
1. Talking about the actual design of the equipment system in vJASS ;p. You're using vJASS, so use structs ;O, not stacks.

Ok, you have a weapon object

What can a weapon do? What does a weapon have

Now, you derive things from it, weapon types

What do weapon types have? What can weapon types do?

Now you go further down


Only put stuff in that class if that class actually uses it =). If you're thinking hard, then it's probably wrong ;p. Just do what comes to mind first ;).

Weapon type has a name, the weapon type
Maybe it has a special equation

Weapons really don't have anything ;p

A sword has an attack ;o, weight maybe, who knows what else ;).

That's the gist to OOP : p.
 

XxShadyxX

I abused the rep system.
Reaction score
81
I already have a Unit Properties system I am using, which I will just add the Call function at the end of the system. Anyway I told you what I want to achieve above. Did you read it?
 

Jesus4Lyf

Good Idea™
Reaction score
397
>Anyway I told you what I want to achieve above. Did you read it?
Of course, how else can I ask this:
What functions are you trying to make? GetItemAttackBonus? Use [LJASS]SetItemUserData[/LJASS] or write an indexing system first... :p
Because you didn't distinguish between
JASS:
function GetItemAttackBonus item i returns real

and
JASS:
function GetItemTypeAttackBonus integer itemType returns real

for which I would use completely different attachment methods. Probably neither of which are a hashtable. If you meant the first, that still doesn't tell me if you want each item to have its own stats, or if that is effectively like a wrapper for GetItemTypeAttackBonus, that just passes in the given item's type id...

Please, let us know what you're trying to achieve. Is this just to get object editor data for a type, or is this to make a system that gives each individual item its own attack damage and stuff... because the latter and the former are totally dissimilar.

>I already have a Unit Properties system I am using, which I will just add the Call function at the end of the system.
I don't know what that is. :)
 

XxShadyxX

I abused the rep system.
Reaction score
81
I am not attaching stats to the Item itself. The item is just a dummy item. But the integers I need for another system i am using.

I just want the system to find which item was being used, Take away the item, add the ability to the equipment unit dummy and add the attachment ability to the hero. And the variables will be for the other system, but the slot will be to check which slot on the hero the certain item falls under.

I am just trying to find out how to add all the item types that will trigger the system and their stats (the integers) into some kind of data thing so I can pull from it in the System and add the stats that that Item has set to it (The integers and by using the other system)
 

Jesus4Lyf

Good Idea™
Reaction score
397
Sounds like this. Pretty sure the code at the bottom of the first page would handle that fine.

Alternatively, what about CustomValue and attaching using an array? I think custom values for items are defined for one item type, so this would be ideal?
See what you think.

I recommend the custom value stuff if it works. :)
 

XxShadyxX

I abused the rep system.
Reaction score
81
I don't really get what that does, and I'm already using customvalue of items in a different system. Anyway, could you explain what is going on in the code you linked me to?
 

Jesus4Lyf

Good Idea™
Reaction score
397
For each rawcode (item type, or unit type or ability or whatever) you use, it gives you a unique integer based off it. So it's a hashing algorithm. Storing a struct in a hashtable is a little quicker, but the code I linked is written already...

Hey: try this.
JASS:
struct RawcodeData // Written by Jesus4Lyf
    // Members
    real bonus
    
    // Leave this stuff...
    private static hashtable hash=InitHashtable()
    static method operator [] takes integer rawcode returns thistype
        return thistype(LoadInteger(thistype.hash,0,rawcode))
    endmethod
    static method create takes integer rawcode returns thistype
        local thistype this=thistype.allocate()
        call SaveInteger(thistype.hash,0,rawcode,this)
        return this
    endmethod
endstruct

// Example:
function OnInit takes nothing returns nothing
    local RawcodeData myItemData=RawcodeData.create('I00X')
    set myItemData.bonus=0.15
endfunction

function GetBonus takes integer rawcode returns real
    return RawcodeData[rawcode].bonus // if you do a bunch of these, store RawcodeData[rawcode] in a local
endfunction
 

XxShadyxX

I abused the rep system.
Reaction score
81
Um, ok so it adds that stuff to a hashtable? So how do I access it to check which item was used? And then add integers that I want to a different system depending on the item. So in a way indexing items. But please remember I'm very still new to vJass
 

Jesus4Lyf

Good Idea™
Reaction score
397
>So in a way indexing items.
JASS:
// This stuff is what values you attach to each item.
    // Members
    real bonus

>So in a way indexing items.
RawcodeData.create(itemtype) will index an item type.

>So how do I access it to check which item was used?
[LJASS]GetManipulatedItem()[/LJASS]? Why do you need a system to see which item was used?
When I said:

>Is this just to get... data for a type, or is this to make a system that gives each individual item its own attack damage and stuff... because the latter and the former are totally dissimilar.

You responded:

>I am just trying to find out how to add all the item types that will trigger the system and their stats (the integers) into some kind of data thing so I can pull from it in the System and add the stats that that Item has set to it (The integers and by using the other system)

So I assumed you want to attach to item types.

When I asked:

>What functions are you trying to make? GetItemAttackBonus?

You responded:

>I told you what I want to achieve above. Did you read it?

If you want to attach data to items (not item types), you clearly STILL HAVEN'T told us what you want to achieve. Please tell us exactly what you are trying to achieve. As in:
Um, ok so it adds that stuff to a hashtable? So how do I access it to check which item was used? And then add integers that I want to a different system depending on the item. So in a way indexing items.
--> something like -->
I want to attach the amount of damage an item should give to an item type, so that when an item is picked up by a unit, I can load the amount of damage it should add and pass that value into another system which will add the bonus.
Because I have no idea what you're talking about (until you are specific about what you are trying to achieve).
 

XxShadyxX

I abused the rep system.
Reaction score
81
Let me show you my GuI system, And what I want is to convert this system into a vJass system.

The Init System
Trigger:
  • WSystemInt
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Equip_Integer = (Equip_Integer + 1)
      • Set Equip_Catalog[Equip_Integer] = |cffFDC689Recruits Light Chain Armor|r
      • Set Item_Req[Equip_Integer] = 1
      • Set Equip_Stat[Equip_Integer] = ABI Starting Armor
      • Set Equip_Icon[Equip_Integer] = BTN Recruits Light Chain Armor
      • Set StatType[Equip_Integer] = Chain
      • Set ItemDefenseBonus[Equip_Integer] = 100.00
      • Set Chest[Equip_Integer] = True
      • -------- --------
      • Set Equip_Integer = (Equip_Integer + 1)
      • Set Equip_Catalog[Equip_Integer] = |cfffdc689Heavy Plate Armor of the King|r
      • Set Item_Req[Equip_Integer] = 1
      • Set Equip_Stat[Equip_Integer] = ABI Starting Armor
      • Set Equip_Icon[Equip_Integer] = BTN Heavy Chain Armor of the King
      • Set StatType[Equip_Integer] = Chain
      • Set ItemDefenseBonus[Equip_Integer] = 25000.00
      • Set Chest[Equip_Integer] = True
      • -------- --------
      • Set Equip_Integer = (Equip_Integer + 1)
      • Set Equip_Catalog[Equip_Integer] = |cffFDC689Recruits Light Sword|r
      • Set Item_Req[Equip_Integer] = 1
      • Set Equip_Stat[Equip_Integer] = ABI Starting Sword
      • Set Equip_Icon[Equip_Integer] = BTN Starting Sword
      • Set StatType[Equip_Integer] = Normal
      • Set Main[Equip_Integer] = True
      • Set Class_Type[Equip_Integer] = |cffff0000Warrior|r
      • -------- --------
      • Set Equip_Integer = (Equip_Integer + 1)
      • Set Equip_Catalog[Equip_Integer] = |cffFDC689Recruits Shield|r
      • Set Item_Req[Equip_Integer] = 1
      • Set Equip_Stat[Equip_Integer] = ABI Recruits Shield
      • Set Equip_Icon[Equip_Integer] = BTN Recruits Shield
      • Set StatType[Equip_Integer] = Recruits Shield Block (Item)
      • Set Off[Equip_Integer] = True
      • -------- --------
      • Set Equip_Integer = (Equip_Integer + 1)
      • Set Equip_Catalog[Equip_Integer] = |cffFDC689Recruits Light Shortbow|r
      • Set Item_Req[Equip_Integer] = 1
      • Set Equip_Stat[Equip_Integer] = ABI Recruits Bow
      • Set Equip_Icon[Equip_Integer] = BTN Recruits Bow
      • Set StatType[Equip_Integer] = Piercing
      • Set Main[Equip_Integer] = True
      • Set Class_Type[Equip_Integer] = |cffff8000Ranger|r

The equip part of the system:
Trigger:
  • WSystemEquip
    • Events
      • Unit - A unit Uses an item
    • Conditions
    • Actions
      • Do Multiple ActionsFor each (Integer A) from 1 to Equip_Integer, do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item being manipulated)) Equal to (==) Equip_Catalog[(Integer A)]
              • (Hero level of (Triggering unit)) Greater than or equal to (>=) Item_Req[(Integer A)]
            • Then - Actions
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Main[(Integer A)] Equal to (==) True
                • Then - Actions
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Class_Type[(Integer A)] Equal to (==) (Unit-type of (Triggering unit))
                    • Then - Actions
                      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • MainSlotOpen[(Player number of (Owner of (Triggering unit)))] Equal to (==) False
                        • Then - Actions
                          • Unit - Remove Unarmed from (Triggering unit)
                          • Unit - Add StatType[(Integer A)] to (Triggering unit)
                          • Set PlayerStatMain[(Player number of (Owner of (Triggering unit)))] = StatType[(Integer A)]
                          • Unit - Remove Mainhand from Equipment[(Player number of (Owner of (Triggering unit)))]
                          • Set Item_Type_Main[(Player number of (Owner of (Triggering unit)))] = (Item-type of (Item being manipulated))
                          • Unit - Add Equip_Stat[(Integer A)] to PlayerUnits[(Player number of (Owner of (Triggering unit)))]
                          • Set Main_Stat[(Player number of (Owner of (Triggering unit)))] = Equip_Stat[(Integer A)]
                          • Unit - Add Equip_Icon[(Integer A)] to Equipment[(Player number of (Owner of (Triggering unit)))]
                          • Set Main_Icon[(Player number of (Owner of (Triggering unit)))] = Equip_Icon[(Integer A)]
                          • Item - Remove (Item being manipulated)
                          • Set MainSlotOpen[(Player number of (Owner of (Triggering unit)))] = True
                        • Else - Actions
                          • Unit - Remove PlayerStatMain[(Player number of (Owner of (Triggering unit)))] from (Triggering unit)
                          • Hero - Create Item_Type_Main[(Player number of (Owner of (Triggering unit)))] and give it to PlayerUnits[(Player number of (Owner of (Triggering unit)))]
                          • Set Item_Type_Main[(Player number of (Owner of (Triggering unit)))] = (Item-type of (Item being manipulated))
                          • Item - Remove (Item being manipulated)
                          • Unit - Remove Main_Stat[(Player number of (Owner of (Triggering unit)))] from PlayerUnits[(Player number of (Owner of (Triggering unit)))]
                          • Unit - Remove Main_Icon[(Player number of (Owner of (Triggering unit)))] from Equipment[(Player number of (Owner of (Triggering unit)))]
                          • Unit - Add Equip_Stat[(Integer A)] to PlayerUnits[(Player number of (Owner of (Triggering unit)))]
                          • Set Main_Stat[(Player number of (Owner of (Triggering unit)))] = Equip_Stat[(Integer A)]
                          • Unit - Add Equip_Icon[(Integer A)] to Equipment[(Player number of (Owner of (Triggering unit)))]
                          • Set Main_Icon[(Player number of (Owner of (Triggering unit)))] = Equip_Icon[(Integer A)]
                          • Set MainSlotOpen[(Player number of (Owner of (Triggering unit)))] = True
                          • Unit - Add StatType[(Integer A)] to (Triggering unit)
                          • Set PlayerStatMain[(Player number of (Owner of (Triggering unit)))] = StatType[(Integer A)]
                    • Else - Actions
                • Else - Actions
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Chest[(Integer A)] Equal to (==) True
                • Then - Actions
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ChestSlotOpen[(Player number of (Owner of (Triggering unit)))] Equal to (==) False
                    • Then - Actions
                      • Unit - Remove Unarmored from (Triggering unit)
                      • Unit - Add StatType[(Integer A)] to (Triggering unit)
                      • Set PlayerStatChest[(Player number of (Owner of (Triggering unit)))] = StatType[(Integer A)]
                      • Unit - Remove Armor from Equipment[(Player number of (Owner of (Triggering unit)))]
                      • Set Item_Type_Chest[(Player number of (Owner of (Triggering unit)))] = (Item-type of (Item being manipulated))
                      • Unit - Add Equip_Stat[(Integer A)] to PlayerUnits[(Player number of (Owner of (Triggering unit)))]
                      • Set Chest_Stat[(Player number of (Owner of (Triggering unit)))] = Equip_Stat[(Integer A)]
                      • Unit - Add Equip_Icon[(Integer A)] to Equipment[(Player number of (Owner of (Triggering unit)))]
                      • Set Chest_Icon[(Player number of (Owner of (Triggering unit)))] = Equip_Icon[(Integer A)]
                      • Item - Remove (Item being manipulated)
                      • Set ChestSlotOpen[(Player number of (Owner of (Triggering unit)))] = True
                      • Set Defence[(Player number of (Owner of (Triggering unit)))] = (Defence[(Player number of (Owner of (Triggering unit)))] + ItemDefenseBonus[(Integer A)])
                      • Set ChestDefense[(Player number of (Owner of (Triggering unit)))] = ItemDefenseBonus[(Integer A)]
                    • Else - Actions
                      • Set Defence[(Player number of (Owner of (Triggering unit)))] = (Defence[(Player number of (Owner of (Triggering unit)))] - ChestDefense[(Player number of (Owner of (Triggering unit)))])
                      • Unit - Remove PlayerStatChest[(Player number of (Owner of (Triggering unit)))] from (Triggering unit)
                      • Hero - Create Item_Type_Chest[(Player number of (Owner of (Triggering unit)))] and give it to PlayerUnits[(Player number of (Owner of (Triggering unit)))]
                      • Set Item_Type_Chest[(Player number of (Owner of (Triggering unit)))] = (Item-type of (Item being manipulated))
                      • Item - Remove (Item being manipulated)
                      • Unit - Remove Chest_Stat[(Player number of (Owner of (Triggering unit)))] from PlayerUnits[(Player number of (Owner of (Triggering unit)))]
                      • Unit - Remove Chest_Icon[(Player number of (Owner of (Triggering unit)))] from Equipment[(Player number of (Owner of (Triggering unit)))]
                      • Unit - Add Equip_Stat[(Integer A)] to PlayerUnits[(Player number of (Owner of (Triggering unit)))]
                      • Set Chest_Stat[(Player number of (Owner of (Triggering unit)))] = Equip_Stat[(Integer A)]
                      • Unit - Add Equip_Icon[(Integer A)] to Equipment[(Player number of (Owner of (Triggering unit)))]
                      • Set Chest_Icon[(Player number of (Owner of (Triggering unit)))] = Equip_Icon[(Integer A)]
                      • Set ChestSlotOpen[(Player number of (Owner of (Triggering unit)))] = True
                      • Unit - Add StatType[(Integer A)] to (Triggering unit)
                      • Set PlayerStatChest[(Player number of (Owner of (Triggering unit)))] = StatType[(Integer A)]
                      • Set Defence[(Player number of (Owner of (Triggering unit)))] = (Defence[(Player number of (Owner of (Triggering unit)))] + ItemDefenseBonus[(Integer A)])
                      • Set ChestDefense[(Player number of (Owner of (Triggering unit)))] = ItemDefenseBonus[(Integer A)]
                • Else - Actions
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Off[(Integer A)] Equal to (==) True
                • Then - Actions
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • OffHandSlotOpen[(Player number of (Owner of (Triggering unit)))] Equal to (==) False
                    • Then - Actions
                      • Unit - Add StatType[(Integer A)] to (Triggering unit)
                      • Set PlayerStatOff[(Player number of (Owner of (Triggering unit)))] = StatType[(Integer A)]
                      • Unit - Remove Offhand from Equipment[(Player number of (Owner of (Triggering unit)))]
                      • Set Item_Type_Off[(Player number of (Owner of (Triggering unit)))] = (Item-type of (Item being manipulated))
                      • Unit - Add Equip_Stat[(Integer A)] to PlayerUnits[(Player number of (Owner of (Triggering unit)))]
                      • Set Off_Stat[(Player number of (Owner of (Triggering unit)))] = Equip_Stat[(Integer A)]
                      • Unit - Add Equip_Icon[(Integer A)] to Equipment[(Player number of (Owner of (Triggering unit)))]
                      • Set Off_Icon[(Player number of (Owner of (Triggering unit)))] = Equip_Icon[(Integer A)]
                      • Item - Remove (Item being manipulated)
                      • Set OffHandSlotOpen[(Player number of (Owner of (Triggering unit)))] = True
                      • Set Defence[(Player number of (Owner of (Triggering unit)))] = (Defence[(Player number of (Owner of (Triggering unit)))] + ItemDefenseBonus[(Integer A)])
                      • Set OffDefense[(Player number of (Owner of (Triggering unit)))] = ItemDefenseBonus[(Integer A)]
                    • Else - Actions
                      • Set Defence[(Player number of (Owner of (Triggering unit)))] = (Defence[(Player number of (Owner of (Triggering unit)))] - OffDefense[(Player number of (Owner of (Triggering unit)))])
                      • Unit - Remove PlayerStatOff[(Player number of (Owner of (Triggering unit)))] from (Triggering unit)
                      • Hero - Create Item_Type_Off[(Player number of (Owner of (Triggering unit)))] and give it to PlayerUnits[(Player number of (Owner of (Triggering unit)))]
                      • Set Item_Type_Off[(Player number of (Owner of (Triggering unit)))] = (Item-type of (Item being manipulated))
                      • Item - Remove (Item being manipulated)
                      • Unit - Remove Off_Stat[(Player number of (Owner of (Triggering unit)))] from PlayerUnits[(Player number of (Owner of (Triggering unit)))]
                      • Unit - Remove Off_Icon[(Player number of (Owner of (Triggering unit)))] from Equipment[(Player number of (Owner of (Triggering unit)))]
                      • Unit - Add Equip_Stat[(Integer A)] to PlayerUnits[(Player number of (Owner of (Triggering unit)))]
                      • Set Off_Stat[(Player number of (Owner of (Triggering unit)))] = Equip_Stat[(Integer A)]
                      • Unit - Add Equip_Icon[(Integer A)] to Equipment[(Player number of (Owner of (Triggering unit)))]
                      • Set Off_Icon[(Player number of (Owner of (Triggering unit)))] = Equip_Icon[(Integer A)]
                      • Set OffHandSlotOpen[(Player number of (Owner of (Triggering unit)))] = True
                      • Unit - Add StatType[(Integer A)] to (Triggering unit)
                      • Set PlayerStatOff[(Player number of (Owner of (Triggering unit)))] = StatType[(Integer A)]
                      • Set Defence[(Player number of (Owner of (Triggering unit)))] = (Defence[(Player number of (Owner of (Triggering unit)))] + ItemDefenseBonus[(Integer A)])
                      • Set OffDefense[(Player number of (Owner of (Triggering unit)))] = ItemDefenseBonus[(Integer A)]
                • Else - Actions
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Helm[(Integer A)] Equal to (==) True
                • Then - Actions
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • HelmSlotOpen[(Player number of (Owner of (Triggering unit)))] Equal to (==) False
                    • Then - Actions
                      • Unit - Add StatType[(Integer A)] to (Triggering unit)
                      • Set PlayerStatHelm[(Player number of (Owner of (Triggering unit)))] = StatType[(Integer A)]
                      • Unit - Remove Helmet from Equipment[(Player number of (Owner of (Triggering unit)))]
                      • Set Item_Type_Helm[(Player number of (Owner of (Triggering unit)))] = (Item-type of (Item being manipulated))
                      • Unit - Add Equip_Stat[(Integer A)] to PlayerUnits[(Player number of (Owner of (Triggering unit)))]
                      • Set Helm_Stat[(Player number of (Owner of (Triggering unit)))] = Equip_Stat[(Integer A)]
                      • Unit - Add Equip_Icon[(Integer A)] to Equipment[(Player number of (Owner of (Triggering unit)))]
                      • Set Helm_Icon[(Player number of (Owner of (Triggering unit)))] = Equip_Icon[(Integer A)]
                      • Item - Remove (Item being manipulated)
                      • Set HelmSlotOpen[(Player number of (Owner of (Triggering unit)))] = True
                      • Set Defence[(Player number of (Owner of (Triggering unit)))] = (Defence[(Player number of (Owner of (Triggering unit)))] + ItemDefenseBonus[(Integer A)])
                      • Set HelmDefense[(Player number of (Owner of (Triggering unit)))] = ItemDefenseBonus[(Integer A)]
                    • Else - Actions
                      • Set Defence[(Player number of (Owner of (Triggering unit)))] = (Defence[(Player number of (Owner of (Triggering unit)))] - HelmDefense[(Player number of (Owner of (Triggering unit)))])
                      • Unit - Remove PlayerStatHelm[(Player number of (Owner of (Triggering unit)))] from (Triggering unit)
                      • Hero - Create Item_Type_Helm[(Player number of (Owner of (Triggering unit)))] and give it to PlayerUnits[(Player number of (Owner of (Triggering unit)))]
                      • Set Item_Type_Helm[(Player number of (Owner of (Triggering unit)))] = (Item-type of (Item being manipulated))
                      • Item - Remove (Item being manipulated)
                      • Unit - Remove Helm_Stat[(Player number of (Owner of (Triggering unit)))] from PlayerUnits[(Player number of (Owner of (Triggering unit)))]
                      • Unit - Remove Helm_Icon[(Player number of (Owner of (Triggering unit)))] from Equipment[(Player number of (Owner of (Triggering unit)))]
                      • Unit - Add Equip_Stat[(Integer A)] to PlayerUnits[(Player number of (Owner of (Triggering unit)))]
                      • Set Helm_Stat[(Player number of (Owner of (Triggering unit)))] = Equip_Stat[(Integer A)]
                      • Unit - Add Equip_Icon[(Integer A)] to Equipment[(Player number of (Owner of (Triggering unit)))]
                      • Set Helm_Icon[(Player number of (Owner of (Triggering unit)))] = Equip_Icon[(Integer A)]
                      • Set HelmSlotOpen[(Player number of (Owner of (Triggering unit)))] = True
                      • Unit - Add StatType[(Integer A)] to (Triggering unit)
                      • Set PlayerStatHelm[(Player number of (Owner of (Triggering unit)))] = StatType[(Integer A)]
                      • Set Defence[(Player number of (Owner of (Triggering unit)))] = (Defence[(Player number of (Owner of (Triggering unit)))] + ItemDefenseBonus[(Integer A)])
                      • Set HelmDefense[(Player number of (Owner of (Triggering unit)))] = ItemDefenseBonus[(Integer A)]
                • Else - Actions
              • Custom script: call UnitSetArmor(udg_PlayerUnits[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))], udg_Defence[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
            • Else - Actions

The unequip:
Trigger:
  • WSystemUnEquip
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Unit-type of (Casting unit)) Equal to (==) Equipment
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of items carried by PlayerUnits[(Player number of (Owner of (Triggering unit)))]) Greater than or equal to (>=) 6
        • Then - Actions
          • Game - Display to (Player group((Owner of (Triggering unit)))) for 3.00 seconds the text: Unable to UnEquip I...
        • Else - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to (==) Main_Icon[(Player number of (Owner of (Triggering unit)))]
            • Then - Actions
              • Unit - Remove PlayerStatMain[(Player number of (Owner of (Triggering unit)))] from PlayerUnits[(Player number of (Owner of (Triggering unit)))]
              • Hero - Create Item_Type_Main[(Player number of (Owner of (Triggering unit)))] and give it to PlayerUnits[(Player number of (Owner of (Triggering unit)))]
              • Set Item_Type_Main[(Player number of (Owner of (Triggering unit)))] = (Item-type of (Item being manipulated))
              • Unit - Remove Main_Stat[(Player number of (Owner of (Triggering unit)))] from PlayerUnits[(Player number of (Owner of (Triggering unit)))]
              • Unit - Remove Main_Icon[(Player number of (Owner of (Triggering unit)))] from Equipment[(Player number of (Owner of (Triggering unit)))]
              • Unit - Add Unarmed to PlayerUnits[(Player number of (Owner of (Triggering unit)))]
              • Set MainSlotOpen[(Player number of (Owner of (Triggering unit)))] = False
              • Unit - Add Mainhand to Equipment[(Player number of (Owner of (Triggering unit)))]
            • Else - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to (==) Chest_Icon[(Player number of (Owner of (Triggering unit)))]
            • Then - Actions
              • Set Defence[(Player number of (Owner of (Triggering unit)))] = (Defence[(Player number of (Owner of (Triggering unit)))] - ChestDefense[(Player number of (Owner of (Triggering unit)))])
              • Unit - Remove PlayerStatChest[(Player number of (Owner of (Triggering unit)))] from PlayerUnits[(Player number of (Owner of (Triggering unit)))]
              • Hero - Create Item_Type_Chest[(Player number of (Owner of (Triggering unit)))] and give it to PlayerUnits[(Player number of (Owner of (Triggering unit)))]
              • Set Item_Type_Chest[(Player number of (Owner of (Triggering unit)))] = (Item-type of (Item being manipulated))
              • Unit - Remove Chest_Stat[(Player number of (Owner of (Triggering unit)))] from PlayerUnits[(Player number of (Owner of (Triggering unit)))]
              • Unit - Remove Chest_Icon[(Player number of (Owner of (Triggering unit)))] from Equipment[(Player number of (Owner of (Triggering unit)))]
              • Unit - Add Unarmored to PlayerUnits[(Player number of (Owner of (Triggering unit)))]
              • Set ChestSlotOpen[(Player number of (Owner of (Triggering unit)))] = False
              • Unit - Add Armor to Equipment[(Player number of (Owner of (Triggering unit)))]
            • Else - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to (==) Off_Icon[(Player number of (Owner of (Triggering unit)))]
            • Then - Actions
              • Set Defence[(Player number of (Owner of (Triggering unit)))] = (Defence[(Player number of (Owner of (Triggering unit)))] - OffDefense[(Player number of (Owner of (Triggering unit)))])
              • Unit - Remove PlayerStatOff[(Player number of (Owner of (Triggering unit)))] from PlayerUnits[(Player number of (Owner of (Triggering unit)))]
              • Hero - Create Item_Type_Off[(Player number of (Owner of (Triggering unit)))] and give it to PlayerUnits[(Player number of (Owner of (Triggering unit)))]
              • Set Item_Type_Off[(Player number of (Owner of (Triggering unit)))] = (Item-type of (Item being manipulated))
              • Item - Remove (Item being manipulated)
              • Unit - Remove Off_Stat[(Player number of (Owner of (Triggering unit)))] from PlayerUnits[(Player number of (Owner of (Triggering unit)))]
              • Unit - Remove Off_Icon[(Player number of (Owner of (Triggering unit)))] from Equipment[(Player number of (Owner of (Triggering unit)))]
              • Set OffHandSlotOpen[(Player number of (Owner of (Triggering unit)))] = False
              • Unit - Add Offhand to Equipment[(Player number of (Owner of (Triggering unit)))]
            • Else - Actions
          • Custom script: call UnitSetArmor(udg_PlayerUnits[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))], udg_Defence[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
 

Jesus4Lyf

Good Idea™
Reaction score
397
Alright. Import the code I posted before.
Then...
Trigger:
  • Set Equip_Integer = (Equip_Integer + 1)
    • Set Equip_Catalog[Equip_Integer] = |cffFDC689Recruits Light Chain Armor|r

-->
Trigger:
  • Set Equip_Catalog[0] = |cffFDC689Recruits Light Chain Armor|r
    • Custom Script: set udg_Equip_Integer = RawcodeData.create(udg_Equip_Catalog[0])


Then...
Instead of
Trigger:
  • (Item-type of (Item being manipulated)) Equal to (==) Equip_Catalog[(Integer A)]

Do something like:
Trigger:
  • Custom Script: set udg_Equip_Integer = RawcodeData[GetItemTypeId(GetManipulatedItem())]

And you can access all your wonderful arrays in the same way you wrote to them. :)

PS. I'm pretty sure you don't need JASS for this, btw. Doesn't GUI have hashtables? Just for each item, store the stack level of its data, and then set EquipInteger to that stack level when an item is picked up/used/whatever...
 

XxShadyxX

I abused the rep system.
Reaction score
81
No, dude, I just want to recreate what I basically have in GUI into vJass. . .
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top