Ability suddenly decides to stop working.

Zealot

Member
Reaction score
11
The ability works as intended but only the first time, the second time only the SFX appears. I've no idea what could cause this.
Another inconvenience is 2 random SFX do not disappear when the others do, but they seem to always be the same 2.
The ability makes a SFX in the target area, and after all the SFX are created units that are not at full mana regenerate it and those at full mana gain maximum mana until the end. At the end of the ability the SFX are supposed to disappear in the order they appeared.

Trigger:
  • Mystical Field Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mystical Field
    • Actions
      • Set Mystical_Field_Affected = Mystical_Field_Affected
      • Set Mystical_Field_Caster = (Casting unit)
      • Set Mystical_Field_Check = 2
      • Set Mystical_Field_Angle = 0
      • Set Mystical_Field_Continue = (Random angle)
      • Set Mystical_Field_Point = (Target point of ability being cast)
      • Set Mystical_Field_Total = 0
      • Special Effect - Create a special effect at Mystical_Field_Point using HolyBlessing.mdx
      • Set Mystical_Field_SFX[1] = (Last created special effect)
      • Countdown Timer - Start Mystical_Field_Timer as a One-shot timer that will expire in 0.50 seconds
      • Countdown Timer - Start Mystical_Field_Timer_Replenish as a One-shot timer that will expire in 0.60 seconds


Trigger:
  • Mystical Field SFX
    • Events
      • Time - Mystical_Field_Timer expires
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Mystical_Field_Angle Equal to 0
        • Then - Actions
          • For each (Integer A) from Mystical_Field_Check to Mystical_Field_Check, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • And - All (Conditions) are true
                    • Conditions
                      • Mystical_Field_Check Greater than or equal to 2
                      • Mystical_Field_Check Less than or equal to 10
                • Then - Actions
                  • Set Mystical_Field_SFX_Point = (Mystical_Field_Point offset by 100.00 towards ((Mystical_Field_Continue + 480.00) - ((Real((Integer A))) x 40.00)) degrees)
                  • Set Mystical_Field_Check = (Mystical_Field_Check + 1)
                  • Special Effect - Create a special effect at Mystical_Field_SFX_Point using WaterAurora.mdx
                  • Set Mystical_Field_SFX[(Integer A)] = (Last created special effect)
                  • Countdown Timer - Start Mystical_Field_Timer as a One-shot timer that will expire in 0.10 seconds
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • And - All (Conditions) are true
                    • Conditions
                      • Mystical_Field_Check Greater than or equal to 11
                      • Mystical_Field_Check Less than or equal to 29
                • Then - Actions
                  • Set Mystical_Field_SFX_Point = (Mystical_Field_Point offset by 200.00 towards ((Mystical_Field_Continue + 580.00) - ((Real((Integer A))) x 20.00)) degrees)
                  • Set Mystical_Field_Check = (Mystical_Field_Check + 1)
                  • Special Effect - Create a special effect at Mystical_Field_SFX_Point using WaterAurora.mdx
                  • Set Mystical_Field_SFX[(Integer A)] = (Last created special effect)
                  • Countdown Timer - Start Mystical_Field_Timer as a One-shot timer that will expire in 0.05 seconds
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • And - All (Conditions) are true
                    • Conditions
                      • Mystical_Field_Check Greater than or equal to 30
                      • Mystical_Field_Check Less than or equal to 68
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Mystical_Field_Check Greater than 67
                    • Then - Actions
                    • Else - Actions
                      • Set Mystical_Field_Check = (Mystical_Field_Check + 1)
                      • Special Effect - Create a special effect at Mystical_Field_SFX_Point using WaterAurora.mdx
                      • Set Mystical_Field_SFX[(Integer A)] = (Last created special effect)
                      • Set Mystical_Field_SFX_Point = (Mystical_Field_Point offset by 300.00 towards ((Mystical_Field_Continue + 660.00) - ((Real((Integer A))) x 10.00)) degrees)
                      • Countdown Timer - Start Mystical_Field_Timer as a One-shot timer that will expire in 0.02 seconds
                • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Mystical_Field_Angle Equal to 1
        • Then - Actions
          • For each (Integer A) from Mystical_Field_Check to Mystical_Field_Check, do (Actions)
            • Loop - Actions
              • Special Effect - Destroy Mystical_Field_SFX[(Integer A)]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Mystical_Field_Check Greater than 0
                • Then - Actions
                  • Set Mystical_Field_Check = (Mystical_Field_Check - 1)
                  • Countdown Timer - Start Mystical_Field_Timer as a One-shot timer that will expire in 0.05 seconds
                • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Mystical_Field_Check Equal to 68
        • Then - Actions
          • Countdown Timer - Start Mystical_Field_Timer_End as a One-shot timer that will expire in (10.00 + (1.50 x (Real((Level of Mystical Field for (Casting unit)))))) seconds
        • Else - Actions

