• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Give Item to Unit/Hero

Status
Not open for further replies.
Level 10
Joined
May 21, 2006
Messages
323
I created a trigger where I simply want to give an item to a dummyunit, but it doesnt work

I create a random item (it works)

Then give Last Created Item to Last Created Unit

And it doesnt work

Can anyone tell me when the "Give Item to Hero" Action doesn´t work.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
just wondering why you wanna give a dummy an item Oo would be nice if you would say why ^^
Some abilities cannot be directly accessed by GUI functions, such as Wand of Illusion ability.
There's a big chance that the thread starter wants to give the item to the dummy and order it to use that item to a unit.
There is a function directly for that, call IssueTargetOrderById(whichUnit, integerOrder, whichTarget)
Which if he wants to order the dummy to use Wand of Illusion base ability, the integerOrder would be '852274'

I wonder if the dummy even have an inventory ^^
Haha this could be the problem too !

But we as claptomaniac stated, why do you need to give item to dummy in the first place ?
If you tell us what you want to achieve, there could be simpler ways
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Ah sorry about the ' '.
Yes, it should be just 852274, no ' ' involve.

' ' exist when the ID is converted to letter, such as Aloc, Abun, Avul, etc.

Like if you want to add ability to a unit;
call UnitAddAbility(udg_Caster, 'Aloc')

You cannot write just Aloc, it will return as null value.
 
Level 10
Joined
May 21, 2006
Messages
323
Answer

  • NPC Loot Death
    • Events
      • Unit - A unit Dies
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • ((Owner of (Killing unit)) is an enemy of (Owner of (Dying unit))) Equal to True
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of (Triggering unit)) Equal to Player 11 (Dark Green)
              • (Owner of (Triggering unit)) Equal to Player 12 (Brown)
    • Actions
      • Set NPCDeadUnitType = (Unit-type of (Triggering unit))
      • Set NPCDeathFacing = (Facing of (Triggering unit))
      • Set TempPoint = (Position of (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is A Hero) Equal to True
        • Then - Actions
          • Set TempInteg = (Hero level of (Triggering unit))
        • Else - Actions
          • Set TempInteg = (Level of (Triggering unit))
      • Unit - Create 1 Loot for Player 10 (Light Blue) at TempPoint facing NPCDeathFacing degrees
      • Unit - Turn collision for (Last created unit) Off
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Killing unit)) is in PlayerGroupAlliance) Equal to True
        • Then - Actions
          • Unit - Change ownership of (Last created unit) to Player 9 (Gray) and Change color
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Owner of (Killing unit)) is in PlayerGroupHorde) Equal to True
            • Then - Actions
              • Unit - Change ownership of (Last created unit) to Player 10 (Light Blue) and Change color
            • Else - Actions
      • Unit Group - Add (Last created unit) to NPCLootDeathGroup
      • Unit - Add a 60.00 second Generic expiration timer to (Last created unit)
      • Set LootUnit = (Last created unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Dying unit) is A Hero) Equal to False
        • Then - Actions
          • Set LootEvent = 1.00
          • Set LootEvent = 0.00
        • Else - Actions
          • Set LootEvent = 10.00
          • Set LootEvent = 0.00

  • NPC LootEvent
    • Events
      • Game - LootEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • TempInteg Greater than 0
              • TempInteg Less than or equal to 4
        • Then - Actions
          • Set LootLevel = 1
        • Else - Actions
      • Set LootEvent = 2.00
      • Set LootEvent = 0.00
  • Game - LootEvent becomes Equal to 2.00
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • Then - Actions
      • Set NPCLootSearcher = (Random real number between 0.00 and 200.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • NPCLootSearcher Less than or equal to 200.00
        • Then - Actions
          • Item - Create (Item-type of (Random item in ItemsNormalRect[LootLevel])) at (Center of (Playable map area))
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • NPCLootSearcher Greater than 20.00
                  • NPCLootSearcher Less than or equal to 30.00
            • Then - Actions
              • Item - Create (Item-type of (Random item in ItemsRareRect[LootLevel])) at (Center of (Playable map area))
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • And - All (Conditions) are true
                    • Conditions
                      • NPCLootSearcher Greater than 30.00
                      • NPCLootSearcher Less than or equal to 35.00
                • Then - Actions
                  • Item - Create (Item-type of (Random item in ItemsSuperRareRect[LootLevel])) at (Center of (Playable map area))
                • Else - Actions
      • Hero - Give (Last created item) to LootUnit
    • Else - Actions

Ok I am creating an ORPG and I created a system where, when you kill a NPC unit at its Corpse a chest appears this is the "LootUnit", this LootUnit has an inventory with 6 spaces.

When the Lootunit appeared you can use a lootability on the unit, then a Multiboard pops up and shows the Items in it again, with the arrow keys up and down you can switch your selection between the items and with the right arrow key you can confirm your decision.

My problem is that the Item is created but the Lootunit doesnt get it.

The unit is unable to move, not invulnerable and cannot attack.
 
Status
Not open for further replies.
Top