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

Item Limitation

Status
Not open for further replies.
Level 11
Joined
Jul 9, 2009
Messages
926
I have done this to limit the equipments to one for each player
  • Ordinary Sword Limit
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
      • (((Buying unit) has an item of type Ordinary Sword) Equal to True) and ((Item-type of (Sold Item)) Equal to Ordinary Sword Display)
    • Actions
      • Player - Add 500 to (Owner of (Buying unit)) Current gold
      • Hero - Drop (Sold Item) from (Buying unit)
      • Item - Remove (Last dropped item)
      • Game - Display to (All players) the text: YOU CAN ONLY EQUIP ...
I have done this but now, when I drop an item, and buy a new one, then I pick the dropped item, It makes him have 2 weapons, what I want is I am unable to have 2 of the same item types in my inventory.
anybody can help ? xD
 
Level 26
Joined
Mar 19, 2008
Messages
3,140
You can use this:
  • Order
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(smart))
      • ((Triggering unit) has an item of type (Item-type of (Target item of issued order))) Equal to True
    • Actions
      • Set temp_point[1] = (Position of (Triggering unit))
      • Set temp_point[2] = (Position of (Target item of issued order))
      • Unit - Order (Triggering unit) to Move To (temp_point[1] offset by 0.01 towards (Angle from temp_point[1] to temp_point[2]) degrees)
      • Set force = (Player group((Owner of (Triggering unit))))
      • Game - Display to force the text: You already have th...
      • Custom script: call DestroyForce (udg_force)
      • Custom script: call RemoveLocation (udg_temp_point[1])
      • Custom script: call RemoveLocation (udg_temp_point[2])
Does anyone know why Triggering unit does not want to Stop while taking order? Look:
  • Smart
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(smart))
      • ((Triggering unit) has an item of type (Item-type of (Target item of issued order))) Equal to True
    • Actions
      • Unit - Order (Triggering unit) to Stop
      • Set force = (Player group((Owner of (Triggering unit))))
      • Game - Display to force the text: You already have th...
      • Custom script: call DestroyForce (udg_force)
Does not work properly.
 
Level 11
Joined
Jul 9, 2009
Messages
926
@Pharaoh I have tried that and it wont work cause acquiring an item also was also like when buying an item ,so even if i did not have any ordinary sword in my inventory and I bought a new one, It would be restricted

@Spinnaker Ill try your suggestion,

EDIT
@Spinnaker IT WORKED ! thanks + rep
 
Level 26
Joined
Mar 19, 2008
Messages
3,140
Heh =)
I agree with condition about No item, but i've posted tewo triggers.

First one works properly, and it's the one that Saif uses. And as you can see it uses order to move unit to given point (I prefer Triggering unit position with an Angle of item's position - it's just me)

However, second trigger has problem with Order stop, what I've explained in previous post.
 
Level 11
Joined
Jul 9, 2009
Messages
926
thanks Pharaoh and Ill try to look at that but now, I have a upgrade system in my map and i dont know how to make a percent for it to have a success and a percent again to fail, thanks again Spinnaker, It was the most important part of the map xD
 
Status
Not open for further replies.
Top