• 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] Item drop

Status
Not open for further replies.
Level 9
Joined
Jun 20, 2008
Messages
476
I need some bears to drop items for a time and when theyrespawn they have that change too

Trigger
  • Part 1 discovery
    • Events
      • Unit - A unit enters Rect 001 <gen>
    • Conditions
      • (Owner of (Entering unit)) Not equal to Neutral Hostile
      • (Owner of (Entering unit)) Equal to Player 1 (Red)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of (Entering unit)) Greater than or equal to 3
        • Then - Actions
          • Cinematic - Turn cinematic mode On for Player Group - Player 1 (Red)
          • Cinematic - Disable user control for Player Group - Player 1 (Red)
          • Cinematic - Turn on letterbox mode (hide interface) for Player Group - Player 1 (Red): fade out over 0.50 seconds
          • Camera - Apply Camera 001 <gen> for Player 1 (Red) over 0.00 seconds
          • Cinematic - Send transmission to Player Group - Player 1 (Red) from Rifleman 0001 <gen> named Hunter: Play No sound and display Now i got you. Modify duration: Add 0.00 seconds and Wait
          • Animation - Play Rifleman 0001 <gen>'s attack animation
          • Cinematic - Send transmission to (All players) from (Entering unit) named (Name of (Entering unit)): Play No sound and display Hello. Modify duration: Add 0.00 seconds and Wait
          • Cinematic - Send transmission to (All players) from Rifleman 0001 <gen> named Hunter: Play No sound and display Darn it i missed yo.... Modify duration: Add 0.00 seconds and Wait
          • Cinematic - Send transmission to (All players) from (Entering unit) named (Name of (Entering unit)): Play No sound and display Sorry i didnt ment .... Modify duration: Add 0.00 seconds and Wait
          • Cinematic - Send transmission to (All players) from Rifleman 0001 <gen> named Hunter: Play No sound and display Nah dont worry abou.... Modify duration: Add 0.00 seconds and Wait
          • Cinematic - Send transmission to (All players) from (Entering unit) named (Name of (Entering unit)): Play No sound and display I wanna do a qeust..... Modify duration: Add 0.00 seconds and Wait
          • Cinematic - Send transmission to (All players) from Rifleman 0001 <gen> named Hunter: Play No sound and display Yes i got one. The.... Modify duration: Add 0.00 seconds and Wait
          • Cinematic - Send transmission to (All players) from (Entering unit) named (Name of (Entering unit)): Play No sound and display Ok then il be on my.... Modify duration: Add 0.00 seconds and Wait
          • Cinematic - Turn cinematic mode Off for Player Group - Player 1 (Red)
          • Cinematic - Enable user control for Player Group - Player 1 (Red)
          • Cinematic - Turn off letterbox mode (show interface) for Player Group - Player 1 (Red): fade in over 2.00 seconds
          • Trigger - Turn on Part 2 getting the hide <gen>
          • Trigger - Run Part 2 getting the hide <gen> (checking conditions)
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Game - Display to Player Group - Player 1 (Red) the text: You need atleast le...
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
I need some bears to drop items for a time and when theyrespawn they have that change too

You mean when the bear dies, it drops an item? What do you mean "for a time"?

  • Event
    • Unit dies
  • Conditions
    • Unit type of (Triggering unit) equal to bear
  • Actions
    • Set Temp_Loc_1 = Position of (Triggering unit)
    • Create some item at Temp_Loc_1
    • Custom Script: call RemoveLocation(udg_Temp_Loc_1)
  • Conditions
    • (Owner of (Entering unit)) Not equal to Neutral Hostile
    • (Owner of (Entering unit)) Equal to Player 1 (Red)

That neutral hostile condition is unnecessary. If the unit is owned by P1, it can't be owned by NH anyway.
 
Level 12
Joined
May 21, 2009
Messages
994
  • help
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Bear
    • Actions
      • Set Integer = (Random integer number between 1 and 10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer Equal to 1
        • Then - Actions
          • Set Bear_Pos = (Position of (Triggering unit))
          • Item - Create Bear Fur at Bear_Pos
          • Custom script: call RemoveLocation(udg_Bear_Pos)
        • Else - Actions
This gives a 10% chance of dropping bear fur
hope it helps :)

~Catch~
 
Why don't you just have it drop an item on death, set in the object editor?
Because they won't drop it when they respawn...

and he said for a while, so I believe it has something to do with a quest... that once you accept the quest, the items will drop.

Well, I might be completely wrong about the last one, but pre-setting items isn't good, as the items won't drop when the monsters respawn ^^
 
Level 9
Joined
Sep 8, 2004
Messages
633
Because they won't drop it when they respawn...

and he said for a while, so I believe it has something to do with a quest... that once you accept the quest, the items will drop.

Well, I might be completely wrong about the last one, but pre-setting items isn't good, as the items won't drop when the monsters respawn ^^

Good point, if you have them respawn it won't work indeed.
 
There are multiple ways of doing that, I like pre-set simple tables, so I will show you an example here:


  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Drops = (Drops + 1)
      • Set DropType[Drops] = Tome of Agility
      • Set DropCreep[Drops] = Footman
      • Set DropChance[Drops] = 70
      • Set Drops = (Drops + 1)
      • Set DropType[Drops] = Tome of Experience
      • Set DropCreep[Drops] = Knight
      • Set DropChance[Drops] = 50
      • Set Drops = (Drops + 1)
      • Set DropType[Drops] = Crown of Kings +5
      • Set DropCreep[Drops] = Knight
      • Set DropChance[Drops] = 10

  • Drop Trigger
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 12 (Brown)
    • Actions
      • Set loc[1] = (Position of (Triggering unit))
      • For each (Integer i) from 1 to Drops, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Triggering unit)) Equal to DropCreep[i]
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Random integer number between 1 and 100) Less than or equal to DropChance[i]
                • Then - Actions
                  • Item - Create DropType[i] at loc[1]
                • Else - Actions
            • Else - Actions
      • Custom script: call RemoveLocation(udg_loc[1])
Basically: a footman has a 70% chance to drop a tome, a knight has a 10% chance to drop a +15 claws and a 50% chance to drop an exp tome.
No need to change the second trigger, only fill the table at the start.

Variables:

Variable NameVariable TypeArray?

DropChance
IntegerYes

DropCreep
Unit-TypeYes

DropItem
Item-TypeYes

Drops
IntegerNo

i
IntegerNo

loc
PointYes (not required, though)
 
Status
Not open for further replies.
Top