• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[General] Need some logic for long trigger :D

Status
Not open for further replies.
Level 17
Joined
Nov 13, 2006
Messages
1,814
somebody can move to correct section coz i dont watched i am in this section:/

item level is like item id, i mean each item in map got different item level, example heavy armor lv100-150, helmet 250-300 etc

i want make a multiboard inventory, each item got few integer array, example item_hp[100]=20=>armor what is lv100 item give +20 hp

but the equipment system take too much line, somebody can give ideea can i write shorter?
in my example i wrote only for 1 type of armor but still have 2 type armor, 3 type helm, 3type boot, 6-7 type weapon and etc etc etc

  • Equip
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Triggering unit) Equal to Hero[(Player number of (Owner of (Triggering unit)))]
      • (Item level of (Item being manipulated)) Greater than or equal to 100
    • Actions
      • Set ManItem = (Item being manipulated)
      • Set TempNr = (Item level of ManItem)
      • Set plNR = (Player number of (Triggering player))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempNr Greater than or equal to 100
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Hero level of (Triggering unit)) Greater than or equal to (Item level of ManItem)
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TempNr Less than 150
                  • Or - Any (Conditions) are true
                    • Conditions
                      • Class[plNR] Equal to 1
                      • Class[plNR] Equal to 2
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Armor[plNR] Equal to 0
                    • Then - Actions
                      • Set Armor[plNR] = TempNr
                      • Hero - Modify Agility of (Triggering unit): Add Item_Agi[TempNr]
                      • Hero - Modify Intelligence of (Triggering unit): Add Item_Int[TempNr]
                      • Hero - Modify Strength of (Triggering unit): Add Item_Str[exitemnr]
                      • Set Stat_AttackLv[plNR] = (Stat_AttackLv[plNR] + Item_AttLv[TempNr])
                      • Set Stat_AttackSpeed[plNR] = (Stat_AttackSpeed[plNR] + Item_AttackSpeed[TempNr])
                      • Unit - Set level of Passive Increased Attack Speed for (Triggering unit) to Stat_AttackSpeed[plNR]
                      • Set Stat_BlockDmg[plNR] = (Stat_BlockDmg[plNR] + Item_Block[TempNr])
                      • Set Stat_Crit[plNR] = (Stat_Crit[plNR] + Item_Crit[TempNr])
                      • Set Stat_RageDmg[plNR] = (Stat_RageDmg[plNR] + Item_CritDmg[TempNr])
                      • Set Stat_DefLv[plNR] = (Stat_DefLv[plNR] + Item_DefLv[TempNr])
                      • Set Stat_Evasion[plNR] = (Stat_Evasion[plNR] + Item_Eva[TempNr])
                      • Set Stat_HpRegen[plNR] = (Stat_HpRegen[plNR] + Item_HpRegen[TempNr])
                      • Set Stat_LifeSteal[plNR] = (Stat_LifeSteal[plNR] + Item_LSteal[TempNr])
                      • Set Stat_ManaSteal[plNR] = (Stat_ManaSteal[plNR] + Item_MSteal[TempNr])
                      • Set Stat_MpRegen[plNR] = (Stat_MpRegen[plNR] + Item_MpRegen[TempNr])
                      • Set Stat_Reflect[plNR] = (Stat_Reflect[plNR] + Item_Reflect[TempNr])
                      • Set Stat_Exp[plNR] = (Stat_Exp[plNR] + Item_Exp[TempNr])
                      • Set Stat_MovSpeed[plNR] = (Stat_MovSpeed[plNR] + Item_MovSpeed[TempNr])
                      • Unit - Set level of Passive Movement Speed Bonus for (Triggering unit) to Stat_AttackSpeed[plNR]
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Item_HP[TempNr] Greater than 0
                        • Then - Actions
                          • -------- here coming add hp loop --------
                        • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Item_Mp[TempNr] Greater than 0
                        • Then - Actions
                          • -------- here coming add mp loop --------
                        • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Item_Dmg[TempNr] Greater than 0
                        • Then - Actions
                          • -------- here coming add dmg loop --------
                        • Else - Actions
                    • Else - Actions
                      • Set exitemnr = Armor[plNR]
                      • Set aitem_diff1 = (Item_Agi[TempNr] - Item_Agi[exitemnr])
                      • Set aitem_diff2 = (Item_AttLv[TempNr] - Item_AttLv[exitemnr])
                      • Set aitem_diff3 = (Item_AttackSpeed[TempNr] - Item_AttackSpeed[exitemnr])
                      • Set aitem_diff4 = (Item_Block[TempNr] - Item_Block[exitemnr])
                      • Set aitem_diff5 = (Item_Crit[TempNr] - Item_Crit[exitemnr])
                      • Set aitem_diff6 = (Item_CritDmg[TempNr] - Item_CritDmg[exitemnr])
                      • Set aitem_diff7 = (Item_DefLv[TempNr] - Item_DefLv[exitemnr])
                      • Set aitem_diff8 = (Item_Dmg[TempNr] - Item_Dmg[exitemnr])
                      • Set aitem_diff9 = (Item_Eva[TempNr] - Item_Eva[exitemnr])
                      • Set aitem_diff10 = (Item_Exp[TempNr] - Item_Exp[exitemnr])
                      • Set aitem_diff11 = (Item_HP[TempNr] - Item_HP[exitemnr])
                      • Set aitem_diff12 = (Item_HpRegen[TempNr] - Item_HpRegen[exitemnr])
                      • Set aitem_diff13 = (Item_Int[TempNr] - Item_Int[exitemnr])
                      • Set aitem_diff14 = (Item_LSteal[TempNr] - Item_LSteal[exitemnr])
                      • Set aitem_diff15 = (Item_MSteal[TempNr] - Item_MSteal[exitemnr])
                      • Set aitem_diff16 = (Item_MovSpeed[TempNr] - Item_MovSpeed[exitemnr])
                      • Set aitem_diff17 = (Item_Mp[TempNr] - Item_Mp[exitemnr])
                      • Set aitem_diff18 = (Item_MpRegen[TempNr] - Item_MpRegen[exitemnr])
                      • Set aitem_diff19 = (Item_Str[TempNr] - Item_Str[exitemnr])
                      • Hero - Modify Strength of (Triggering unit): Add aitem_diff19
                      • Hero - Modify Agility of (Triggering unit): Add aitem_diff1
                      • Hero - Modify Intelligence of (Triggering unit): Add aitem_diff13
                      • Set Stat_AttackLv[plNR] = (Stat_AttackLv[plNR] + aitem_diff2)
                      • Set Stat_AttackSpeed[plNR] = (Stat_AttackSpeed[plNR] + aitem_diff3)
                      • Unit - Set level of Passive Increased Attack Speed for (Triggering unit) to Stat_AttackSpeed[plNR]
                      • Set Stat_BlockDmg[plNR] = (Stat_BlockDmg[plNR] + aitem_diff4)
                      • Set Stat_Crit[plNR] = (Stat_Crit[plNR] + aitem_diff5)
                      • Set Stat_RageDmg[plNR] = (Stat_RageDmg[plNR] + aitem_diff6)
                      • Set Stat_Evasion[plNR] = (Stat_Evasion[plNR] + aitem_diff9)
                      • Set Stat_DefLv[plNR] = (Stat_DefLv[plNR] + aitem_diff7)
                      • Set Stat_HpRegen[plNR] = (Stat_HpRegen[plNR] + aitem_diff12)
                      • Set Stat_LifeSteal[plNR] = (Stat_LifeSteal[plNR] + aitem_diff14)
                      • Set Stat_ManaSteal[plNR] = (Stat_ManaSteal[plNR] + aitem_diff15)
                      • Set Stat_MovSpeed[plNR] = (Stat_MovSpeed[plNR] + aitem_diff16)
                      • Unit - Set level of Passive Movement Speed Bonus for (Triggering unit) to Stat_AttackSpeed[plNR]
                      • Set Stat_MpRegen[plNR] = (Stat_MpRegen[plNR] + aitem_diff18)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • aitem_diff11 Greater than 0
                        • Then - Actions
                          • -------- here coming add hp loop --------
                        • Else - Actions
                          • -------- here coming decrease hp loop --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • aitem_diff7 Greater than 0
                        • Then - Actions
                          • -------- here coming add mp loop --------
                        • Else - Actions
                          • -------- here coming decrease mp loop --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • aitem_diff8 Greater than 0
                        • Then - Actions
                          • -------- here coming add dmg loop --------
                        • Else - Actions
                          • -------- here decrease dmg loop --------
                      • Set Armor[plNR] = TempNr
                      • Game - Display to (All players) the text: Replaced with older...
                      • Hero - Create Item_Type[TempNr] and give it to (Triggering unit)
                • Else - Actions
                  • Game - Display to (All players) the text: Not your class armor
                  • Hero - Create Item_Type[TempNr] and give it to (Triggering unit)
            • Else - Actions
              • Game - Display to (All players) the text: Your level too low ...
              • Hero - Create Item_Type[TempNr] and give it to (Triggering unit)
        • Else - Actions
 
