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

Attachments disappear when I change unit's skin via triggers

Level 9
Joined
Jul 9, 2017
Messages
508
Hello
I've made a trigger where standard paladin model changes to Uther when he takes specific item. Although, all attachments (like aura, buff etc. as well as custom attachments like shield or sword in left/right, hand) disappear when the skin changes. When I am buffed again and I drop the item (and I look like standard paladin again) it happens the same.
Any ideas how to prevent that?
 
Level 21
Joined
Feb 27, 2019
Messages
623
Restoring buffs and aura effects seems tricky to me. For items, this is what I do to restore effects from items such as in your case shield or sword. I do the restoration after the skin has returned to normal but it may just as well be used just as the skin changes. To make sure dropping your item doesnt change the skin again "HideResetItems" bool is for this, the acquire and lose trigger has the condition that "HideResetItems" must be false.

This reset takes into consideration the following: Stacked items will return to their original slot and stack size. It will not interrupt orders. It cant occur if the unit is dead in which case it would drop all of its items and the unit would be restored anyway.

I just thought of a theory that units may be able to restore their effects the same way as hex restores shadows when changing unit skin. You may test this theory and return with the result, try this first. The post on how to do that is located as my lastest post here: [Trigger] - Change Unit Model by GUI
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • PigIsDead[Int] Equal to False
    • Then - Actions
      • Set VariableSet HideResetItems = True
      • For each (Integer CheeseL) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set VariableSet CheeseItems[CheeseL] = (Item carried by AllPigsArray[Int] in slot CheeseL)
          • Set VariableSet CheeseStacks[CheeseL] = (Item: CheeseItems[CheeseL]'s Integer Field: Number of Charges ('iuse'))
          • Item - Set charges remaining in CheeseItems[CheeseL] to CheeseStacksMax
          • Hero - Drop CheeseItems[CheeseL] from AllPigsArray[Int].
      • For each (Integer CheeseL) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CheeseItems[CheeseL] Equal to No item
            • Then - Actions
              • Hero - Give ParmaCheese[CheeseL] to AllPigsArray[Int]
              • Set VariableSet CheeseItems[CheeseL] = ParmaCheese[CheeseL]
            • Else - Actions
              • Hero - Give CheeseItems[CheeseL] to AllPigsArray[Int]
      • Set VariableSet HideResetItems = False
      • For each (Integer CheeseL) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of CheeseItems[CheeseL]) Equal to Cheese
            • Then - Actions
              • Item - Move ParmaCheese[CheeseL] to CheeseLoc
            • Else - Actions
              • Item - Set charges remaining in CheeseItems[CheeseL] to CheeseStacks[CheeseL]
          • Set VariableSet CheeseItems[CheeseL] = No item
    • Else - Actions
 
Level 9
Joined
Jul 9, 2017
Messages
508
Thats great, then ur well rested. Make sure the dummy is set up correctly when you test it.
Thank you. I am.

Also to straight it up
To make sure dropping your item doesnt change the skin again "HideResetItems" bool is for this, the acquire and lose trigger has the condition that "HideResetItems" must be false.
It's actually my intention that the skin changes when the item is in inventory and it is supposed to change back when it's dropped as well.
 
Level 21
Joined
Feb 27, 2019
Messages
623
It's actually my intention that the skin changes when the item is in inventory and it is supposed to change back when it's dropped as well.
Since that trigger drops all items in the units inventory and then gives them back to restore the effects of the items the HideResetItems bool is meant to temporarily disable triggers with the events Acquires an item or Loses an item. That entire trigger wont be needed anyway since I found that restoring the shadow with hex also restores buffs and effects. How to do that is in the thread I posted.
 
Top