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

respawn units

Status
Not open for further replies.
Level 3
Joined
Nov 17, 2009
Messages
42
I cant figure out how to get units to respawn and drop items from the item table.

Everything I try will respawn the unit but they wont drop items. I tried scritping the item tables in via varibles but I couldn't figure it out eather :cry:

Any help well be well greatly appreciated :grin:
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Drop Only:


  • Init Drops
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- --------
      • Set CountDrops = (CountDrops + 1)
      • Set UnitType[CountDrops] = Peasant
      • Set DroppedItem[CountDrops] = Claws of Attack +15
      • Set DropChance[CountDrops] = 10.00
      • -------- --------
      • Set CountDrops = (CountDrops + 1)
      • Set UnitType[CountDrops] = Footman
      • Set DroppedItem[CountDrops] = Crown of Kings +5
      • Set DropChance[CountDrops] = 1.00
      • -------- --------
      • Set CountDrops = (CountDrops + 1)
      • Set UnitType[CountDrops] = Knight
      • Set DroppedItem[CountDrops] = Kelen's Dagger of Escape
      • Set DropChance[CountDrops] = 100.00
      • -------- --------
      • Set CountDrops = (CountDrops + 1)
      • Set UnitType[CountDrops] = Knight
      • Set DroppedItem[CountDrops] = Orb of Frost
      • Set DropChance[CountDrops] = 40.00
This sets up the table needed for the drops.
I believe this is simple:
  • CountDrops is just a temporary integer for simplicity, no need to change that.
  • UnitType is the unit type of the dying unit.
  • DroppedItem is the item type of the item the unit drops
  • DropChance is the chance to drop that item.
If you add a unit twice to the table, he can drop multiple items.


  • Drop
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • For each (Integer LoopInt) from 1 to CountDrops, 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 UnitType[LoopInt]
            • Then - Actions
              • Set Real = (Random real number between 0.00 and 100.00)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Real Less than or equal to DropChance[LoopInt]
                • Then - Actions
                  • Set TempLoc = (Position of (Triggering unit))
                  • Item - Create DroppedItem[LoopInt] at TempLoc
                  • Custom script: call RemoveLocation(udg_TempLoc)
                • Else - Actions
            • Else - Actions
You basically don't need to change this: if the dying unit = one of the units you set up in the table, then it has a chance to drop the item you set it to drop.
 
Status
Not open for further replies.
Top