• 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] My new spell!! Check it out!! [Earth Pressure]

Status
Not open for further replies.

Kazeon

Hosted Project: EC
Level 34
Joined
Oct 12, 2011
Messages
3,449
I've decided to always post my spells here 1-3 days before I submit it into resources section. I hope anybody can help me to find anything's wrong with the triggers/codes. I say thank you very much for any kind of help. :ogre_haosis:


  • Configuration
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- main ability than will run the trigger --------
      • Set EP_ConfAbility = Earth Pressure
      • -------- type of attack of the dealt damage. look at this trigger comment for the complete list --------
      • Set EP_ConfAttackType = 6
      • -------- multipler amount of stun duration reduction based on distance between position of unit and the center of explosion. "0" for constant duration --------
      • Set EP_ConfStunRangeFactor = 0.15
      • -------- amount of damage reduction caused by distance between the victim with the center of explosion. set to "0" for a constant damage --------
      • Set EP_ConfDamageRangeFactor = 0.15
      • -------- dummy unit for the missile --------
      • Set EP_ConfDummy = Missile
      • -------- delay per created sfx when the missile hasn't hit anything. set to "0" to continously create sfx --------
      • Set EP_ConfCrackSfxDelay = 0.10
      • -------- timer for dummy after it hits a target. set this a little bigger than duration of impact sfx duration --------
      • Set EP_ConfMissileTimer = 2.00
      • -------- maximum range for dummy to acquire a target --------
      • Set EP_ConfHitRadius = 100.00
      • -------- higher height multiplier the more units knocked higher. this multiplier makes differences maximum knock height (based on distance from the center of explotion and position of unit) become higher --------
      • Set EP_ConfKBHeightMultiplier = 1.50
      • -------- higher knock speed multiplier makes the unit knocked faster --------
      • Set EP_ConfKBSpeedMultiplier = 1.00
      • -------- sfx for knocked unit if it stays on the ground when knocked --------
      • Set EP_ConfKBSfx = Abilities\Spells\Human\FlakCannons\FlakTarget.mdl
      • -------- attachment point of target where the knockback sfx will be created --------
      • Set EP_ConfKBSfxPoint = origin
      • -------- sfx that will be created along the path --------
      • Set EP_ConfCrackSfx = Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
      • -------- sfx created when the missile hits a target --------
      • Set EP_ConfImpactSfx = Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
      • -------- buff for the stun ability --------
      • Set EP_ConfStunBuff = Stunned (Earth Pressure)
      • -------- a dummy unit that will be used for stunning units. required for stun system --------
      • Set EP_ConfStunner = Stunner
      • -------- set this to stun ability for stunner unit --------
      • Set EP_ConfStunAbility = Stun
      • -------- AoE of the ability for level 1 --------
      • Set EP_ConfAoE[1] = 400.00
      • -------- AoE of the ability for level 2 --------
      • Set EP_ConfAoE[2] = 400.00
      • -------- AoE of the ability for level 3 --------
      • Set EP_ConfAoE[3] = 400.00
      • -------- AoE of the ability for level 4 --------
      • Set EP_ConfAoE[4] = 400.00
      • -------- damage dealt to all enemies within the AoE for the ability for level 1 --------
      • Set EP_ConfDamage[1] = 100.00
      • -------- damage dealt to all enemies within the AoE for the ability for level 2 --------
      • Set EP_ConfDamage[2] = 150.00
      • -------- damage dealt to all enemies within the AoE for the ability for level 3 --------
      • Set EP_ConfDamage[3] = 200.00
      • -------- damage dealt to all enemies within the AoE for the ability for level 4 --------
      • Set EP_ConfDamage[4] = 250.00
      • -------- duration of the stun (level 1) --------
      • Set EP_ConfDuration[1] = 3.00
      • -------- duration of the stun (level 2) --------
      • Set EP_ConfDuration[2] = 3.50
      • -------- duration of the stun (level 3) --------
      • Set EP_ConfDuration[3] = 4.00
      • -------- duration of the stun (level 4) --------
      • Set EP_ConfDuration[4] = 4.50
      • -------- speed for the main dummy unit (ability level 1) --------
      • Set EP_ConfMissileSpeed[1] = 15.00
      • -------- speed for the main dummy unit (ability level 2) --------
      • Set EP_ConfMissileSpeed[2] = 15.00
      • -------- speed for the main dummy unit (ability level 3) --------
      • Set EP_ConfMissileSpeed[3] = 15.00
      • -------- speed for the main dummy unit (ability level 4) --------
      • Set EP_ConfMissileSpeed[4] = 15.00
      • -------- percentage of the sfx's size when created. 100 = 100% = 1.00, 200 = 200% = 2.00 (ability level 1) --------
      • Set EP_ConfImpactSfxSize[1] = 200.00
      • -------- percentage of the sfx's size when created. 100 = 100% = 1.00, 200 = 200% = 2.00 (ability level 2) --------
      • Set EP_ConfImpactSfxSize[2] = 200.00
      • -------- percentage of the sfx's size when created. 100 = 100% = 1.00, 200 = 200% = 2.00 (ability level 3) --------
      • Set EP_ConfImpactSfxSize[3] = 200.00
      • -------- percentage of the sfx's size when created. 100 = 100% = 1.00, 200 = 200% = 2.00 (ability level 4) --------
      • Set EP_ConfImpactSfxSize[4] = 200.00
      • -------- maximum distance for main dummy before it explodes (ability level 1) --------
      • Set EP_ConfDistanceMax[1] = 1500.00
      • -------- maximum distance for main dummy before it explodes (ability level 2) --------
      • Set EP_ConfDistanceMax[2] = 1500.00
      • -------- maximum distance for main dummy before it explodes (ability level 3) --------
      • Set EP_ConfDistanceMax[3] = 1500.00
      • -------- maximum distance for main dummy before it explodes (ability level 4) --------
      • Set EP_ConfDistanceMax[4] = 1500.00
  • EP Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to EP_ConfAbility
    • Actions
      • Set EP_IndexMax = (EP_IndexMax + 1)
      • Set EP_Caster[EP_IndexMax] = (Triggering unit)
      • Set EP_Point[1] = (Position of EP_Caster[EP_IndexMax])
      • Set EP_Point[2] = (Target point of ability being cast)
      • Set EP_Angle[EP_IndexMax] = (Angle from EP_Point[1] to EP_Point[2])
      • Set EP_DistanceCurrent[EP_IndexMax] = 0.00
      • Set EP_Level = (Level of EP_ConfAbility for EP_Caster[EP_IndexMax])
      • Set EP_AoE[EP_IndexMax] = EP_ConfAoE[EP_Level]
      • Set EP_Damage[EP_IndexMax] = EP_ConfDamage[EP_Level]
      • Set EP_Duration[EP_IndexMax] = EP_ConfDuration[EP_Level]
      • Set EP_ExplodeSize[EP_IndexMax] = EP_ConfImpactSfxSize[EP_Level]
      • Set EP_MissileSpeed[EP_IndexMax] = EP_ConfMissileSpeed[EP_Level]
      • Set EP_DistanceMax[EP_IndexMax] = EP_ConfDistanceMax[EP_Level]
      • Unit - Create 1 EP_ConfDummy for (Owner of EP_Caster[EP_IndexMax]) at EP_Point[1] facing EP_Angle[EP_IndexMax] degrees
      • Set EP_Missile[EP_IndexMax] = (Last created unit)
      • Set EP_SfxTimer[EP_IndexMax] = EP_ConfCrackSfxDelay
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • EP_IndexMax Equal to 1
        • Then - Actions
          • Trigger - Turn on EP Loop <gen>
        • Else - Actions
      • Custom script: call RemoveLocation(udg_EP_Point[1])
      • Custom script: call RemoveLocation(udg_EP_Point[2])
  • EP Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer EP_Loop) from 1 to EP_IndexMax, do (Actions)
        • Loop - Actions
          • Custom script: set udg_EP_X = GetUnitX(udg_EP_Missile[udg_EP_Loop]) + udg_EP_MissileSpeed[udg_EP_Loop] * Cos(udg_EP_Angle[udg_EP_Loop] * bj_DEGTORAD)
          • Custom script: set udg_EP_Y = GetUnitY(udg_EP_Missile[udg_EP_Loop]) + udg_EP_MissileSpeed[udg_EP_Loop] * Sin(udg_EP_Angle[udg_EP_Loop] * bj_DEGTORAD)
          • Custom script: call SetUnitX(udg_EP_Missile[udg_EP_Loop], udg_EP_X)
          • Custom script: call SetUnitY(udg_EP_Missile[udg_EP_Loop], udg_EP_Y)
          • Set EP_Point[3] = (Point(EP_X, EP_Y))
          • Set EP_DistanceCurrent[EP_Loop] = (EP_DistanceCurrent[EP_Loop] + EP_MissileSpeed[EP_Loop])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • EP_SfxTimer[EP_Loop] Greater than 0.00
            • Then - Actions
              • Set EP_SfxTimer[EP_Loop] = (EP_SfxTimer[EP_Loop] - 0.03)
            • Else - Actions
              • Set EP_SfxTimer[EP_Loop] = EP_ConfCrackSfxDelay
              • Special Effect - Create a special effect at EP_Point[3] using EP_ConfCrackSfx
              • Special Effect - Destroy (Last created special effect)
          • Set EP_DetectGroup = (Units within EP_ConfHitRadius of EP_Point[3] matching ((((Matching unit) belongs to an enemy of (Owner of EP_Caster[EP_Loop])) Equal to True) and ((((Matching unit) is alive) Equal to True) and (((((Matching unit) is A structure) Equal to True) or (((Matchin
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Number of units in EP_DetectGroup) Greater than 0
                  • EP_DistanceCurrent[EP_Loop] Greater than or equal to EP_DistanceMax[EP_Loop]
            • Then - Actions
              • Animation - Change EP_Missile[EP_Loop]'s size to (EP_ExplodeSize[EP_Loop]%, EP_ExplodeSize[EP_Loop]%, EP_ExplodeSize[EP_Loop]%) of its original size
              • Special Effect - Create a special effect attached to the chest of EP_Missile[EP_Loop] using EP_ConfImpactSfx
              • Special Effect - Destroy (Last created special effect)
              • Unit - Add a EP_ConfMissileTimer second Generic expiration timer to EP_Missile[EP_Loop]
              • Set EP_DamageGroup = (Units within EP_AoE[EP_Loop] of EP_Point[3])
              • Unit Group - Pick every unit in EP_DamageGroup and do (Actions)
                • Loop - Actions
                  • Set EP_Target = (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (EP_Target is alive) Equal to True
                      • (EP_Target belongs to an enemy of (Owner of EP_Caster[EP_Loop])) Equal to True
                      • (EP_Target is in KB_Group) Equal to False
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (EP_Target is A ground unit) Equal to True
                          • (EP_Target is A structure) Equal to True
                    • Then - Actions
                      • Set EP_Point[4] = (Position of EP_Target)
                      • Set EP_Range = (Distance between EP_Point[3] and EP_Point[4])
                      • Set EP_DealtDamage = (EP_Damage[EP_Loop] - (EP_Damage[EP_Loop] x ((EP_Range / EP_AoE[EP_Loop]) x EP_ConfDamageRangeFactor)))
                      • Custom script: call UnitDamageTargetBJ( udg_EP_Caster[udg_EP_Loop], udg_EP_Target, udg_EP_DealtDamage, ConvertAttackType(udg_EP_ConfAttackType), DAMAGE_TYPE_NORMAL )
                      • Custom script: if UnitAddAbility(udg_EP_Target,'Amrf') and UnitRemoveAbility(udg_EP_Target,'Amrf') then
                      • Custom script: endif
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (EP_Target is A structure) Equal to False
                          • (EP_Target is Mechanical) Equal to False
                        • Then - Actions
                          • Set KB_IndexMax = (KB_IndexMax + 1)
                          • Set KB_Unit[KB_IndexMax] = EP_Target
                          • Set KB_DistanceCurrent[KB_IndexMax] = 0.00
                          • Set KB_DistanceMax[KB_IndexMax] = EP_Range
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • KB_DistanceMax[KB_IndexMax] Less than 25.00
                            • Then - Actions
                              • Set KB_DistanceMax[KB_IndexMax] = 25.00
                            • Else - Actions
                          • Set KB_MaxHeight[KB_IndexMax] = ((EP_AoE[EP_Loop] - KB_DistanceMax[KB_IndexMax]) x EP_ConfKBHeightMultiplier)
                          • Set KB_Angle[KB_IndexMax] = (Angle from EP_Point[3] to EP_Point[4])
                          • Set KB_Speed[KB_IndexMax] = (((3.00 x KB_DistanceMax[KB_IndexMax]) - 200.00) / 100.00)
                          • Set KB_Speed[KB_IndexMax] = (KB_Speed[KB_IndexMax] x EP_ConfKBSpeedMultiplier)
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • KB_Speed[KB_IndexMax] Less than 1.00
                            • Then - Actions
                              • Set KB_Speed[KB_IndexMax] = 1.00
                            • Else - Actions
                          • Unit - Turn collision for KB_Unit[KB_IndexMax] Off
                          • Unit Group - Add EP_Target to KB_Group
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • KB_IndexMax Equal to 1
                            • Then - Actions
                              • Trigger - Turn on KB Loop <gen>
                            • Else - Actions
                          • Set ST_IndexMax = (ST_IndexMax + 1)
                          • Set ST_Unit[ST_IndexMax] = EP_Target
                          • Set ST_Duration[ST_IndexMax] = (EP_Duration[EP_Loop] - (EP_Duration[EP_Loop] x ((EP_Range / EP_AoE[EP_Loop]) x EP_ConfStunRangeFactor)))
                          • Unit - Remove EP_ConfStunBuff buff from ST_Unit[ST_IndexMax]
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • ST_IndexMax Equal to 1
                            • Then - Actions
                              • Unit - Create 1 EP_ConfStunner for Neutral Hostile at EP_Point[4] facing (Random angle) degrees
                              • Set ST_Stunner = (Last created unit)
                              • Unit - Add EP_ConfStunAbility to ST_Stunner
                              • Trigger - Turn on ST Loop <gen>
                            • Else - Actions
                        • Else - Actions
                      • Custom script: call RemoveLocation(udg_EP_Point[4])
                    • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • EP_Loop Not equal to EP_IndexMax
                • Then - Actions
                  • Set EP_Angle[EP_Loop] = EP_Angle[EP_IndexMax]
                  • Set EP_AoE[EP_Loop] = EP_AoE[EP_IndexMax]
                  • Set EP_Caster[EP_Loop] = EP_Caster[EP_IndexMax]
                  • Set EP_Damage[EP_Loop] = EP_Damage[EP_IndexMax]
                  • Set EP_DistanceCurrent[EP_Loop] = EP_DistanceCurrent[EP_IndexMax]
                  • Set EP_DistanceMax[EP_Loop] = EP_DistanceMax[EP_IndexMax]
                  • Set EP_Duration[EP_Loop] = EP_Duration[EP_IndexMax]
                  • Set EP_ExplodeSize[EP_Loop] = EP_ExplodeSize[EP_IndexMax]
                  • Set EP_Missile[EP_Loop] = EP_Missile[EP_IndexMax]
                  • Set EP_MissileSpeed[EP_Loop] = EP_MissileSpeed[EP_IndexMax]
                  • Set EP_SfxTimer[EP_Loop] = EP_SfxTimer[EP_IndexMax]
                • Else - Actions
              • Set EP_Caster[EP_IndexMax] = No unit
              • Set EP_Missile[EP_IndexMax] = No unit
              • Set EP_IndexMax = (EP_IndexMax - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • EP_IndexMax Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
                  • Set EP_Loop = (EP_Loop - 1)
              • Custom script: call DestroyGroup(udg_EP_DamageGroup)
            • Else - Actions
          • Custom script: call DestroyGroup(udg_EP_DetectGroup)
          • Custom script: call RemoveLocation(udg_EP_Point[3])
  • KB Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer KB_Loop) from 1 to KB_IndexMax, do (Actions)
        • Loop - Actions
          • Custom script: set udg_KB_X = GetUnitX(udg_KB_Unit[udg_KB_Loop]) + udg_KB_Speed[udg_KB_Loop] * Cos(udg_KB_Angle[udg_KB_Loop] * bj_DEGTORAD)
          • Custom script: set udg_KB_Y = GetUnitY(udg_KB_Unit[udg_KB_Loop]) + udg_KB_Speed[udg_KB_Loop] * Sin(udg_KB_Angle[udg_KB_Loop] * bj_DEGTORAD)
          • Custom script: call SetUnitX(udg_KB_Unit[udg_KB_Loop], udg_KB_X)
          • Custom script: call SetUnitY(udg_KB_Unit[udg_KB_Loop], udg_KB_Y)
          • Unit - Order KB_Unit[KB_Loop] to Stop
          • Set KB_DistanceCurrent[KB_Loop] = (KB_DistanceCurrent[KB_Loop] + KB_Speed[KB_Loop])
          • Set KB_FlyHeight = (((4.00 x KB_MaxHeight[KB_Loop]) / KB_DistanceMax[KB_Loop]) x ((KB_DistanceMax[KB_Loop] - KB_DistanceCurrent[KB_Loop]) x (KB_DistanceCurrent[KB_Loop] / KB_DistanceMax[KB_Loop])))
          • Animation - Change KB_Unit[KB_Loop] flying height to KB_FlyHeight at 0.00
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • KB_FlyHeight Less than or equal to 5.00
            • Then - Actions
              • Special Effect - Create a special effect attached to the EP_ConfKBSfxPoint of KB_Unit[KB_Loop] using EP_ConfKBSfx
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • KB_DistanceCurrent[KB_Loop] Greater than or equal to KB_DistanceMax[KB_Loop]
            • Then - Actions
              • Unit - Turn collision for KB_Unit[KB_Loop] On
              • Unit Group - Remove KB_Unit[KB_Loop] from KB_Group
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • EP_Loop Not equal to EP_IndexMax
                • Then - Actions
                  • Set KB_Angle[KB_Loop] = KB_Angle[KB_IndexMax]
                  • Set KB_DistanceCurrent[KB_Loop] = KB_DistanceCurrent[KB_IndexMax]
                  • Set KB_DistanceMax[KB_Loop] = KB_DistanceMax[KB_IndexMax]
                  • Set KB_MaxHeight[KB_Loop] = KB_MaxHeight[KB_IndexMax]
                  • Set KB_Unit[KB_Loop] = KB_Unit[KB_IndexMax]
                  • Set KB_Speed[KB_Loop] = KB_Speed[KB_IndexMax]
                • Else - Actions
              • Set KB_Unit[KB_IndexMax] = No unit
              • Set KB_IndexMax = (KB_IndexMax - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • KB_IndexMax Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
                  • Set KB_Loop = (KB_Loop - 1)
            • Else - Actions
  • ST Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer ST_Loop) from 1 to ST_IndexMax, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (ST_Unit[ST_Loop] has buff EP_ConfStunBuff) Equal to False
            • Then - Actions
              • Unit - Order ST_Stunner to Human Mountain King - Storm Bolt ST_Unit[ST_Loop]
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ST_Duration[ST_Loop] Greater than 0.00
            • Then - Actions
              • Set ST_Duration[ST_Loop] = (ST_Duration[ST_Loop] - 0.03)
            • Else - Actions
              • Unit - Remove EP_ConfStunBuff buff from ST_Unit[ST_Loop]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ST_Loop Not equal to ST_IndexMax
                • Then - Actions
                  • Set ST_Duration[ST_Loop] = ST_Duration[ST_IndexMax]
                  • Set ST_Unit[ST_Loop] = ST_Unit[ST_IndexMax]
                • Else - Actions
              • Set ST_Unit[ST_IndexMax] = No unit
              • Set ST_IndexMax = (ST_IndexMax - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ST_IndexMax Equal to 0
                • Then - Actions
                  • Unit - Remove ST_Stunner from the game
                  • Trigger - Turn off (This trigger)
                • Else - Actions
                  • Set ST_Loop = (ST_Loop - 1)
 

Attachments

  • Earth Pressure v1.0.0.w3x
    48.4 KB · Views: 27
Last edited by a moderator:

Kazeon

Hosted Project: EC
Level 34
Joined
Oct 12, 2011
Messages
3,449
so you haven't realize that PnF's indexing is not efficient too? PnF's indexing moves the last index to the current unused index then set the max index to maxindex - 1. that means the last index is skipped for 1x loop. Look at mine. the index recycled after the main loop finished. that means the last indexed unit is not skipped. beside, a loop that just "setting variables" does not make any problem for a trigger or make it slower because it doesn't make any FCs
 
The way you have it is a lot slower.

Here is how proper indexed arrays should be done.
  • loop trigger
  • Actions
    • loop
      • if tempInt < maxInt
      • then
        • When indexing ends.
        • de-index varaibles.
        • reduce maxInt
        • reduce tempInt // so it will not be skipped
      • else

Your trigger will hit the op limit a lot faster. Looping an extra time still uses a lot more than only looping once.

Purge and fire (PnF ?)
uses the same indexed array style as i do. Check out my tutorial the chapter on how to index if you do not understand my example. That is the proper way on indexing and de-indexing.
 

Kazeon

Hosted Project: EC
Level 34
Joined
Oct 12, 2011
Messages
3,449
  • reduce tempInt // so it will not be skipped
I didn't think of that way before XD
thnks.. I will fix it..

yes, PnF is purgeadnfire.. I read his indexing and didn't find that reduce the loopint.. Maybe just because I skipped it..

and maybe you dont need to de-index the variables, since at the beginning of the use of that variable we will reset it right?
 
  • reduce tempInt // so it will not be skipped
I didn't think of that way XD
thnks.. I will fix it..

yes, PnF is purgeadnfire.. I read his indexing and didn't find that reduce the loopint.. Maybe just because I skipped it..

No problem
Also a lot of the older tutorials haven't been updated so make sure it was if not post a message on his.
My tutorial Things a GUIer Should Know has a lot of useful info on it. You might want to check it out.
 
These should be inside the de-indexing portion of code.

  • Set EP_IndexMax = (EP_IndexMax - 1)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • EP_IndexMax Equal to 0
  • Then - Actions
  • Trigger - Turn off (This trigger)
  • Else - Actions
  • Set EP_Loop = (EP_Loop - 1)
Your de-index code should not be in an ITE with this condition.
  • EP_Loop Not equal to EP_IndexMax
Although i can see why you put it in there it is a bad idea.
If it is the last instance that ends it still needs to be de-indexed / clean leaks and so on. The way you have it it will not clean any leaks.
 

Kazeon

Hosted Project: EC
Level 34
Joined
Oct 12, 2011
Messages
3,449
how about this?
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ST_Loop Not equal to ST_IndexMax
    • Then - Actions
      • Set ST_Duration[ST_Loop] = ST_Duration[ST_IndexMax]
      • Set ST_Unit[ST_Loop] = ST_Unit[ST_IndexMax]
      • Set ST_IndexMax = (ST_IndexMax - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ST_IndexMax Equal to 0
        • Then - Actions
          • Unit - Remove ST_Stunner from the game
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Set ST_Loop = (ST_Loop - 1)
    • Else - Actions
 
Where is the rest of the stuff to be de-indexed ?

Edit: I just noticed you never clean the leaks.

  • Set EP_Missile[EP_Loop] = EP_Missile[EP_IndexMax]
  • // If this is a unit you should null it after like below.
  • Set EP_Missile[EP_IndexMax] = no Unit
  • Set EP_SfxTimer[EP_Loop] = EP_SfxTimer[EP_IndexMax]
  • // This is a special effect its leak has to be cleaned.
  • Remove special effect EP_SfxTimer[EP_IndexMax]
This should be stored in a variable.
  • (Owner of EP_Caster[EP_Loop])) Equal to True)
It is in your set group.
Anything used twice or more should be stored in a variable.

I suggest changing your massive set group to simply set group = units in range
Then use an ITE in the group loop to filter out the units you don't want to affect.
It is both more efficient and easier to read.
 

Kazeon

Hosted Project: EC
Level 34
Joined
Oct 12, 2011
Messages
3,449
no, it's just example.

here is the main loop
  • EP Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer EP_Loop) from 1 to EP_IndexMax, do (Actions)
        • Loop - Actions
          • Custom script: set udg_EP_X = GetUnitX(udg_EP_Missile[udg_EP_Loop]) + udg_EP_MissileSpeed[udg_EP_Loop] * Cos(udg_EP_Angle[udg_EP_Loop] * bj_DEGTORAD)
          • Custom script: set udg_EP_Y = GetUnitY(udg_EP_Missile[udg_EP_Loop]) + udg_EP_MissileSpeed[udg_EP_Loop] * Sin(udg_EP_Angle[udg_EP_Loop] * bj_DEGTORAD)
          • Custom script: call SetUnitX(udg_EP_Missile[udg_EP_Loop], udg_EP_X)
          • Custom script: call SetUnitY(udg_EP_Missile[udg_EP_Loop], udg_EP_Y)
          • Set EP_Point[3] = (Point(EP_X, EP_Y))
          • Set EP_DistanceCurrent[EP_Loop] = (EP_DistanceCurrent[EP_Loop] + EP_MissileSpeed[EP_Loop])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • EP_SfxTimer[EP_Loop] Greater than 0.00
            • Then - Actions
              • Set EP_SfxTimer[EP_Loop] = (EP_SfxTimer[EP_Loop] - 0.03)
            • Else - Actions
              • Set EP_SfxTimer[EP_Loop] = EP_ConfCrackSfxDelay
              • Special Effect - Create a special effect at EP_Point[3] using EP_ConfCrackSfx
              • Special Effect - Destroy (Last created special effect)
          • Set EP_DetectGroup = (Units within EP_ConfDetectRange of EP_Point[3] matching ((((Matching unit) belongs to an enemy of (Owner of EP_Caster[EP_Loop])) Equal to True) and ((((Matching unit) is alive) Equal to True) and (((((Matching unit) is A structure) Equal to True) or (((Match
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Number of units in EP_DetectGroup) Greater than 0
                  • EP_DistanceCurrent[EP_Loop] Greater than or equal to EP_DistanceMax[EP_Loop]
            • Then - Actions
              • Animation - Change EP_Missile[EP_Loop]'s size to (EP_ExplodeSize[EP_Loop]%, EP_ExplodeSize[EP_Loop]%, EP_ExplodeSize[EP_Loop]%) of its original size
              • Special Effect - Create a special effect attached to the chest of EP_Missile[EP_Loop] using EP_ConfImpactSfx
              • Special Effect - Destroy (Last created special effect)
              • Unit - Add a EP_ConfMissileTimer second Generic expiration timer to EP_Missile[EP_Loop]
              • Set EP_DamageGroup = (Units within EP_AoE[EP_Loop] of EP_Point[3])
              • Unit Group - Pick every unit in EP_DamageGroup and do (Actions)
                • Loop - Actions
                  • Set EP_Target = (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (EP_Target is alive) Equal to True
                      • (EP_Target belongs to an enemy of (Owner of EP_Caster[EP_Loop])) Equal to True
                      • (EP_Target is in KB_Group) Equal to False
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (EP_Target is A ground unit) Equal to True
                          • (EP_Target is A structure) Equal to True
                    • Then - Actions
                      • Set EP_Point[4] = (Position of EP_Target)
                      • Custom script: call UnitDamageTargetBJ( udg_EP_Caster[udg_EP_Loop], udg_EP_Target, udg_EP_Damage[udg_EP_Loop], ConvertAttackType(udg_EP_ConfAttackType), DAMAGE_TYPE_NORMAL )
                      • Custom script: if UnitAddAbility(udg_EP_Target,'Amrf') and UnitRemoveAbility(udg_EP_Target,'Amrf') then
                      • Custom script: endif
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (EP_Target is A structure) Equal to False
                          • (EP_Target is Mechanical) Equal to False
                        • Then - Actions
                          • Set KB_IndexMax = (KB_IndexMax + 1)
                          • Set KB_Unit[KB_IndexMax] = EP_Target
                          • Set KB_DistanceCurrent[KB_IndexMax] = 0.00
                          • Set KB_DistanceMax[KB_IndexMax] = (Distance between EP_Point[3] and EP_Point[4])
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • KB_DistanceMax[KB_IndexMax] Less than 25.00
                            • Then - Actions
                              • Set KB_DistanceMax[KB_IndexMax] = 25.00
                            • Else - Actions
                          • Set KB_MaxHeight[KB_IndexMax] = ((EP_AoE[EP_Loop] - KB_DistanceMax[KB_IndexMax]) x EP_ConfKBHeightMultiplier)
                          • Set KB_Angle[KB_IndexMax] = (Angle from EP_Point[3] to EP_Point[4])
                          • Set KB_Speed[KB_IndexMax] = (((3.00 x KB_DistanceMax[KB_IndexMax]) - 200.00) / 100.00)
                          • Set KB_Speed[KB_IndexMax] = (KB_Speed[KB_IndexMax] x EP_ConfKBSpeedMultiplier)
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • KB_Speed[KB_IndexMax] Less than 1.00
                            • Then - Actions
                              • Set KB_Speed[KB_IndexMax] = 1.00
                            • Else - Actions
                          • Unit - Turn collision for KB_Unit[KB_IndexMax] Off
                          • Unit Group - Add EP_Target to KB_Group
                          • Set ST_IndexMax = (ST_IndexMax + 1)
                          • Set ST_Unit[ST_IndexMax] = EP_Target
                          • Set ST_Duration[ST_IndexMax] = EP_Duration[EP_Loop]
                          • Unit - Remove EP_ConfStunBuff buff from ST_Unit[ST_IndexMax]
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • KB_IndexMax Equal to 1
                            • Then - Actions
                              • Trigger - Turn on KB Loop <gen>
                            • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • ST_IndexMax Equal to 1
                            • Then - Actions
                              • Unit - Create 1 EP_ConfStunner for Neutral Hostile at EP_Point[4] facing (Random angle) degrees
                              • Set ST_Stunner = (Last created unit)
                              • Unit - Add EP_ConfStunAbility to ST_Stunner
                              • Trigger - Turn on ST Loop <gen>
                            • Else - Actions
                        • Else - Actions
                      • Custom script: call RemoveLocation(udg_EP_Point[4])
                    • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • EP_Loop Not equal to EP_IndexMax
                • Then - Actions
                  • Set EP_Angle[EP_Loop] = EP_Angle[EP_IndexMax]
                  • Set EP_AoE[EP_Loop] = EP_AoE[EP_IndexMax]
                  • Set EP_Caster[EP_Loop] = EP_Caster[EP_IndexMax]
                  • Set EP_Damage[EP_Loop] = EP_Damage[EP_IndexMax]
                  • Set EP_DistanceCurrent[EP_Loop] = EP_DistanceCurrent[EP_IndexMax]
                  • Set EP_DistanceMax[EP_Loop] = EP_DistanceMax[EP_IndexMax]
                  • Set EP_Duration[EP_Loop] = EP_Duration[EP_IndexMax]
                  • Set EP_ExplodeSize[EP_Loop] = EP_ExplodeSize[EP_IndexMax]
                  • Set EP_Missile[EP_Loop] = EP_Missile[EP_IndexMax]
                  • Set EP_MissileSpeed[EP_Loop] = EP_MissileSpeed[EP_IndexMax]
                  • Set EP_SfxTimer[EP_Loop] = EP_SfxTimer[EP_IndexMax]
                  • Set EP_IndexMax = (EP_IndexMax - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • EP_IndexMax Equal to 0
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                      • Set EP_Loop = (EP_Loop - 1)
                • Else - Actions
            • Else - Actions
          • Custom script: call RemoveLocation(udg_EP_Point[3])
maybe you are get drunked a little :p that sfxtimer is a real variable :p
 

Kazeon

Hosted Project: EC
Level 34
Joined
Oct 12, 2011
Messages
3,449
I have nulled them now..

I suggest changing your massive set group to simply set group = units in range
Then use an ITE in the group loop to filter out the units you don't want to affect.
It is both more efficient and easier to read.

so I have to use condition to filter it then remove them from the unit group? because i need this condition
  • number of unit in unit group greater than 0
that's the only reason why I use a long matching conditions

Your units should be nulled after reducing the array though.

it must be "before"?
 

Kazeon

Hosted Project: EC
Level 34
Joined
Oct 12, 2011
Messages
3,449
but it will need extra action like remove picked unit from unit group..

it will be like this
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Set EP_DetectGroup = (Units within EP_ConfDetectRange of EP_Point[3])
      • Unit Group - Pick every unit in EP_DetectGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • ((Picked unit) is A structure) Equal to True
                  • ((Picked unit) is dead) Equal to True
                  • blablabla
            • Then - Actions
              • Unit Group - Remove (Picked unit) from EP_DetectGroup
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in EP_DetectGroup) Greater than 0
        • Then - Actions
          • blablabla
        • Else - Actions
hey, I have found that merging max index reduction with the condition makes the trigger never be turned of when the max index reaches 1 :/
 
Last edited by a moderator:
but it will need extra action like remove picked unit from unit group..

it will be like this
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Set EP_DetectGroup = (Units within EP_ConfDetectRange of EP_Point[3])
      • Unit Group - Pick every unit in EP_DetectGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • ((Picked unit) is A structure) Equal to True
                  • ((Picked unit) is dead) Equal to True
                  • blablabla
            • Then - Actions
              • Unit Group - Remove (Picked unit) from EP_DetectGroup
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in EP_DetectGroup) Greater than 0
        • Then - Actions
          • blablabla
        • Else - Actions
hey, I have found that merging max index reduction with the condition makes the trigger never be turned of when the max index reaches 1 :/

You don't need to remove the units as you never use that group anyways you simply use it as a counter to see if there are units in it.

If it doesn't turn off it means that there is a mistake somewhere. Please post the new code.
 

Kazeon

Hosted Project: EC
Level 34
Joined
Oct 12, 2011
Messages
3,449
here
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • EP_Loop Not equal to EP_IndexMax
    • Then - Actions
      • Set EP_Angle[EP_Loop] = EP_Angle[EP_IndexMax]
      • Set EP_AoE[EP_Loop] = EP_AoE[EP_IndexMax]
      • Set EP_Caster[EP_Loop] = EP_Caster[EP_IndexMax]
      • Set EP_Damage[EP_Loop] = EP_Damage[EP_IndexMax]
      • Set EP_DistanceCurrent[EP_Loop] = EP_DistanceCurrent[EP_IndexMax]
      • Set EP_DistanceMax[EP_Loop] = EP_DistanceMax[EP_IndexMax]
      • Set EP_Duration[EP_Loop] = EP_Duration[EP_IndexMax]
      • Set EP_ExplodeSize[EP_Loop] = EP_ExplodeSize[EP_IndexMax]
      • Set EP_Missile[EP_Loop] = EP_Missile[EP_IndexMax]
      • Set EP_MissileSpeed[EP_Loop] = EP_MissileSpeed[EP_IndexMax]
      • Set EP_SfxTimer[EP_Loop] = EP_SfxTimer[EP_IndexMax]
    • Else - Actions
 

Kazeon

Hosted Project: EC
Level 34
Joined
Oct 12, 2011
Messages
3,449
no, the ITE just contains de-indexing.. if un"nulled" unit variables causes leaks, so why didn't maker remind me about that at my approved paralyzing cask?

wait, I will update the thread..

it's updated:
- group leaks at main loop removed
- now the damage/stun reduction (based on range between unit point and center of explosion) is configurable
- I hope the indexing is correct already
 

Kazeon

Hosted Project: EC
Level 34
Joined
Oct 12, 2011
Messages
3,449
Umm do you ever remove EP_Missile ?
no, I don't. I just add an expiration time so that the unit dies after the sfx finished.

This should be stored in a variable.

(Owner of EP_Caster[EP_Loop])

No, it should not. because I just use it once.. wait, did you mean store it at the cast event? I think you are right..

I will upload this tonight (if there is no more report)
 
Last edited by a moderator:
Status
Not open for further replies.
Top