• 🏆 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] Mana Damage Trigger

Status
Not open for further replies.
Level 4
Joined
Jan 27, 2009
Messages
57
Mana Damage Trigger - Solved

Cant find the error. Can some one please help me? The mana "damage" isnt applying correctly. I'm just getting the base damage, without the add of the Remnants per-unit bonus mana damage. The slow cast part is doing fine.
PS.: New tests revealed that POSSIBLY the Remnants are being detected by the trigger only after they die/expire (leaving a corpse). While active/alive, the Remnants are not getting detected/counted by the trigger. They have the Locust ability.
PS2.: Yeah, just confirmed that. The trigger is only detecting the dead Remnants.. do the fact that they have the Locust ability matters to this issue?

I've been creating things in the WE for a looong time and i cant find what's wrong with this trigger:

  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Pulse
  • Actions
    • Set tmpPoint3 = (Position of (Triggering unit))
    • Unit Group - Pick every unit in (Units within 600.00 of tmpPoint3 matching (((Owner of (Matching unit)) is an enemy of (Owner of (Triggering unit))) Equal to True)) and do (Actions)
      • Loop - Actions
        • Unit Group - Add (Picked unit) to PulseUnitGroup
    • Unit Group - Pick every unit in (Units within 600.00 of tmpPoint3 matching ((Unit-type of (Matching unit)) Equal to Dummy (Darkness Remnant))) and do (Actions)
      • Loop - Actions
        • Unit Group - Add (Picked unit) to RemnantsGroup
    • Set NumberOfRemnants = (Number of units in RemnantsGroup)
    • Set ManaDamage = ((25.00 + (25.00 x (Real((Level of Pulse for (Triggering unit)))))) + ((Real(NumberOfRemnants)) x (5.00 + (5.00 x (Real((Level of Pulse for (Triggering unit))))))))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Unit-type of (Triggering unit)) Equal to Balance Spirit (Yin)
      • Then - Actions
        • Unit Group - Pick every unit in PulseUnitGroup and do (Actions)
          • Loop - Actions
            • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) - ManaDamage)
        • Unit - Create 1 Dummy for Player 2 (Blue) at tmpPoint3 facing Default building facing degrees
        • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
        • For each (Integer A) from 1 to (Number of units in PulseUnitGroup), do (Actions)
          • Loop - Actions
            • Set TotalUnits = (TotalUnits + 1)
        • Game - Display to (All players) the text: (String(TotalUnits))
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • NumberOfRemnants Equal to 0
          • Then - Actions
            • Unit - Add Pulse Slow to (Last created unit)
            • Unit - Set level of Pulse Slow for (Last created unit) to (Level of Pulse for (Triggering unit))
            • Unit Group - Pick every unit in PulseUnitGroup and do (Actions)
              • Loop - Actions
                • Unit - Order (Last created unit) to Human Sorceress - Slow (Picked unit)
                • Unit Group - Remove (Picked unit) from PulseUnitGroup
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • NumberOfRemnants Equal to 1
          • Then - Actions
            • Unit - Add Pulse Slow (+1) to (Last created unit)
            • Unit - Set level of Pulse Slow (+1) for (Last created unit) to (Level of Pulse for (Triggering unit))
            • Unit Group - Pick every unit in PulseUnitGroup and do (Actions)
              • Loop - Actions
                • Unit - Order (Last created unit) to Human Sorceress - Slow (Picked unit)
                • Unit Group - Remove (Picked unit) from PulseUnitGroup
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • NumberOfRemnants Equal to 2
          • Then - Actions
            • Unit - Add Pulse Slow (+2) to (Last created unit)
            • Unit - Set level of Pulse Slow (+2) for (Last created unit) to (Level of Pulse for (Triggering unit))
            • Unit Group - Pick every unit in PulseUnitGroup and do (Actions)
              • Loop - Actions
                • Unit - Order (Last created unit) to Human Sorceress - Slow (Picked unit)
                • Unit Group - Remove (Picked unit) from PulseUnitGroup
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • NumberOfRemnants Equal to 3
          • Then - Actions
            • Unit - Add Pulse Slow (+3) to (Last created unit)
            • Unit - Set level of Pulse Slow (+3) for (Last created unit) to (Level of Pulse for (Triggering unit))
            • Unit Group - Pick every unit in PulseUnitGroup and do (Actions)
              • Loop - Actions
                • Unit - Order (Last created unit) to Human Sorceress - Slow (Picked unit)
                • Unit Group - Remove (Picked unit) from PulseUnitGroup
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • NumberOfRemnants Equal to 4
          • Then - Actions
            • Unit - Add Pulse Slow (+4) to (Last created unit)
            • Unit - Set level of Pulse Slow (+4) for (Last created unit) to (Level of Pulse for (Triggering unit))
            • Unit Group - Pick every unit in PulseUnitGroup and do (Actions)
              • Loop - Actions
                • Unit - Order (Last created unit) to Human Sorceress - Slow (Picked unit)
                • Unit Group - Remove (Picked unit) from PulseUnitGroup
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • NumberOfRemnants Equal to 5
          • Then - Actions
            • Unit - Add Pulse Slow (+5) to (Last created unit)
            • Unit - Set level of Pulse Slow (+5) for (Last created unit) to (Level of Pulse for (Triggering unit))
            • Unit Group - Pick every unit in PulseUnitGroup and do (Actions)
              • Loop - Actions
                • Unit - Order (Last created unit) to Human Sorceress - Slow (Picked unit)
                • Unit Group - Remove (Picked unit) from PulseUnitGroup
          • Else - Actions
      • Else - Actions
    • Custom script: call RemoveLocation(udg_tmpPoint3)
 
