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

Help with a respawn trigger

Status
Not open for further replies.
Level 4
Joined
Sep 24, 2010
Messages
17
First of all, if this is the wrong place, then please move this thread somewhere else.
I am in need of a help with a trigger, i put an item drop table for a creep, but when i do the trigger of creating the same type of unit at his dying location it spawns him without the item table, is there any trigger to respawn a unit, keeping his item drop table ( i don't really want triggered item drops, i want to keep the table on the unit )
Thanks of replying.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
The only way, is triggers them...
  • Unit Dead
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
    • Actions
      • Set LocationDropItem = (Position of (Triggering unit))
      • Item - Create Tome of Experience at LocationDropItem
      • Custom script: call RemoveLocation(udg_LocationDropItem)
What you can change from the trigger above is;
The TYPES of unit dies
What types of item you want it appear
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
I wish it's that simple Gang =D
The unit doesn't own the item from the start LOL
We just create the item from trigger
Your way can be used if the unit is UNIQUE/SPECIAL like Boss or Special Neutral or something
They will hold keys/weapons
THAT, you can set the item to Drop when user Dies
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
It is possible to retain the drop table, but only for heroes. Otherwise you must trigger the dropped items.

  • Untitled Trigger 039
    • Events
    • Conditions
    • Actions
      • Set UType[0] = Footman
      • Set UType[1] = Knight
      • Set IType[0] = Claws of Attack +15
      • Set IType[1] = Crown of Kings +5
  • Untitled Trigger 042
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • For each (Integer loopA) from 0 to 1, 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 UType[loopA]
            • Then - Actions
              • Set p1 = (Position of (Triggering unit))
              • Item - Create IType[loopA] at p1
              • Custom script: call RemoveLocation(udg_p1)
              • Skip remaining actions
            • Else - Actions
Or better than this, you can initialize the item type dropped for every unit in the map at map initialization. Then load the item type(s) when the unit dies and drop them. Create another unit ofthe same type to replace the dead unit, and pass the item type to the new unit.

EDIT: Add a condition if needed, so it doesn't run for all units that die.
 
Level 4
Joined
Sep 24, 2010
Messages
17
Ok thanks for help i really apreaciate it. It worked, i wanted specific unit types drop this item, and it worked thx to all ( +rep ):thumbs_up::thumbs_up:
Also works for items that have a chance to drop right? just need to change trigger a bit?i mean for like 2 items, one has 60% to drop other has like 20%, it works by changing trigger of items droped right?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
If you want to randomize the chances, then you can do it like this. All units have 60% chance to drop from IType1 array, and 20% chance to drop from IType2 array. Both items can't drop. 20% chance to drop nothing.

You could save the percentages to arrays too to get different percentages for different unit types.


  • Untitled Trigger 042
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • For each (Integer loopA) from 0 to 1, 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 UType[loopA]
            • Then - Actions
              • Set i1 = (Random integer number between 1 and 100)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • i1 Less than or equal to 60
                • Then - Actions
                  • Set p1 = (Position of (Triggering unit))
                  • Item - Create IType1[loopA] at p1
                  • Custom script: call RemoveLocation(udg_p1)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • i1 Less than or equal to 80
                    • Then - Actions
                      • Set p1 = (Position of (Triggering unit))
                      • Item - Create IType2[loopA] at p1
                      • Custom script: call RemoveLocation(udg_p1)
                    • Else - Actions
              • Skip remaining actions
            • Else - Actions
 
Status
Not open for further replies.
Top