1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  3. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  4. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

DisableItems v1.0 (Active ones)

Submitted by Pharaoh_
This bundle is marked as approved. It works and satisfies the submission rules.
A small system in GUI; prevents your heroes from using their active items.

Note: I know it's not anything spectacular, but it is very useful. I made it a while ago and it wouldn't deserve becoming a tutorial, so I uploaded it as a system.

Instructions of implementation are included within the map, but I will post them here as well.
Triggers/System
  • Item Usage1
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- ---------------- --------
      • -------- List of orders; these orders depict the slot the item ability is used from. --------
      • -------- ---------------- --------
      • Set Orders[1] = 852008
      • Set Orders[2] = 852009
      • Set Orders[3] = 852010
      • Set Orders[4] = 852011
      • Set Orders[5] = 852012
      • Set Orders[6] = 852013
      • -------- ---------------- --------
      • Hashtable - Create a hashtable
      • Set Hashtable = (Last created hashtable)
      • -------- ---------------- --------
      • -------- Testing purpose --------
      • -------- ---------------- --------
      • Set Disable = True

  • Item Usage2
    • Events
      • Unit - A unit Is issued an order with no target
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • Disable Equal to True
    • Actions
      • For each (Integer IntegerLoop) from 1 to 6, do (Actions)
        • Loop - Actions
          • -------- We will now retrieve the slot the item was attached to. --------
          • Custom script: if GetIssuedOrderId() == udg_Orders[udg_IntegerLoop] then
          • -------- ---------------- --------
          • -------- ---------------- --------
          • -------- This is how we will retrieve the slot. We will get the lasts digits of the order, that represent each slot and then --------
          • -------- we will substract 7, to get the exact item position. So, if the item was in slot 4, the lasts digits of the order are --------
          • -------- 11; 11-7 = 4, so, here is the exact slot. --------
          • -------- ---------------- --------
          • -------- ---------------- --------
          • Set WhichSlot = (Integer((Substring((String(Orders[IntegerLoop])), 5, (Length of (String(Orders[IntegerLoop])))))))
          • -------- ---------------- --------
          • -------- ---------------- --------
          • Hero - Drop (Item carried by (Triggering unit) in slot IntegerLoop) from (Triggering unit)
          • -------- ---------------- --------
          • -------- The dummy is created to actually make the system function. --------
          • -------- ---------------- --------
          • Set Point1 = (Position of (Triggering unit))
          • -------- ---------------- --------
          • Unit - Create 1 DummyTimer for (Owner of (Triggering unit)) at Point1 facing Default building facing degrees
          • Hashtable - Save Handle Of(Triggering unit) as (Key who) of (Key (Last created unit)) in Hashtable
          • Hashtable - Save Handle Of(Last dropped item) as (Key what) of (Key (Last created unit)) in Hashtable
          • -------- ---------------- --------
          • -------- ---------------- --------
          • -------- Although the slot will always be a positive number, I placed the Abs() function, just in case. --------
          • -------- ---------------- --------
          • -------- ---------------- --------
          • Hashtable - Save (Abs((WhichSlot - 7))) as (Key slot) of (Key (Last created unit)) in Hashtable
          • -------- ---------------- --------
          • -------- ---------------- --------
          • Unit - Add a 0.01 second Generic expiration timer to (Last created unit)
          • -------- ---------------- --------
          • -------- ---------------- --------
          • Custom script: call RemoveLocation (udg_Point1)
          • -------- ---------------- --------
          • Custom script: endif

  • Item Usage3
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to DummyTimer
    • Actions
      • -------- ---------------- --------
      • -------- Loading the hashtable values --------
      • -------- ---------------- --------
      • Set ItemCaster = (Load (Key who) of (Key (Triggering unit)) in Hashtable)
      • Set ItemItem = (Load (Key what) of (Key (Triggering unit)) in Hashtable)
      • Set Slot = (Load (Key slot) of (Key (Triggering unit)) from Hashtable)
      • -------- ---------------- --------
      • -------- We give the item back to the Hero manipulating item and we order it to move it to the slot the item was used from. --------
      • -------- ---------------- --------
      • Hero - Give ItemItem to ItemCaster
      • Unit - Order ItemCaster to move ItemItem to inventory slot Slot
      • -------- ---------------- --------
      • -------- ---------------- --------
      • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in Hashtable


