• 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.

Re-Getting Items! :)

Status
Not open for further replies.
Level 5
Joined
May 20, 2013
Messages
162
Question of the Day! ;)

I have designed a sidekick for a hero, that in a lot of ways "is" the hero more than the summoning hero unit himself is -at least in terms of active abilities.

But he is also a packmule.

Now, if & when this summoned unit dies, i want the items he is carrying to disappear with him, and be there in his inventory again when he is re-summoned.

I imagine this will involve triggers, but i have never done anything at all with triggering around items!

Any help is appreciated, and Thank You in advance! :)
 
This Sets up the Hashtable we are going to use.
  • Hashtable
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hashtable_Test = (Last created hashtable)
Sets up the Sidekick
  • Setting The Sidekick
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Footman
    • Actions
      • Set TestUnit[(Player number of (Owner of (Summoned unit)))] = (Summoned unit)
This one saves the item and moves it to a place no one can reach it so no one could take it.
  • Death of the Sidekick
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Dying unit) Equal to TestUnit[(Player number of (Owner of (Dying unit)))]
    • Actions
      • Set Temp_Point_1 = (Center of NOwhere <gen>)
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Hashtable - Save Handle Of(Item carried by (Dying unit) in slot (Integer A)) as (Integer A) of (Player number of (Owner of (Dying unit))) in Hashtable_Test
          • Item - Move (Item carried by (Dying unit) in slot (Integer A)) to Temp_Point_1
      • Custom script: call RemoveLocation(udg_Temp_Point_1)
This one gives the items back to the sidekick when it is summoned
  • Summoning The Sidekick
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (TestUnit[(Player number of (Owner of (Summoning unit)))] is dead) Equal to True
      • (Unit-type of (Summoned unit)) Equal to Footman
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Hero - Give (Load (Integer A) of (Player number of (Owner of (Summoned unit))) in Hashtable_Test) to (Summoned unit)
      • Hashtable - Clear all child hashtables of child (Player number of (Owner of (Summoned unit))) in Hashtable_Test
      • Set TestUnit[(Player number of (Owner of (Summoned unit)))] = (Summoned unit)
This should not have any problems but there might be a better system ^^
 
Level 5
Joined
May 20, 2013
Messages
162
Avatars, TY for such a prompt reply! ;)

This isn't working for me.

I see two suspect points.

#1, i do not understand what you mean by
set.gif
Set Temp_Point_1 = (Center of NOwhere <gen>)

The closest i could reach is this:
Set Temp_Point_1 = No region

#2, The unit carrying the items is "just" a summoned unit -not a hero. Is this going to be an issue, using hero trigger actions? Do i need to add a triggered Hero designate to the sidekick?
 
New
set.gif
Set Temp_Point_1 = (Center of NOwhere <gen>)
This should be a place where no one can enter. ( Like a region with boundaries surrounding it so a hero cannot pick the items)

Or instead of moving it to a region you can make a dummy unit with 6 inventory and give it to the dummy. Actually, this sounds better. Let me show you a better version.
I assume you know Dummies if not:
The Dummy(Inventory) has Locust, Hero Inventory.
Art - Model: Extra - Question Mark
Scale - 0.01
Selection Scale - 0.10
Sight Radius (Day and Night) - 0
No Attack, Food cost, Movement speed, Shadow.
  • Death of the Sidekick v2
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Dying unit) Equal to TestUnit[(Player number of (Owner of (Dying unit)))]
    • Actions
      • Set Temp_Point_1 = (Position of (Dying unit))
      • Unit - Create 1 Dummy (Inventory) for (Owner of (Dying unit)) at Temp_Point_1 facing Default building facing degrees
      • Set DummyInventory[(Player number of (Owner of (Dying unit)))] = (Last created unit)
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Hero - Give (Item carried by (Dying unit) in slot (Integer A)) to DummyInventory[(Player number of (Owner of (Dying unit)))]
      • Custom script: call RemoveLocation(udg_Temp_Point_1)
  • Summoning The Sidekick v2
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Footman
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DummyInventory[(Player number of (Owner of (Summoned unit)))] is alive) Equal to True
        • Then - Actions
          • For each (Integer A) from 1 to 6, do (Actions)
            • Loop - Actions
              • Hero - Give (Item carried by DummyInventory[(Player number of (Owner of (Summoned unit)))] in slot (Integer A)) to (Summoned unit)
          • Unit - Remove DummyInventory[(Player number of (Owner of (Summoned unit)))] from the game
        • Else - Actions
      • Set TestUnit[(Player number of (Owner of (Summoned unit)))] = (Summoned unit)
#2 It is not an issue. I made my summoned unit as well. It works with a normal unit.
 
Last edited:
Level 5
Joined
May 20, 2013
Messages
162
WOOOHOOO!!!!

It is working!

Your first version works just fine. The real problem wasn't the location, or the Unit designation. The bug was that when i was pasting your trigger text into the comments section of my trigger, certain bits like the custom script were omitted, and others were formatted just differently enough to confuse the lay-out.

I like your second version a lot better though -it seems cleaner than stashing the items in the map closet.

For whatever reason, it never occurred to me that "NOwhere" was a user created region on the map! I guess that is because i really only mess with the object editor and trigger editor. Maps & regions etc, are off limits to me because i tend to mess them up very quickly and then don't know how to find my way back! ;)

"Is" there any tangible use for the "Unit - Add classification of A Hero to (Triggering unit)" function? I have never found it to actually change anything.

Again, thanks a bunch for offering a solution to this! :)
 
Level 5
Joined
May 20, 2013
Messages
162
Ned, that is a valid option, but right now i am trying for something a little more defined. What i have so far is this: the summoning spell is disabled after the sidekick dies for a period of time of 60 + 15xHero Level game seconds. The mechanism i am using (a dummy unit in .mdl as a tech requirement) makes it so i can easily disable all his skills if i choose too. Right now i am only disabling the one skill. Earlier i was also tinkering with giving him a permanent immolation that only damaged self & allies while the summoning spell was on cooldown. Everything is still on the table. The summoning spell also auto-disables when the sidekick is active, so the player can't just spam a refresh when the unit gets low on health or mana. Once sidekick is active, it is the players job to make sure he doesn't get snuffed. Once the sidekick dies, the player experiences a considerable waiting period before he can be re-summoned. Once the Magi is summoned again, the summoning spell goes back into disabled mode by removing the required .mdl unit.

The funny thing about this hero: his sidekick is actually more fun to play. I'm not quite sure what the appeal is, but i have always loved playing regular units as if they were heroes. That's why i made this particular character. :)
 
Status
Not open for further replies.
Top