Part 2 in next post.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
it seems you didnt copy those triggers correctly. As they are right now I personally cant read it.
But this:
Trigger:
  • Set Mystical_Field_Affected = Mystical_Field_Affected
can definitely not be good.
 

Zealot

Member
Reaction score
11
Trigger:
  • Mystical Field Replenish
    • Events
      • Time - Mystical_Field_Timer_Replenish expires
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Mystical_Field_Angle Equal to 0
        • Then - Actions
          • Countdown Timer - Start Mystical_Field_Timer_Replenish as a One-shot timer that will expire in 0.10 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Mystical_Field_Check Equal to 68
            • Then - Actions
              • Set Mystical_Field_Group = (Units within 300.00 of Mystical_Field_Point matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is hidden) Equal to False) and (((Matching unit) is in Mystical_Field_Affected) Equ
              • Unit Group - Pick every unit in Mystical_Field_Group and do (Actions)
                • Loop - Actions
                  • For each (Integer B) from 1 to (Mystical_Field_Total + 1), do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Picked unit) Not equal to (Load (Integer B) of 1 in Mystical_Field_Table)
                        • Then - Actions
                          • Hashtable - Save Handle Of(Picked unit) as (Mystical_Field_Total + 1) of 1 in Mystical_Field_Table
                          • Hashtable - Save 0 as (Mystical_Field_Total + 1) of 2 in Mystical_Field_Table
                          • Set Mystical_Field_Total = (Mystical_Field_Total + 1)
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • ((Picked unit) is in Mystical_Field_Affected) Equal to False
                            • Then - Actions
                              • Unit Group - Add (Picked unit) to Mystical_Field_Affected
                            • Else - Actions
                          • Custom script: exitwhen true
                        • Else - Actions
              • Custom script: call DestroyGroup (udg_Mystical_Field_Group)
              • Unit Group - Pick every unit in Mystical_Field_Affected and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • And - All (Conditions) are true
                        • Conditions
                          • (Distance between (Position of (Picked unit)) and Mystical_Field_Point) Less than or equal to 300.00
                          • (Mana of (Picked unit)) Equal to (Max mana of (Picked unit))
                    • Then - Actions
                      • For each (Integer B) from 1 to Mystical_Field_Total, do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Picked unit) Equal to (Load (Integer B) of 1 in Mystical_Field_Table)
                            • Then - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Real((Load (Integer B) of 2 from Mystical_Field_Table))) Less than (Max((50.00 x (Real((Level of Mystical Field for Mystical_Field_Caster)))), (3.00 x (Real((Intelligence of (Picked unit) (Include bonuses)))))))
                                • Then - Actions
                                  • Hashtable - Save ((Load (Integer B) of 2 from Mystical_Field_Table) + 1) as (Integer B) of 2 in Mystical_Field_Table
                                  • Unit - Add Mystical Field Mana to (Picked unit)
                                  • Unit - Increase level of Mystical Field Mana for (Picked unit)
                                  • Unit - Remove Mystical Field Mana from (Picked unit)
                                • Else - Actions
                            • Else - Actions
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Distance between (Position of (Picked unit)) and Mystical_Field_Point) Less than or equal to 300.00
                        • Then - Actions
                          • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) + ((Max mana of (Picked unit)) x (0.01 x 0.40)))
                        • Else - Actions
            • Else - Actions
        • Else - Actions


Trigger:
  • Mystical Field CheckUp
    • Events
      • Time - Mystical_Field_Timer_End expires
    • Conditions
    • Actions
      • Set Mystical_Field_Angle = 1
      • Countdown Timer - Start Mystical_Field_Timer as a One-shot timer that will expire in 0.00 seconds
      • For each (Integer A) from 1 to Mystical_Field_Total, do (Actions)
        • Loop - Actions
          • For each (Integer B) from 1 to (Load (Integer A) of 2 from Mystical_Field_Table), do (Actions)
            • Loop - Actions
              • Unit - Add Mystical Field Mana Remove to (Load (Integer A) of 1 in Mystical_Field_Table)
              • Unit - Increase level of Mystical Field Mana Remove for (Load (Integer A) of 1 in Mystical_Field_Table)
              • Unit - Remove Mystical Field Mana Remove from (Load (Integer A) of 1 in Mystical_Field_Table)
      • Custom script: call DestroyGroup (udg_Mystical_Field_Affected)
      • Hashtable - Clear Mystical_Field_Table
 

