• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

About item stacking made by DigitalDemon

Status
Not open for further replies.
Level 2
Joined
Aug 15, 2009
Messages
19
http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/stacking-items-45226/ --source DigitalDemon Stacking System


  • (Item being manipulated) Not equal to (Item carried by (Hero manipulating item) of type (Item-type of (Item being manipulated)))
  • Set Slot = (Integer((Substring((Entered chat string), 10, 10))))
what does those two mean ? It seem to be an essential part of the system :cry: can anyone explain in detail to me. I just can't figure it out by myself.


In the same time , I would like to present some modification about the system unstack part done by Digital Demon in tutorial sector.
I think I solve the odd number of charged problem , hopefully :wink:
  • Unstack
    • Events
      • Player - Player 1 (Red) types a chat message containing -unstack as A substring
    • Conditions
    • Actions
      • Set HeroPos = (Position of Hero[(Player number of (Triggering player))])
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-class of (Item carried by Hero[(Player number of (Triggering player))] in slot (Integer A))) Equal to Charged
            • Then - Actions
              • Set Charges = ((Charges remaining in (Item carried by Hero[(Player number of (Triggering player))] in slot (Integer A))) / 2)
              • Item - Set charges remaining in (Item carried by Hero[(Player number of (Triggering player))] in slot (Integer A)) to (Charges + ((Charges remaining in (Item carried by Hero[1] in slot (Integer A))) mod 2))
              • Item - Create (Item-type of (Item carried by Hero[(Player number of (Triggering player))] in slot (Integer A))) at HeroPos
              • Item - Set charges remaining in (Last created item) to Charges
            • Else - Actions
      • Custom script: call RemoveLocation(udg_HeroPos)
The trick is "Math-modulo"
(Charges remaining in (Item carried by Hero[1] in slot (Integer A))) mod 2)
remainder charge = charge mod 2
example
1 = 7 mod 2
0 = 4 mod 2
:wink: so you won't loss any charge when you unstack an odd number charged item.
The item such as potion or etc should had their 'item class' set as 'charged' in the object editor if you want to unstack them or you just modify the trigger to suit your taste.
 
Last edited:
Level 2
Joined
Aug 15, 2009
Messages
19
bump XD
Item being manipulated = pickup item ?
Item carried by (Hero manipulating item) = the hero who pick up the item ?
type (Item-type of (Item being manipulated)) = type of the item that pickup ??

(Item being manipulated) Not equal to (Item carried by (Hero manipulating item) of type (Item-type of (Item being manipulated)))
Doesn't really understand what is the meaning of this one , how it affect the whole trigger ?
 
Last edited:
Status
Not open for further replies.
Top