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

[Trigger] MUI spell won't help, none damage dealt

Status
Not open for further replies.
Level 7
Joined
May 15, 2009
Messages
191
Ok so I really need help, this is the first spell im making with hashTables involved.
I tried to do a "Walking Plague." It (should) deal damage to a target enemy over time(30 seconds to be precise) and if enemies get too close to the main target, they will also be affected by the spell.

First I tried simply adding the Disease Cloud ability and have it works on friends, sadly this simple looking trigger diden't do anything. So I went to try Hashtables since it has to be MUI with all those units involved.

My problem is, that neither damage nor spreading occurs, advice please? Thanks in advance.

  • Walking Plague Initiate
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Walking Plague
    • Actions
      • Hashtable - Save 30.00 as 0 of (Key (Target point of ability being cast)) in WalkingPlague_Hash
      • Unit Group - Add (Target unit of ability being cast) to WalkingPlague_Group
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Plague Bearer
        • Then - Actions
          • Set WalkingPlague_Caster = (Triggering unit)
        • Else - Actions
And the damage/spread

  • Walking Plague Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in WalkingPlague_Group and do (Actions)
        • Loop - Actions
          • Set WalkingPlague_RemainingTime = (Load 0 of (Key (Picked unit)) from WalkingPlague_Hash)
          • Set WalkingPlague_PickedLoc = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • WalkingPlague_RemainingTime Greater than 0.00
            • Then - Actions
              • Unit - Cause WalkingPlague_Caster to damage (Picked unit), dealing ((Real((Level of Walking Plague for WalkingPlague_Caster))) + 99999.00) damage of attack type Spells and damage type Normal
              • Hashtable - Save (WalkingPlague_RemainingTime - 1.00) as 0 of (Key (Picked unit)) in WalkingPlague_Hash
              • Unit Group - Pick every unit in (Units within 200.00 of WalkingPlague_PickedLoc matching ((((Matching unit) is A structure) Not equal to True) and (((Matching unit) belongs to an ally of (Owner of (Picked unit))) Equal to True))) and do (Actions)
                • Loop - Actions
                  • Unit - Cause WalkingPlague_Caster to damage (Picked unit), dealing ((Real((Level of Walking Plague for WalkingPlague_Caster))) + 8.00) damage of attack type Spells and damage type Normal
                  • Unit - Create 1 Dummy for (Owner of WalkingPlague_Caster) at WalkingPlague_PickedLoc facing Default building facing degrees
                  • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                  • Unit - Add Walking Plague (Unit) to (Last created unit)
                  • Unit - Order (Last created unit) to Night Elf Warden - Shadow Strike (Picked unit)
                  • Unit Group - Add (Picked unit) to WalkingPlague_Group
                  • Custom script: call RemoveLocation(udg_WalkingPlague_PickedLoc)
            • Else - Actions
              • Unit Group - Remove (Picked unit) from WalkingPlague_Group
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in WalkingPlague_Hash
 
Level 26
Joined
Mar 19, 2008
Messages
3,140
Trigger leaks location and group. For removing group leak use: bj_wantDestroyGroup = true.
You should use function RemoveLocation as the same 'level' as creation of such point, furthermore removing location in each case of (Picked unit) is silly - remove it only once, outside the ForGroup function.

Set location only when time is greater than 0. It's pointless to do that if given instance is already finished.

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • WalkingPlague_RemainingTime Greater than 0.00
    • Then - Actions
      • Set WalkingPlague_PickedLoc = (Position of (Picked unit))
      • Unit - Cause WalkingPlague_Caster to damage (Picked unit), dealing ((Real((Level of Walking Plague for WalkingPlague_Caster))) + 99999.00) damage of attack type Spells and damage type Normal
      • Hashtable - Save (WalkingPlague_RemainingTime - 1.00) as 0 of (Key (Picked unit)) in WalkingPlague_Hash
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 200.00 of WalkingPlague_PickedLoc matching ((((Matching unit) is A structure) Not equal to True) and (((Matching unit) belongs to an ally of (Owner of (Picked unit))) Equal to True))) and do (Actions)
        • Loop - Actions
          • Unit - Cause WalkingPlague_Caster to damage (Picked unit), dealing ((Real((Level of Walking Plague for WalkingPlague_Caster))) + 8.00) damage of attack type Spells and damage type Normal
          • Unit - Create 1 Dummy for (Owner of WalkingPlague_Caster) at WalkingPlague_PickedLoc facing Default building facing degrees
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Walking Plague (Unit) to (Last created unit)
          • Unit - Order (Last created unit) to Night Elf Warden - Shadow Strike (Picked unit)
          • Unit Group - Add (Picked unit) to WalkingPlague_Group
      • Custom script: call RemoveLocation(udg_WalkingPlague_PickedLoc)
 
Level 7
Joined
May 15, 2009
Messages
191
Thx for all the help guys, but still two questions:

1: Maker what did you mean when you said I diden't need WalkingPlague_Caster? I need someone to get credit if a unit is killed by the plague, but I guess thats not what you ment?

2. Spinnaker why do I need to destroy the group? I know about leaks, but if I use the set bj_WantDestroyGroup = True, then the units won't take damage. And do I really need to destroy the group? I only ever create one, and it is properly named and all. So it shoulden't leak a ton of groups?

And lastly, I would also like for the targets infected(those who get to close to main target) to also spread the plague themselves, I thought I had done this with adding them to the group, apparently not. How do I make it so that targets infected by targets, will also infect new targets? (As far as I can see, this requires an infinite amount of setting locations and picking units...)
 
Level 26
Joined
Mar 19, 2008
Messages
3,140
@Battlehound You create temporary group to deal damage yes? So engine creates group anyways, even if it's just for a second. You dont set it/destroy either so reference is quickly lost, meaning that gorup will take up memory forever, untill game ends. If trigger is used ofen, game will be unplayable after certain amount of time.

You can either set variable as that group (temporary group for targets that damage will be dealt to) and then destroy it manually or use bj_wantDestroyGroup = true, which gonna take whole stuff on itself.
Note that using script this way doesn't destroyWalkingPlague_Group group.
 
Level 7
Joined
May 15, 2009
Messages
191
Oh thx Spinnaker, I forgot that the Pick Every Unit action created a group, sometimes my brain goes blackout when im having problems with a trigger. However, when I had the script in front of my loop the damage was not dealt at all?

Normally I know how to handle leaks, but sometimes I make the most newbie'ish mistakes when im confused.
 
Status
Not open for further replies.
Top