Last edited:
Level 29
Joined
Oct 24, 2012
Messages
6,543
You should use hidden tags on your post when the triggers are that long.

You leak a lot of groups.
Its better to use one Unit group with and ITE ( if then else) in it rather than multiple unit groups.
Don't use integer A / B
Add some more debug messages to see where exactly it is going wrong.
You should learn how to use a loop and put the ITEs at the end in one small loop rather than have 6 ITEs.
Anything used twice or more should be stored in a variable and the variable should be used.
Example: you have this in your unit group creation.
  • (((Owner of (Matching unit)) is an enemy of (Owner of (Triggering unit))) Equal to True))
Every time it finds a unit in that area it matches it against the conditions. It is a lot better to put these in variables as it can greatly increase speed if there are a lot of units nearby.

You should take a look at my tutorial things a GUIer should know

Also please post all triggers related to the spell. The way it is it should catch all remnants ( dead or alive ).
 
Level 4
Joined
Jan 27, 2009
Messages
57
Well, thanks for all that info and feedback. Actually this is just a testmap for a Hero Suggestion.
The thing is that this hero can place-cast remnants with another skill. Remnants have Locust skill and cant move, be targeted, attack or anything.
Then, casting the Pulse skill shall slow enemies in an area and damage their mana for a certain amount.
For each Remnant in the AoE when cast, the effect is greater, to a max of 5 stacks.
The trigger is working except for the part that it saves the amount of mana damage into a variable. In that part, it isnt adding the bonus damage for the Remnants nearby.
  • Set ManaDamage = ((25.00 + (25.00 x (Real((Level of Pulse for (Triggering unit)))))) + ((Real(NumberOfRemnants)) x (5.00 + (5.00 x (Real((Level of Pulse for (Triggering unit))))))))
This is prolly happening because of a bug here:
  • Unit Group - Pick every unit in (Units within 600.00 of tmpPoint3 matching ((Unit-type of (Matching unit)) Equal to Dummy (Darkness Remnant))) and do (Actions)
  • Loop - Actions
  • Unit Group - Add (Picked unit) to RemnantsGroup
  • Set NumberOfRemnants = (Number of units in RemnantsGroup)
I dont know why, but the trigger is not counting the alive remnants. It is just counting them when they die.

UPDATE: Just removed Locust ability from it and gotcha! It now counts correctly oO wtf is going on??
 
Last edited:
Level 4
Joined
Jan 27, 2009
Messages
57
You can't check units with locust like that. Instead when you create the units with locust add them to the group.

Since you are using the amount of remnants as a counter it is a lot better just to get the number of units created at that time and save it into an integer array to be loaded later.

Now it counts every unit in the group and avoids the range limit oO
  • Set NumberOfRemnants = (Number of units in (Units within 600.00 of tmpPoint3 matching (((Matching unit) is in RemnantsGroup) Equal to True)))
RemnantsGroup is a group of units that contains every Remnant created via the other skill.
 
Level 4
Joined
Jan 27, 2009
Messages
57
Finally! Got it! Just put everyone on a group and then checked the distance between them and the cast point. If within the range, i just counted them in an integer variable and used that as the multiplier for the extra damage.
You helped me alot and im giving you +Rep.
Thanks mate.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
As i said above this is a bad workaround. Yes it works but it is inefficient. Also it has a big flaw. What happens when 2 units cast that spell next to each other ? it will act as if they have a different number of revnants than they actually do have.

Instead on your casting you should set an integer array with the number of remnanats that unit makes when casting spell. That way you use a simple integer comparison rather than looping through every unit in the group.
Using the way i suggested will increase the amount of spells you can have run at one time. It will decrease lag. It is better coding practice and it will make you spell trigger smaller and easier to manage.
If you are not sure how to do this and want to know post your trigger that summons the revnants and any other trigger with it and i should be able to adjust your code on my phone and help you with a working piece of code.
 
Status
Not open for further replies.
Top