Other notes (from the Loading Screen):
Changelog:

• Added charges-support system.

Keywords:
Item, Disable, Active, System
Contents

Disable Item Usage (Map)

Reviews
Moderator
12:11, 17th Jun 2010 TriggerHappy: Does what is says it does and the coding is good. edit 18th December Magtheridon96: You should totally update this. - (Triggering unit) should be cached into a unit variable. - (Key (Triggering unit))...
  1. 12:11, 17th Jun 2010
    TriggerHappy:

    Does what is says it does and the coding is good.

    edit
    18th December
    Magtheridon96:
    You should totally update this.
    - (Triggering unit) should be cached into a unit variable.
    - (Key (Triggering unit)) should be cached into an integer variable via custom script.
    - There is a faster way for you to get the slot:
    Code (vJASS):
    local integer orderId = GetIssuedOrderId() - 7
    set slotNumber = orderId - orderId / 7 * 7

    It's faster because it involes no strings or function calls.
     
  2. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,128
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    Oh, I would also like to mention that I was motivated by DeftheLynn to create this, from a question he casted in the World Editor Zone forum.
     
  3. MortAr

    MortAr

    Joined:
    Feb 25, 2009
    Messages:
    1,765
    Resources:
    7
    Icons:
    6
    Packs:
    1
    Resources:
    7
    Looks promising, will test it when I got the time.
     
  4. VoidLordXtreme

    VoidLordXtreme

    Joined:
    Mar 30, 2009
    Messages:
    250
    Resources:
    0
    Resources:
    0
    i actually read that thread... :)

    seems... useful.
     
  5. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,220
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    This is not useful and way to easy.
    You should just remove and readd the item when an spell effect is triggered.
     
  6. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,128
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    For the second part, I may agree with you, I also added a note that it is uploaded for being useful. For the first part, you really can't say that, when questions like "How to disable active items?" come up in the Warcraft III Modding forums.
    And why don't you find it useful? I don't get it. Let's say someone has an ability that disables enemy's items from being used or needs a system, that, when you are in the water, you can't use items. Why are you so utterly against it? You never know when such a system will be needed.

    I tried, it didn't work. The item is already being removed when using charged items, so it doesn't fire the event at all.
     
  7. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,220
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    I tried and it did work, which event did you use?
     
  8. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,430
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    It is definitely useful and a cool technique. Size shouldn't matter with usefulness as long as it isn't a well known method. =)

    Maybe you should rename "Disable" though to something like "DisableItems" to avoid naming collisions. Also, you could expand this system to disable a slot, which would be neat. But that is up to you. (Basically, instead of just one boolean you can make it an array for 0-5 slots, then you just use the technique if the issued order is that of the slot or whatever, sorry it is a little hard to explain =P )

    Overall though, cool. Nice job.
     
  9. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,128
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    Thank you, PurgeandFire111. Although I did understand what your suggestion is, I'm afraid it gets too specific if I do so, thus I might only post the trigger for that. I mean, a system that will disable active items from being used on a specific slot seems too situational. But please, if you still find it interesting, let me know.
    Name changed to look more like a system ;)
     
    Last edited: May 11, 2010
  10. ALiEN95

    ALiEN95

    Joined:
    Mar 4, 2009
    Messages:
    1,148
    Resources:
    1
    Spells:
    1
    Resources:
    1
    how can you detect item you use than?


    Pharanoh
    can you plz try this,this is actually a combination that i found out myself

    -turn off this trigger
    -pause unit
    -unpause unit
    -order unit to stop
    -turn on this trigger


    turn off/on trigger makes trigger not run twice because of pause and unpause,

    pause/unpause allows you to stop units at events
    - issued an order targeting a pont/object/no target


    and you don´t need to make integers for this
    just use IssuedOrderId - 852007

    for example:
    852008 - 852007 = 1
    852009 - 852007 = 2
     
  11. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,128
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    Moderators seem to dislike Pause/Unpause and sometimes, Stun and Pause cause weird effects (like eternal pausing).
     
  12. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,220
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    Store the item that is being used.
     
  13. ALiEN95

    ALiEN95

    Joined:
    Mar 4, 2009
    Messages:
    1,148
    Resources:
    1
    Spells:
    1
    Resources:
    1
    never happend ...at least not with this i posted

    a anyway it seems a lot better than using timers
    btw time expire in 0.00 should be enough but i woul rather avoid using timer at all

    but than you have to store it when issuing an order,don´t you ??
     
  14. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,128
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    0.00 seconds expiration timer isn't enough for the data to be stored on the dummy with the hashtable. 0.01 is the least amount I can use.
     
  15. DeftheLynn

    DeftheLynn

    Joined:
    Jan 3, 2010
    Messages:
    313
    Resources:
    1
    Maps:
    1
    Resources:
    1
    hey, you should thank me for giving the inspiration :p

    EDIT : you did :D on the first post :D
     
    Last edited: May 12, 2010
  16. 88WaRCraFT3

    88WaRCraFT3

    Joined:
    Jun 9, 2009
    Messages:
    1,137
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Useful x 2 :D i love your idea about water, will use it like that :D
     
  17. Gekigengar

    Gekigengar

    Joined:
    Aug 20, 2009
    Messages:
    1,490
    Resources:
    2
    Maps:
    1
    Spells:
    1
    Resources:
    2
    it don't work properly when combined with this system
    http://www.hiveworkshop.com/forums/...search=item%20split%20and%20stack&d=list&r=20

    the useable item split into diffrent parts. well, compatibility is not really an issue, but,


    the real problem is...
    if the item is permanent, i still be able to cast, but did nothing (and CD.) (try firebolt).

    anyways can you help with both of them?

    EDIT :
    i solved compatibility, now i just need disable for kelen's dagger, and other item abilities without charges.
     
    Last edited: Apr 20, 2011
  18. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,128
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    Yes, it's because it doesn't consider the charges. I will fix it and update, thanks for noticing ^^
     
  19. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,174
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    You could make the ItemUsage2 trigger like this:

    Trig
    • Item Usage2
      • Events
        • Unit - A unit Is issued an order with no target
        • Unit - A unit Is issued an order targeting an object
        • Unit - A unit Is issued an order targeting a point
      • Conditions
        • Disable Equal to True
      • Actions
        • Custom script: set udg_WhichSlot = GetIssuedOrderId() - 852007
        • Custom script: if udg_WhichSlot > 0 and udg_WhichSlot < 7 then
        • Hero - Drop (Item carried by (Triggering unit) in slot WhichSlot) from (Triggering unit)
        • -------- ---------------- --------
        • -------- The dummy is created to actually make the system function. --------
        • -------- ---------------- --------
        • Set Point1 = (Position of (Triggering unit))
        • -------- ---------------- --------
        • Unit - Create 1 DummyTimer for (Owner of (Triggering unit)) at Point1 facing Default building facing degrees
        • Hashtable - Save Handle Of(Triggering unit) as (Key who) of (Key (Last created unit)) in Hashtable
        • Hashtable - Save Handle Of(Last dropped item) as (Key what) of (Key (Last created unit)) in Hashtable
        • -------- ---------------- --------
        • -------- ---------------- --------
        • -------- Although the slot will always be a positive number, I placed the Abs() function, just in case. --------
        • -------- ---------------- --------
        • -------- ---------------- --------
        • Hashtable - Save WhichSlot as (Key slot) of (Key (Last created unit)) in Hashtable
        • -------- ---------------- --------
        • -------- ---------------- --------
        • Unit - Add a 0.01 second Generic expiration timer to (Last created unit)
        • -------- ---------------- --------
        • -------- ---------------- --------
        • Custom script: call RemoveLocation (udg_Point1)
        • -------- ---------------- --------
        • Custom script: endif


    Then you don't need the order id array.