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

[Trigger] Replacing Unit and Inventory Slot Problem

Status
Not open for further replies.
Level 2
Joined
Dec 19, 2015
Messages
12
I have already tried bear form and chaos grunt, they both didn't work for the way I wanted. The Replace action works the best besides for one problem. If the casting unit of Transform has items in inventory slots 2 to 6 but not 1, the replaced unit that gets the items from the casting unit has his inventory all mixed up.

Example:

Casting Unit has items in slots 3 and 4.

Casting Unit uses the ability Transform.

Casting Unit's items go into the inventory of the replaced unit.

The replaced unit has the items in inventory slots 1 and 2 now.

How can you make it so the inventory slots match for both casting and the replaced unit?

I am hoping it will be MUI.


  • Transform Evil
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Transform
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to /w Nothing (Male)
        • Then - Actions
          • Custom script: call UnitRemoveAbility( GetTriggerUnit(), 'AHbu')
          • Unit - Replace (Triggering unit) with a Vampire using The old unit's relative life and mana
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Triggering unit)) Equal to Vampire
            • Then - Actions
              • Custom script: call UnitAddAbility( GetTriggerUnit(), 'AHbu')
              • Unit - Replace (Triggering unit) with a /w Nothing (Male) using The old unit's relative life and mana
            • Else - Actions
      • Hero - Set (Last replaced unit) Hero-level to (Hero level of (Triggering unit)), Hide level-up graphics
      • Hero - Set (Last replaced unit) experience to (Hero experience of (Triggering unit)), Hide level-up graphics
      • Hero - Modify Strength of (Last replaced unit): Set to (Strength of (Triggering unit) (Exclude bonuses))
      • Hero - Modify Agility of (Last replaced unit): Set to (Agility of (Triggering unit) (Exclude bonuses))
      • Hero - Modify Intelligence of (Last replaced unit): Set to (Intelligence of (Triggering unit) (Exclude bonuses))
      • Hero - Give (Item carried by (Triggering unit) in slot 1) to (Last replaced unit)
      • Hero - Give (Item carried by (Triggering unit) in slot 2) to (Last replaced unit)
      • Hero - Give (Item carried by (Triggering unit) in slot 3) to (Last replaced unit)
      • Hero - Give (Item carried by (Triggering unit) in slot 4) to (Last replaced unit)
      • Hero - Give (Item carried by (Triggering unit) in slot 5) to (Last replaced unit)
      • Hero - Give (Item carried by (Triggering unit) in slot 6) to (Last replaced unit)
      • Selection - Add (Last replaced unit) to selection for (Owner of (Triggering unit))
I updated it with a method I thought up, but it doesn't seem to be working.

  • Transform Evil
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Transform
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to /w Nothing (Male)
        • Then - Actions
          • Custom script: call UnitRemoveAbility( GetTriggerUnit(), 'AHbu')
          • Unit - Replace (Triggering unit) with a Vampire using The old unit's relative life and mana
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Triggering unit)) Equal to Vampire
            • Then - Actions
              • Custom script: call UnitAddAbility( GetTriggerUnit(), 'AHbu')
              • Unit - Replace (Triggering unit) with a /w Nothing (Male) using The old unit's relative life and mana
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has (Item carried by (Triggering unit) in slot 1)) Equal to True
        • Then - Actions
          • Hero - Create (Item-type of (Item carried by (Triggering unit) in slot 1)) and give it to (Last replaced unit)
        • Else - Actions
          • Hero - Create Potion of Healing and give it to (Last replaced unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has (Item carried by (Triggering unit) in slot 2)) Equal to True
        • Then - Actions
          • Hero - Create (Item-type of (Item carried by (Triggering unit) in slot 2)) and give it to (Last replaced unit)
        • Else - Actions
          • Hero - Create Potion of Healing and give it to (Last replaced unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has (Item carried by (Triggering unit) in slot 3)) Equal to True
        • Then - Actions
          • Hero - Create (Item-type of (Item carried by (Triggering unit) in slot 3)) and give it to (Last replaced unit)
        • Else - Actions
          • Hero - Create Potion of Healing and give it to (Last replaced unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has (Item carried by (Triggering unit) in slot 4)) Equal to True
        • Then - Actions
          • Hero - Create (Item-type of (Item carried by (Triggering unit) in slot 4)) and give it to (Last replaced unit)
        • Else - Actions
          • Hero - Create Potion of Healing and give it to (Last replaced unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has (Item carried by (Triggering unit) in slot 5)) Equal to True
        • Then - Actions
          • Hero - Create (Item-type of (Item carried by (Triggering unit) in slot 5)) and give it to (Last replaced unit)
        • Else - Actions
          • Hero - Create Potion of Healing and give it to (Last replaced unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has (Item carried by (Triggering unit) in slot 6)) Equal to True
        • Then - Actions
          • Hero - Create (Item-type of (Item carried by (Triggering unit) in slot 6)) and give it to (Last replaced unit)
        • Else - Actions
          • Hero - Create Potion of Healing and give it to (Last replaced unit)
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Item - Remove (Item carried by (Last replaced unit) of type Potion of Healing)
      • Hero - Set (Last replaced unit) Hero-level to (Hero level of (Triggering unit)), Hide level-up graphics
      • Hero - Set (Last replaced unit) experience to (Hero experience of (Triggering unit)), Hide level-up graphics
      • Hero - Modify Strength of (Last replaced unit): Set to (Strength of (Triggering unit) (Exclude bonuses))
      • Hero - Modify Agility of (Last replaced unit): Set to (Agility of (Triggering unit) (Exclude bonuses))
      • Hero - Modify Intelligence of (Last replaced unit): Set to (Intelligence of (Triggering unit) (Exclude bonuses))
      • Selection - Add (Last replaced unit) to selection for (Owner of (Triggering unit))
Basically if the slot is empty, then you give the replaced unit a dummy item which in this case is the potion of healing.

All the dummy items get removed from a loop.

The potion of healing drops from the unit however and the items still don't go into the correct inventory slots.
 
Last edited:
Status
Not open for further replies.
Top