Last edited:
Level 6
Joined
Jun 16, 2007
Messages
235
You have been here since 2006 and still don't know JASS?

Noone can help you with this, what you need is to level up.
 
Level 13
Joined
Jun 1, 2008
Messages
360
I'm not quite sure if I understand what you are trying to do, but maybe this helps you anyways.

Well if you want to have so many attributes for every item you need so many lines of code...
However if every item has only a new attributes, you could just save the corresponding abilities in a hashtable, like this:
Hashtable - Create
Set ItemDataHash = Last created Hashtable
Set ItemTypeCount = x (number of item types u define below)
Set ItemType[1] = Armor1
Hashtable - Save ability (+health) as 1 of 1 in ItemDataHash
Hashtable - Save ability (+armor) as 2 of 1 in ItemDataHash
Hashtable - Save ability (+mana) as 3 of 1 in ItemDataHash
...
Set ItemType[2] = Armor2
Hashtable - Save ability (+movespeed) as 1 of 2 in ItemDataHash
Hashtable - Save ability (+armor) as 2 of 2 in ItemDataHash
...

and so on. Then you need only something like this when the item is equipped/used:
For each integer A from 1 to ItemTypeCount do
if itemtype of item = ItemType[A] then
add ability (Hashtable - Load 1 of A from ItemDataHash)
add ability (Hashtable - Load 2 of A from ItemDataHash)
...
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
I'm not quite sure if I understand what you are trying to do, but maybe this helps you anyways.

Well if you want to have so many attributes for every item you need so many lines of code...
However if every item has only a new attributes, you could just save the corresponding abilities in a hashtable, like this:
Hashtable - Create
Set ItemDataHash = Last created Hashtable
Set ItemTypeCount = x (number of item types u define below)
Set ItemType[1] = Armor1
Hashtable - Save ability (+health) as 1 of 1 in ItemDataHash
Hashtable - Save ability (+armor) as 2 of 1 in ItemDataHash
Hashtable - Save ability (+mana) as 3 of 1 in ItemDataHash
...
Set ItemType[2] = Armor2
Hashtable - Save ability (+movespeed) as 1 of 2 in ItemDataHash
Hashtable - Save ability (+armor) as 2 of 2 in ItemDataHash
...

and so on. Then you need only something like this when the item is equipped/used:
For each integer A from 1 to ItemTypeCount do
if itemtype of item = ItemType[A] then
add ability (Hashtable - Load 1 of A from ItemDataHash)
add ability (Hashtable - Load 2 of A from ItemDataHash)
...

sound easy but when somebody have lets say 50+ item and each item got 3 ability then its a bit much ability, no?
 
Status
Not open for further replies.
Top