Zealot

Member
Reaction score
11
it seems you didnt copy those triggers correctly. As they are right now I personally cant read it.
But this:
Trigger:
  • Set Mystical_Field_Affected = Mystical_Field_Affected
can definitely not be good.

The Group is destroyed at the end of the effect.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
But this does not create a new group.
What you do is:
null = null
which is equal to:
nothing

If you want to create a new unit group, but you want to do it with GUI only, then do something nonsensical like:
Trigger:
  • Set Mystical_Field_Affected =Units in Map of type (SOME_UNIT_TYPE_THAT_IS_NEVER_USED_IN_THE_MAP)

This, for example, will set the unit group to a new, empty unit group.
Other ways are possible too.
 

Zealot

Member
Reaction score
11
But this does not create a new group.
What you do is:
null = null
which is equal to:
nothing

If you want to create a new unit group, but you want to do it with GUI only, then do something nonsensical like:
Trigger:
  • Set Mystical_Field_Affected =Units in Map of type (SOME_UNIT_TYPE_THAT_IS_NEVER_USED_IN_THE_MAP)

This, for example, will set the unit group to a new, empty unit group.
Other ways are possible too.

Trigger:
  • Set Mystical_Field_Affected = (Units in (Playable map area) matching (((Matching unit) is loaded into (Matching unit)) Equal to True))

Is this okay or is too nonsensical? Bad part is this doesn't seem to be what's causing the weird issue.
 

Solu9

You can change this now in User CP.
Reaction score
216
You set Mystical_Field_Affected to be equal to itself in the very beginning. That makes no sense.

Also there are quite a few oddities in your trigger.

For each (Integer A) from Mystical_Field_Check to Mystical_Field_Check, do (Actions)
  • Loop - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • And - All (Conditions) are true
          • Conditions
            • Mystical_Field_Check Greater than or equal to 2
            • Mystical_Field_Check Less than or equal to 10
      • Then - Actions
        • Set Mystical_Field_SFX_Point = (Mystical_Field_Point offset by 100.00 towards ((Mystical_Field_Continue + 480.00) - ((Real((Integer A))) x 40.00)) degrees)

From what I can read.
For each (integer A) from 2 to 2, do (Actions) = it will loop only once.
And for the SFX part.
First of all it leaks. You set a point OFFSET by another point. You need to create 2 point variables. 1 for the target of the ability being cast and 1 that is offset by 100 towards xxxx.

