• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Need constant Item drop ^^...

Status
Not open for further replies.
Level 3
Joined
Dec 26, 2004
Messages
43
Hello, I want my creeps to drop a particular item, even the creeps that aren't on the map yet (Are created afterwards...) , how do I do it ?
 
Level 8
Joined
Feb 20, 2007
Messages
338
  • Gold Drop
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Item - Create Gold Coins at (Position of (Dying unit))
If you do not want this created at just any unit's death, then use a condition.

If you have several types of units that drop different things then you would use the If/Then/Else function as an action where you can use different conditions for different unit types or owners and drop different items.

  • Item Drop
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Dying unit) is A Hero) Equal to True
        • Then - Actions
          • Item - Create Gold Coins at (Position of (Dying unit))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Dying unit)) Equal to Footman
        • Then - Actions
          • Item - Create Replenishment Potion at (Position of (Dying unit))
        • Else - Actions
If you have a lot of units that will die and want a bit of randomness with how often that object drops a one trigger method of adding "randomness" to how often the dropping takes place would be:

  • Gold Drop
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Item - Create Gold Coins at (Position of (Dying unit))
      • Wait 0.10 seconds
      • Trigger - Turn off (This trigger)
      • Wait (Random real number between 15.00 and 90.00) seconds
      • Trigger - Turn on (This trigger)
All of which are variations on a theme.
 
Level 6
Joined
Nov 28, 2007
Messages
203
Here's some "randomness" :D
  • Special item drop chance
    • Events
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Set Dropchance = (Random integer number between 1 and 100)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Thunderfury_Dropchance Equal to 1
        • Then - Actions
          • Item - Create Thunderfury at (Position of (Triggering unit))
        • Else - Actions
"Dropchance" is an integer.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
In case you want a random system for a huge number of items, you would like to set all your drop items to a variable harray and then use loops to make it, like the example below


  • Unknown
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set Item[1] = Claws of Attack +15
      • Set Item[2] = Thunder Phoenix Egg
      • Set Item[3] = Amulet of the Wild
      • Set Item[4] = Potion of Omniscience
      • Set Item[5] = Sun Key
  • Unknown2
    • Events
      • Unit - A unit Dies
    • Conditions
      • Conditions
    • Actions
      • Set Integer = (Random integer number between 1 and 5)
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Integer Equal to (Integer A)
            • Then - Actions
              • Set Point = (Position of (Triggering unit))
              • Item - Create Item[(Integer A)] at Point
              • Custom script: call RemoveLocation(udg_Point)
            • Else - Actions

You could change chances of drop by changing numbers, for example setting a normal items with 1 number beetwin each one (num1=1, num2=2 etc.) and rare items with bigger diffrence in numbers (num5=10, num6=20, num7=50 etc.).
 
Level 6
Joined
Feb 2, 2005
Messages
205
Err that loop dosn't make sense to me, it would work without it. Would look like this.

  • Events
    • Unit - A unit Dies
  • Conditions
  • Actions
    • Custom script:local integer udg_X
    • Custom script:local location udg_Point
    • Set X = (Random integer number between 1 and 5)
    • Set Point = (Position of (Triggering unit))
    • Item - Create Item[X] at Point
    • Custom script: call RemoveLocation(udg_Point)
Add local variables too. The Dropping could get wired when multiple Units are killed at the same time.
 
Status
Not open for further replies.
Top