Drop a item to unit or ground condition

Lord Regno

Active Member
Reaction score
19
A unit loses an item
A unit acquire an item
A unit uses an item

But this does not exits: "A unit drops an item"

The thing I want to do is:
Event
A unit loses an item
Condition
Action:
If then else
if unit gives item to another unit
then
remove item 1
create item 2 and give it to another unit
else
remove item 1
crate item 2 at location at dropping unit
 

denmax

You can change this now in User CP.
Reaction score
155
Well, you can create three triggers

The first trigger would basically just set a variable to the (dropped item), and turn on second trigger and third trigger.
The second trigger would check if the acquired item is the variable, then create a boolean to say it is false.
The third trigger has a 0.2 second event, with a condition that checks if the boolean is true. If it so happens, it will do your actions.

basically

Trigger:
  • First Trigger
    • Events
      • Unit - A unit drops an item
    • Condition
      • Item is (Your item)
    • Actions
      • Set DroppedItemVariable = Dropped item
      • Set PositionOfItem = Position of Triggering unit
      • Trigger - Turn on (Third Trigger)


Trigger:
  • Second Trigger
    • Events
      • Unit - A unit acquires an item
    • Condition
      • (Acquired item) equal to DroppedItemVariable
    • Actions
      • Remove (DroppedItemVariable)
      • Create (item) for (Triggering unit)
      • Set DroppedItemVariable = null
      • Set DroppedOnGroundBoolean = False


Trigger:
  • Third Trigger - Initially off
    • Events
      • Every 0.2 seconds
    • Condition
      • DroppedOnGroundBoolean equal to True
    • Actions
      • Remove (DroppedItemVariable)
      • Create (item) at PositionOfItem
      • Set DroppedItemVariable = null
      • Set PositionOfItem = null
      • Trigger - Turn off (This trigger)



I hope you understand what I'm trying to do here. This isn't the exact code in the WE, so try to look for something similar to this.
 

vypur85

Hibernate
Reaction score
803
> But this does not exits: "A unit drops an item"
My bad. It's 'Loses an item'. Same thing.


For this,
else
remove item 1
crate item 2 at location at dropping unit
do this:
Code:
Event
 Unit loses item
Condition
 Item type (Item being manipulated) Equal to Item1
Action
 Trigger - Turn off (This trigger)
 Item - Create Item2 at Position of Triggering unit
 Item - Remove Item being manipulated
 Trigger - Turn on (This trigger)


For this,
if unit gives item to another unit
then
remove item 1
create item 2 and give it to another unit
do this:
Code:
Event
 Unit acquires item
Condition
 Item type (Item being manipulated) Equal to Item1
Action
 Item - Remove Item being manipulated
 Hero - Create Item2 and give to (Triggering unit)

Only 2 triggers.
As for the second code, you'd need a special condition somewhere whenever the 'giver' hero acquires Item1. This depends on your map. What kinda condition that the 'giver' has to get item1 and what kinda condition has when 'receiver' gets item1. More explanation might help the case.
 

denmax

You can change this now in User CP.
Reaction score
155
If a recipient acquires an item, wouldn't it also count as the donor losing it?

If your donor gives it to a recipient, then both "losing an item" and "acquiring an item" events trigger, wouldn't it? Both triggers would like to delete (probably) the same item, and create a new one for every trigger (which results in to two).
 

vypur85

Hibernate
Reaction score
803
> wouldn't it also count as the donor losing it?
Not sure about that. But if that's the case, in the second trigger, turn off trigger 1 and create the item and remove it, and then turn on trigger 1 again.
 

Lord Regno

Active Member
Reaction score
19
Thanks for all help, because of your help I made it to work with others trigger I had. However it took time to resolve so that all triggers work together thats why I haven't replied on a time.
+ Rep (How do you rep peopels nowdays?)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top