Then onto the angle.
((Mystical_Field_Continue + 480) - ((Real(Integer A))) x 40.00)) degrees)
((((random 1 to 360) + 480) - ((2) x 40.00) degrees)

This means the angle will always be at least 400, no?
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
Thats quite nonsensical, but a bad kind of it.
First of all its leaking a point right there, and second, this might be quite a bit more costly to check then picking all units of certain type, depending on how wc3's interna are implemented.

What you could also do is just clear the unit group at the end of your triggers instead of destroying them. If you clear a unit group it will also be emptied, but you can still add units to it.
 

Zealot

Member
Reaction score
11
You set Mystical_Field_Affected to be equal to itself in the very beginning. That makes no sense.

Also there are quite a few oddities in your trigger.

For each (Integer A) from Mystical_Field_Check to Mystical_Field_Check, do (Actions)
  • Loop - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • And - All (Conditions) are true
          • Conditions
            • Mystical_Field_Check Greater than or equal to 2
            • Mystical_Field_Check Less than or equal to 10
      • Then - Actions
        • Set Mystical_Field_SFX_Point = (Mystical_Field_Point offset by 100.00 towards ((Mystical_Field_Continue + 480.00) - ((Real((Integer A))) x 40.00)) degrees)
From what I can read.
For each (integer A) from 2 to 2, do (Actions) = it will loop only once.
And for the SFX part.
First of all it leaks. You set a point OFFSET by another point. You need to create 2 point variables. 1 for the target of the ability being cast and 1 that is offset by 100 towards xxxx.

Then onto the angle.
((Mystical_Field_Continue + 480) - ((Real(Integer A))) x 40.00)) degrees)
((((random 1 to 360) + 480) - ((2) x 40.00) degrees)

This means the angle will always be at least 400, no?

It is meant to loop once, because it creates one SFX and then it waits for the timer to make the new one.
Trigger:
  • Set Mystical_Field_Check = (Mystical_Field_Check + 1)

Trigger:
  • Countdown Timer - Start Mystical_Field_Timer as a One-shot timer that will expire in 0.10 seconds

I use it like this to use Interger A to save the Special Effect to an array.

I know it leaks but I'm first trying to make it functional before removing leaks.

The angle works perfectly though, because integer A constantly grows each time an SFX is spawned due to:
Trigger:
  • Set Mystical_Field_Check = (Mystical_Field_Check + 1)
 

Zealot

Member
Reaction score
11
Thats quite nonsensical, but a bad kind of it.
First of all its leaking a point right there, and second, this might be quite a bit more costly to check then picking all units of certain type, depending on how wc3's interna are implemented.

What you could also do is just clear the unit group at the end of your triggers instead of destroying them. If you clear a unit group it will also be emptied, but you can still add units to it.

So empty unit groups don't leak I take it?
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
A leak is only when you can no longer access a variable.
Any unit group, which is NOT accessible by a variable, is a leak.
If you have a variable, and that variable is pointing to a unit group, no matter whether its empty or full, or nonexistant, or anything, is not considered a memory leak.
 

Zealot

Member
Reaction score
11
No. Because you use the same group over and over. You are not creating a new one.
A leak is only when you can no longer access a variable.
Any unit group, which is NOT accessible by a variable, is a leak.
If you have a variable, and that variable is pointing to a unit group, no matter whether its empty or full, or nonexistant, or anything, is not considered a memory leak.

Alright I'll empty it instead of destroying it, maybe this fixes something.
 

Zealot

Member
Reaction score
11
Ok, the unit group is now emptied at the end of the trigger.
Trigger:
  • Unit Group - Remove all units from Mystical_Field_Affected


And I've found out something new. The trigger works the second time, but only a part of it. Units that do not have maximum mana regain mana until they are at maximum, but maximum mana will not increase like the first time the spell is cast.
The issue about the 2 random SFX remain.
 

Solu9

You can change this now in User CP.
Reaction score
216
Are you using a spell that works on units with full mana?
 

Zealot

Member
Reaction score
11
Are you using a spell that works on units with full mana?
No need for that.
The units are picked by:
Trigger:
  • Set Mystical_Field_Group = (Units within 300.00 of Mystical_Field_Point matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is hidden) Equal to False) and (((Matching unit) is in Mystical_Field_Affected) Equ


Then they are placed in the hashtable:
Trigger:
  • Hashtable - Save Handle Of(Picked unit) as (Mystical_Field_Total + 1) of 1 in Mystical_Field_Table


And lastly added to a new unit group so they won't be picked again in the first group.
Trigger:
  • Unit Group - Add (Picked unit) to Mystical_Field_Affected


Effect.jpgBug.jpg

Also here are two screenshots showcasing the SFX bug.
 

Zealot

Member
Reaction score
11
Ok, I've narrowed the ability not working the second time to this part, or so I believe.
Trigger:
  • Unit Group - Pick every unit in Mystical_Field_Affected and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Distance between (Position of (Picked unit)) and Mystical_Field_Point) Less than or equal to 300.00
              • (Mana of (Picked unit)) Equal to (Max mana of (Picked unit))
        • Then - Actions
          • For each (Integer B) from 1 to Mystical_Field_Total, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Picked unit) Equal to (Load (Integer B) of 1 in Mystical_Field_Table)
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Real((Load (Integer B) of 2 from Mystical_Field_Table))) Less than (Max((50.00 x (Real((Level of Mystical Field for Mystical_Field_Caster)))), (3.00 x (Real((Intelligence of (Picked unit) (Include bonuses)))))))
                    • Then - Actions
                      • Hashtable - Save ((Load (Integer B) of 2 from Mystical_Field_Table) + 1) as (Integer B) of 2 in Mystical_Field_Table
                      • Unit - Add Mystical Field Mana to (Picked unit)
                      • Unit - Increase level of Mystical Field Mana for (Picked unit)
                      • Unit - Remove Mystical Field Mana from (Picked unit)
                    • Else - Actions
                • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between (Position of (Picked unit)) and Mystical_Field_Point) Less than or equal to 300.00
            • Then - Actions
              • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) + ((Max mana of (Picked unit)) x (0.01 x 0.40)))
            • Else - Actions
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top