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

Item Custom Value

Status
Not open for further replies.
Level 7
Joined
Mar 5, 2009
Messages
254
Hello guys,ok i need a help with this : How to edit this trigger,so i can add few items that when they are picked that trigger won't run for them,custom value won't be set for them.
  • item ownership
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • Set tempItem = (Item being manipulated)
      • Set tempInt = (Custom value of tempItem)
      • Set tempForce = (Player group((Owner of (Triggering unit))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (tempInt Equal to 0) or (tempInt Equal to (Player number of (Owner of (Triggering unit))))
        • Then - Actions
          • Item - Set the custom value of tempItem to (Player number of (Owner of (Triggering unit)))
        • Else - Actions
          • Hero - Drop tempItem from (Triggering unit)
          • Game - Display to tempForce the text: You are not allowed...
      • Custom script: call DestroyForce(udg_tempForce)
Idk because im sleepy or what but i can't think of a way right now.
 
Set those items in a variable or store the item-types in a variable (array) and an if then else that checks if the (Item being manipulated) is Not Equal to (Item) [Item comparison, if you use item variable(s)] and (Item-type of (Item being manipulated)) is Not Equal to ItemTypeVar[] [Item-type comparison, if you use item-type variable(s)]. Run a loop and include the if/then/else statement within it. Skip remaining actions if the loop has found equality between the acquired item and the variable'd one.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
I would do this with a hashtable.

At map initialization save a boolean for each item type you don't want to set the custom value for. Or save it for the ones you want to save it for if there are lees of those.

When you acquire the item, you just need to check Hashtable - have saved value and check the boolean.
 
Status
Not open for further replies.
Top