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

[Trigger] Water Regeneration

Status
Not open for further replies.
Level 6
Joined
Apr 1, 2009
Messages
201
Trying to come up with a trigger where whenever a hero enters shallow water they get a regeneration ability and when they leave shallow water, they lose the ability. Here's what I've come up with so far. Every time I test the trigger in game and move my hero into shallow water the game crashes.

  • Startup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to WaterRegenGroup
  • Check
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in WaterRegenGroup and do (Actions)
        • Loop - Actions
          • Set WaterRegenUnit = (Picked unit)
          • Set WaterRegenPoint = (Position of WaterRegenUnit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain pathing at WaterRegenPoint of type Floatability is off) Equal to False
              • (Terrain pathing at WaterRegenPoint of type Walkability is off) Equal to False
            • Then - Actions
              • Unit - Add Water Regen to (Picked unit)
              • Player - Disable Water Regen for (Owner of (Picked unit))
            • Else - Actions
              • Unit - Remove Water Regen from (Picked unit)
          • Custom script: call RemoveLocation(udg_WaterRegenPoint)
 
Level 6
Joined
Apr 1, 2009
Messages
201
  • Player - Disable Water Regen for (Owner of (Picked unit))
That line is as def mentioned. I want to give the hero this spell book and then hide it from sight. I put the ability in the spell book, which is called "Water Regen". I'm going to try deleting or moving a few things to try and figure out the problem, I already put in game messages and that didn't get me far.

Edit: I've changed the trigger and ran into a new problem. The game no longer crashes when moving into shallow water but when you enter shallow water your hero gains the ability and when leaving shallow water, it takes awhile for the ability to go away or doesn't go away at all.

  • Check
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
        • Loop - Actions
          • Set WaterRegenPoint = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain pathing at WaterRegenPoint of type Floatability is off) Equal to False
              • (Terrain pathing at WaterRegenPoint of type Walkability is off) Equal to False
            • Then - Actions
              • Unit - Add Water Regen to (Picked unit)
              • Player - Disable Water Regen for (Owner of (Picked unit))
            • Else - Actions
              • Unit - Remove Water Regen from WaterRegenUnit
          • Custom script: call RemoveLocation (udg_WaterRegenPoint)
 
Last edited:
Status
Not open for further replies.
Top