1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Help with a respawn trigger

Discussion in 'World Editor Help Zone' started by Zinox, Nov 15, 2010.

  1. Zinox

    Zinox

    Joined:
    Sep 24, 2010
    Messages:
    15
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    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.
     
  2. defskull

    defskull

    Joined:
    Mar 27, 2008
    Messages:
    7,978
    Resources:
    17
    Spells:
    17
    Resources:
    17
    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
     
  3. GangSpear

    GangSpear

    Joined:
    Oct 25, 2009
    Messages:
    971
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Set the item to Drop when death?It is simple 0.0
     
  4. defskull

    defskull

    Joined:
    Mar 27, 2008
    Messages:
    7,978
    Resources:
    17
    Spells:
    17
    Resources:
    17
    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
     
  5. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,181
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    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.
     
  6. defskull

    defskull

    Joined:
    Mar 27, 2008
    Messages:
    7,978
    Resources:
    17
    Spells:
    17
    Resources:
    17
    My trigger solution works only for Neutral Creeps or something
    Maker's will work for almost anything and everything that includes in the map (more specific)
    Choose wisely =D
     
  7. Zinox

    Zinox

    Joined:
    Sep 24, 2010
    Messages:
    15
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    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?
     
  8. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,181
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    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.


    Trigger
    • 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
     
  9. Zinox

    Zinox

    Joined:
    Sep 24, 2010
    Messages:
    15
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    Thanks Maker, but i figured out a pretty good way other than triggers, i can make all creeps heros, remove xp gain, and make all attributes 1, so when they die, i easily revive, keeping the drop table, thanks though for replying