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

[Solved] Removing/Adding Inventory (Hero) Ability.

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
Hi!

In the RPG i'm making, when a hero dies, it's revived inmediatly and all skills (even Attack) are disabled for owner of the dying unit. Also the 'Inventory (Hero) ability' is disabled.

When a hero reaches a revival point, the whole process is reversed. Everything is OK, except for the inventory. When the inventory ability is re-enabled all the items the hero had on it's inventory are dropped around.

I'd like to know how to avoid that... so the hero has it's item on the inventory when the Inventory ability is enabled again.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Well.. thanks a lot. I took Drakgrom/defskull suggestions.

defskull, your system is MUI but far more complicated than I expected, and than needed :) I just never tough about that. Finally, I did this:

When hero dies: (Among other actions)
  • Hero dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Set A = (Triggering unit)
      • Set Temp_Point = (Position of A)
      • Set TempPlayer = (Owner of A)
      • Unit - Create 1 Death Inventory for Neutral Passive at Temp_Point facing Default building facing degrees
      • Set DeathInventory[(Player number of TempPlayer)] = (Last created unit)
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Hero - Give (Item carried by A in slot (Integer A)) to DeathInventory[(Player number of TempPlayer)]
      • Player - Disable Inventory (Hero) for TempPlayer
      • Custom script: call RemoveLocation(udg_Temp_Point)
When hero Revives: (Among other actions)
  • Hero revive NPC
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • ((Buying unit) is A Hero) Equal to True
      • (Unit-type of (Sold unit)) Equal to Revive
    • Actions
      • Unit - Remove (Sold unit) from the game
      • Set A = (Buying unit)
      • Set Temp_Point = (Position of A)
      • Set TempPlayer = (Owner of A)
      • Player - Enable Inventory (Hero) for (Owner of A)
      • Unit - Move DeathInventory[(Player number of TempPlayer)] instantly to Temp_Point
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Hero - Give (Item carried by DeathInventory[(Player number of TempPlayer)] in slot (Integer A)) to A
      • Unit - Remove DeathInventory[(Player number of TempPlayer)] from the game
      • Custom script: call RemoveLocation(udg_Temp_Point)
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Well, your system is MPI, not MUI

MUI - Multi-unit Instaceable
It allows the spell to be casted simultaneously without bugging when 2 or more units cast it.

MPI - Multi-player Instanceable
It allows the spell to be casted simultaneously without bugging when 2 or more players cast it.

If for example, you can have 2 hero per player, the system above would bug, for sure.

You can combine my trigger and yours, to become MUI + MPI trigger, works for both multi-players and multi-units.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Yeah :D Thanks for telling me what MPI and MUI means. My system is MPI, but my map is an RPG where each player has 1 hero, and only heroes can hold items.

EDIT: In fact... i'm adding minipets later, and now I notice that their inventory will be disabled too... So i'll just set the Minipet Dummy Inventory = DeathInventory[(Player number of TempPlayer x 10) :D I'll never have more units with inventories in the map :D So far, this works. If I ever need more, i'll use your system def :) Thanks for it.
 
Status
Not open for further replies.
Top