• 🏆 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] Trigger does not do as it's intended to:

Status
Not open for further replies.
Level 20
Joined
Apr 14, 2012
Messages
2,901
Okay, After removing the arrays of some variables in this trigger, I noticed it no longer does what it's intended to do. It's supposed to create a circle of effects around the caster, move to the nearest enemy units, lift them off the ground (thanks to Maker's system), then create a final circle of effects.

Now, this is a spell I submitted in the Spells section, though I fixed the leaks, the Review also stated that some variables do not need their arrays, hence I removed them as I said in my topic sentence.

I do not know what caused this, all I know is that the problem occurred after a removed the arrays of:

ZS_CasterLoc, originally ZS_CasterLoc[ZS_CurrentIndex]
ZS_PickedUnit, originally ZS_PickedUnit[ZS_LoopInt]
ZS_PickedUnitLoc, originally ZS_PickedUnti[ZS_LoopInt]

and I also had a TempPoint2 variable, but the spell's review said I only needed the TempPoint variable, not TempPoint2.

So now, the trigger:

  • ZS Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer ZS_CurrentIndex) from 1 to ZS_MaxIndex, do (Actions)
        • Loop - Actions
          • Set ZS_CasterLoc = (Position of ZS_Caster[ZS_CurrentIndex])
          • -------- [START] Circle War Stomp [START] --------
          • For each (Integer ZS_CirclInt) from 1 to ZS_StartCircleNum[ZS_Level], do (Actions)
            • Loop - Actions
              • Set ZS_TempPoint = (ZS_CasterLoc offset by ZS_StartCircleOffset[ZS_Level] towards ((Real(ZS_CirclInt)) x (360.00 / (Real(ZS_StartCircleNum[ZS_Level])))) degrees)
              • Special Effect - Create a special effect at ZS_TempPoint using ZS_StartSFX[ZS_Level]
              • Special Effect - Destroy (Last created special effect)
              • Custom script: call RemoveLocation(udg_ZS_TempPoint)
          • Set ZS_TempGroup1 = (Units within ZS_StartRange[ZS_Level] of ZS_CasterLoc matching (((Matching unit) belongs to an enemy of ZS_OwningPlayer[ZS_CurrentIndex]) Equal to True))
          • Unit Group - Pick every unit in ZS_TempGroup1 and do (Actions)
            • Loop - Actions
              • Unit - Cause ZS_Caster[ZS_CurrentIndex] to damage (Picked unit), dealing ZS_StartCircleDamage[ZS_Level] damage of attack type Chaos and damage type Divine
          • Custom script: call DestroyGroup(udg_ZS_TempGroup1)
          • -------- [END] Circle War Stomp [END] --------
          • -------- [START]1-second Omnislash[START] --------
          • For each (Integer ZS_LoopInt) from 1 to ZS_OmniLoop[ZS_Level], do (Actions)
            • Loop - Actions
              • Set ZS_TempGroup1 = (Units within ZS_OmniRange[ZS_Level] of ZS_CasterLoc matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of ZS_OwningPlayer[ZS_CurrentIndex]) Equal to True))))
              • Set ZS_TempUnit = (Random unit from ZS_TempGroup1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ZS_TempUnit Equal to No unit
                • Then - Actions
                • Else - Actions
                  • Animation - Change ZS_Caster[ZS_CurrentIndex]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
                  • Animation - Change ZS_Caster[ZS_CurrentIndex]'s animation speed to 300.00% of its original speed
                  • Unit Group - Pick every unit in ZS_TempGroup1 and do (Actions)
                    • Loop - Actions
                      • Set ZS_PickedUnit = (Picked unit)
                      • Set ZS_PickedUnitLoc = (Position of ZS_PickedUnit)
                      • -------- Start of Omnislashing --------
                      • Set ZS_TempPoint = (ZS_PickedUnitLoc offset by ((Real(ZS_LoopInt)) + ZS_JumpIncrement[ZS_Level]) towards (Angle from ZS_CasterLoc to ZS_PickedUnitLoc) degrees)
                      • Custom script: if IsPointJumpable(GetLocationX(udg_ZS_TempPoint), GetLocationY(udg_ZS_TempPoint)) then
                      • Custom script: call SetUnitX( udg_ZS_Caster[udg_ZS_CurrentIndex], GetLocationX(udg_ZS_PickedUnitLoc))
                      • Custom script: call SetUnitY( udg_ZS_Caster[udg_ZS_CurrentIndex], GetLocationY(udg_ZS_PickedUnitLoc))
                      • Animation - Play ZS_Caster[ZS_CurrentIndex]'s ZS_OmniAnim[ZS_Level] animation
                      • Unit - Cause ZS_Caster[ZS_CurrentIndex] to damage ZS_PickedUnit, dealing ZS_OmniDamage[ZS_Level] damage of attack type ZS_OmniAttType[ZS_Level] and damage type ZS_OmniDmgType[ZS_Level]
                      • Special Effect - Create a special effect attached to the chest of ZS_PickedUnit using ZS_OmniSfx[ZS_Level]
                      • Custom script: call Jump.start(udg_ZS_PickedUnit, GetLocationX(udg_ZS_TempPoint), GetLocationY(udg_ZS_TempPoint), udg_ZS_JumpMaxZ[udg_ZS_Level], udg_ZS_JumpDuration[udg_ZS_Level], udg_ZS_JumpGravity[udg_ZS_Level])
                      • Special Effect - Destroy (Last created special effect)
                      • Custom script: endif
                      • Custom script: call RemoveLocation(udg_ZS_PickedUnitLoc)
                      • Custom script: call RemoveLocation(udg_ZS_TempPoint)
                  • Animation - Change ZS_Caster[ZS_CurrentIndex]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
                  • Animation - Change ZS_Caster[ZS_CurrentIndex]'s animation speed to 100.00% of its original speed
          • -------- [END] Omnislash[END] --------
          • -------- [START] Final Circle War Stomp [START] --------
          • For each (Integer ZS_CirclInt) from 1 to ZS_FinalCircleNum[ZS_Level], do (Actions)
            • Loop - Actions
              • Set ZS_TempPoint = (ZS_CasterLoc offset by ZS_FinalCircleOffset[ZS_Level] towards ((Real(ZS_CirclInt)) x (360.00 / (Real(ZS_FinalCircleNum[ZS_Level])))) degrees)
              • Special Effect - Create a special effect at ZS_TempPoint using ZS_FinalSFX[ZS_Level]
              • Special Effect - Destroy (Last created special effect)
              • Custom script: call RemoveLocation(udg_ZS_TempPoint)
          • Set ZS_TempGroup1 = (Units within ZS_FinalRange[ZS_Level] of ZS_CasterLoc matching (((Matching unit) belongs to an enemy of ZS_OwningPlayer[ZS_CurrentIndex]) Equal to True))
          • Unit Group - Pick every unit in ZS_TempGroup1 and do (Actions)
            • Loop - Actions
              • Unit - Cause ZS_Caster[ZS_CurrentIndex] to damage ZS_PickedUnit, dealing ZS_FinalCircleDamage[ZS_Level] damage of attack type Chaos and damage type Divine
          • -------- [END] Final Circle War Stomp [END] --------
          • Animation - Change ZS_Caster[ZS_CurrentIndex]'s animation speed to 100.00% of its original speed
          • Custom script: call RemoveLocation(udg_ZS_TempPoint)
          • Custom script: call RemoveLocation(udg_ZS_CasterLoc)
          • -------- Recycling --------
          • Set ZS_Caster[ZS_CurrentIndex] = ZS_Caster[ZS_MaxIndex]
          • Set ZS_Counter[ZS_CurrentIndex] = ZS_Counter[ZS_MaxIndex]
          • Set ZS_OwningPlayer[ZS_CurrentIndex] = ZS_OwningPlayer[ZS_MaxIndex]
          • Set ZS_MaxIndex = (ZS_MaxIndex - 1)
          • Set ZS_CurrentIndex = (ZS_CurrentIndex - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ZS_MaxIndex Equal to 0
            • Then - Actions
              • Trigger - Turn off (This trigger)
            • Else - Actions
          • -------- Instance Recycled --------
          • -------- End Loop --------
          • -------- End Cast --------


Thanks for reading, and I look forward to your help.
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
after the loop, do this:
  • Loop
    • Set TempIndex = Index[ZS_CurrentIndex]
then use the TempIndex to point all instances, like this:
  • Set ZS_CasterLoc = (Position of ZS_Caster[TempIndex])
you do not need to reduce all your instances manually, remember the one I told you, the destroyed index equals to the last index when spell is done...
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
This won't help you solve your problem, but I don't really understand the point of this part:
  • For each (Integer ZS_LoopInt) from 1 to ZS_OmniLoop[ZS_Level], do (Actions)
    • Loop - Actions
      • Set ZS_TempGroup1 = (Units within ZS_OmniRange[ZS_Level] of ZS_CasterLoc matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of ZS_OwningPlayer[ZS_CurrentIndex]) Equal to True))))
      • Set ZS_TempUnit = (Random unit from ZS_TempGroup1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ZS_TempUnit Equal to No unit
        • Then - Actions
        • Else - Actions
          • ... continues with picking every unit in tempgroup1
I think you could use a boolean condition "Unit group is empty" to find out if tempgroup1 is empty, instead of setting tempunit as random unit from that group and then checking if temp unit is no unit.

Also, why do you need the loop in the first place? If I understood that Omnislash part correctly, then you have:
p1 = point of caster
r = range, which is static (i.e. it does not change)
x = ZS_OmniLoop[ZS_Level]

So from 1 to x you create unit within "r" range of p1. Both p1 and r do not change, so you x times create the same group and damage everyone in it.
Why don't you simply create the group only once and causing "dmg" to everyone in it. The "dmg" calculation would be: "dmg" = ( ZS_OmniDamage[ZS_Level] * x ) so you would haev it as "ZS_OmniDamage[ZS_Level] * ZS_OmniLoop[ZS_Level]"
 
Status
Not open for further replies.
Top