• 🏆 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!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!

[Trigger] Item pickup/drop problem

Status
Not open for further replies.
Level 4
Joined
May 1, 2013
Messages
68
The problem i have is that, when a hero picks a horadric cube up, and the hero doesn't have one, he drops it, which he shouldn't. So if anyone can fix this, please help.

  • Drop
    • Events
      • Unit - A unit owned by Player 1 (Red) Acquires an item
    • Conditions
      • (((Hero manipulating item) has an item of type Horadric Cube) Equal to True) and ((Item-type of (Item being manipulated)) Equal to Horadric Cube)
    • Actions
      • Hero - Drop (Item being manipulated) from (Hero manipulating item)
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Change Hero Manipulating item for Triggering Unit

The hero doesn't have the item, but once he acquires it, you have an item of that type, so, you drop it.

If conditions are automatically nested with "and", so, there's no need to add "and" conditiones unless you use them inside an "or" block.
 
Use a counter and loop through the items the player has and see if its greater than 1 if it is drop the item.

I like this solution, but another possibility would be to set a variable so if hero acquires HC then set HC = HC+1. In the next trigger if HC=2 then do "drop item HC." Basically the same as above. I don't know counters so I thought maybe he doesn't either. Deathismyfriend is always right though so try that first.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
set integer = 0
integer A loop from 1 to 6
--if item type of item carried by triggering unit in slot integer A equal to cube then
----if integer equal to 0 then
------set integer = 1
----else
------drop item being manipulated
------Skip remaining actions
----endif
 
Status
Not open for further replies.
Top