• 🏆 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] Gargoyle Stone Form trigger troubles

Status
Not open for further replies.
Level 8
Joined
Mar 17, 2016
Messages
133
Hello, I'm trying to make a trigger that will cause all gargoyles on my map to cast stone form when the sun comes up and return to gargoyle form when the moon comes up. However, I've been having some serious troubles trying to get it to work properly.

Here's what I have set up; the gargoyles are placed upon the map in Stone form. When night time rolls around they are given stone form and ordered to use it, then it is removed to ensure they do not use it when being attacked to regen HP and turn invulnerable.

  • MoonlightNPC Night
    • Events
      • Player - Player 1 (Red) types a chat message containing 18 as An exact match (test purposes)
      • Game - The in-game time of day becomes Equal to 18.00
    • Conditions
    • Actions
      • Set VariableSet TempUnitType = Moonlight Gargoyle - StoneForm
      • Custom script: set udg_TempNPCGroup = GetUnitsOfType(udg_TempUnitType)
      • Unit Group - Pick every unit in TempNPCGroup and do (Actions)
        • Loop - Actions
          • Unit - Add Stone Form to (Picked unit)
          • Unit - Order (Picked unit) to Undead Gargoyle - Gargoyle Form.
          • Unit - Remove Stone Form from (Picked unit)
        • Custom script: call DestroyGroup(udg_TempNPCGroup)
  • MoonlightNPC Day
    • Events
      • Player - Player 1 (Red) types a chat message containing 6 as An exact match
      • Game - The in-game time of day becomes Equal to 6.00
    • Conditions
    • Actions
      • Set VariableSet TempUnitType = Moonlight Gargoyle
      • Custom script: set udg_TempNPCGroup = GetUnitsOfType(udg_TempUnitType)
      • Unit Group - Pick every unit in TempNPCGroup and do (Actions)
        • Loop - Actions
          • Unit - Add Stone Form to (Picked unit)
          • Unit - Order (Picked unit) to Undead Gargoyle - Stone Form.
          • Unit - Remove Stone Form from (Picked unit)
      • Custom script: call DestroyGroup(udg_TempNPCGroup)
What ends up happening is the beginning works perfectly, they turn from stone form to gargoyle form when the game time turns to 18:00. Then, when they are meant to return to stone form they do nothing and stay in gargoyle form for the rest of the game.
I know the triggers are both firing because I made sure of it through a test, and I've tried replacing the order to "order unit to Gargoyle - Gargoyle Form" on both triggers (as it works on the nighttime one but for some reason not the daytime one)
Is there any reason this trigger may not function properly, or is there a workaround? Thanks.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,517
Instead of adding/removing the abilities, simply hide the ability by default.

To do this:
Set Stone Forms Button Positions for Normal/Turn Off to 0,-11. (See attached picture)
Remove the Hotkeys.
Remove the Requirements.

Then for the triggers:
  • Day
    • Events
      • Game - The in-game time of day becomes Equal to 6.00
    • Conditions
    • Actions
      • Set VariableSet TempGroup = (Units of type Gargoyle)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Undead Gargoyle - Stone Form.
      • Custom script: call DestroyGroup (udg_TempGroup)
  • Night
    • Events
      • Game - The in-game time of day becomes Equal to 18.00
    • Conditions
    • Actions
      • Set VariableSet TempGroup = (Units of type Stone Form Gargoyle)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Undead Gargoyle - Gargoyle Form.
      • Custom script: call DestroyGroup (udg_TempGroup)
You also don't need to use Custom script for creating your Unit Groups. See my triggers.

Another mistake, you're destroying the Unit Groups INSIDE of the Pick Every Unit function, which will destroy the group after the first unit is picked. Make sure to do it after like I did in my triggers.

Edit: And to clarify, I assume the reason it wasn't working is because you're removing the abilities. It's either screwing with things because you're removing the ability before it finishes casting, OR, the problem is that Stone Form is a toggle ability (Turn On/Turn Off), and by removing/adding the ability you are simply giving them the Turn On form of the ability again and again.
 

Attachments

  • example.png
    example.png
    112.8 KB · Views: 28
Last edited:
Level 8
Joined
Mar 17, 2016
Messages
133
I did forget to mention that the gargoyles are all controlled by an NPC user (Neutral Hostile), will hiding the ability still prevent the AI from casting the ability mid combat?

Also, thanks for the cleaner triggers. I guess for some reason I thought it would leak unless I added a custom method of picking all units of type.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,517
I did forget to mention that the gargoyles are all controlled by an NPC user (Neutral Hostile), will hiding the ability still prevent the AI from casting the ability mid combat?

Also, thanks for the cleaner triggers. I guess for some reason I thought it would leak unless I added a custom method of picking all units of type.
I don't think it would prevent them from casting the ability, it's not like they need to press a hotkey or manually click the button.

But if it does cause problems a possible alternative solution is to use your original triggers (with my fixes), but this time create a new Stone Form ability that is reversed, changing the unit from Stone Form to Normal Form by default. So one ability changes from Normal -> Stone, and the other ability changes from Stone -> Normal. Then add/use/remove the appropriate ability in each trigger.
 
Last edited:
Level 8
Joined
Mar 17, 2016
Messages
133
Thank you for your input, after shining a bit of light on the issue i was able to figure out a sort of fix that will suffice for the purpose of this ability.

The fix involved swapping which version of the unit was in the "Alternate" field and which was "Normal form". I believe this was necessary because the unit was spawned as the stone form, so they needed to be swapped.

To work around the NPC using stone form whenever attacked I looked up how long a day/night cycle is (240 seconds) and just put the cooldown to that, preventing the ability from being used in any other situation.

lastly, all that I needed was to add the "Morph" tag to the unit after ordering it to stone form, not certain why it was needed but probably because of the inverted units in the stone form ability itself.

Thank you for the help! I figured I'd write the fix in case, for whatever reason, somebody else needs it in the future.
 
Status
Not open for further replies.
Top