• 🏆 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!

DisableItems v1.0 (Active ones)

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.
This system is brought to you by Pharaoh_ and was uploaded on Hiveworkshop.
It is a small GUI system to prevent usage of active items.

To implement this system to your map,
• Go to World Editor's main window and from File -> Preferences... -> tick the option "Automatically create unknown variables when pasting trigger data".
• Go to Object Editor, copy the unit "DummyTimer" and paste it into you map.
• Copy the "Item Usage Disable" folder and paste it into you map.
• Remove the action "Game - Display to (All players) for 10.00 seconds the text: Press Escape to dis..." from the Item Usage1 trigger.

Notice: The system uses a boolean comparison ("Disable" variable) to check when the system is on or not. This was made for testing purposes only. Add your own condition, when you want the system activated.

  • 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):
This small system will disable the usage of items, without the need of creating passive versions of them.

• Disables item usage.
• Restores the item to the slot it was used from.

Changelog:

• Added charges-support system.

Keywords:
Item, Disable, Active, System
Contents

Disable Item Usage (Map)

Reviews
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))...

Moderator

M

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)) should be cached into an integer variable via custom script.
- There is a faster way for you to get the slot:
JASS:
local integer orderId = GetIssuedOrderId() - 7
set slotNumber = orderId - orderId / 7 * 7
It's faster because it involes no strings or function calls.
 
Anachron said:
This is not useful and way to easy.
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.

Anachron said:
You should just remove and readd the item when an spell effect is triggered.

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.
 
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.
 
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:
Level 13
Joined
Mar 4, 2009
Messages
1,156
This is not useful and way to easy.
You should just remove and readd the item when an spell effect is triggered.
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
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
Moderators seem to dislike Pause/Unpause and sometimes, Stun and Pause cause weird effects (like eternal pausing).
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

Store the item that is being used.

but than you have to store it when issuing an order,don´t you ??
 
Level 16
Joined
Aug 20, 2009
Messages
1,552
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:
Level 37
Joined
Mar 6, 2006
Messages
9,240
You could make the ItemUsage2 trigger like this:

  • 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.
 
You're constantly repeating the (Triggering Unit) function.

It would be much more efficient if you store it in a variable.

Also,
  • (Length of (String(Orders[IntegerLoop])))
You don't need this.

Just use 6 instead (All Order IDs in Warcraft III are 6 digits long.)

You should be ashamed >:p

Efficiency in GUI is extremely hard to achieve, so it should be taken
seriously.

Good luck ^^
 
Top