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

[Solved] Part of trigger is being skipped?

Status
Not open for further replies.
Level 2
Joined
Apr 13, 2018
Messages
14
It might not be being skipped but it sure looks that way.

The spell is to shoot one projectile towards one enemy unit, which upon impact, will shoot three additional projectiles to three nearby enemy units, from the primary target's location. I am using this projectile system.

The problem is, every other bit of the spell works, except for the part where the primary missile has reached the target and has to now search for new nearby targets.

  • FB Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set FB_Ability = Frost Blades
      • Set FB_AttackType = Spells
      • Set FB_DamageType = Cold
      • Set FB_Model = Abilities\Spells\Other\FrostArrows\NagaColdArrowMissile.mdl
      • Set FB_Speed[1] = 30.00
      • Set FB_Speed[2] = 50.00
      • Set FB_Speed[3] = 70.00
      • Set FB_Blades[1] = 3
      • Set FB_Blades[2] = 5
      • Set FB_Blades[3] = 7
      • Set FB_CurrentIndex = 0
      • Set FB_MaxIndex = 0
      • Set FB_TempInt = 0

  • FB Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to FB_Ability
    • Actions
      • Set FB_MaxIndex = (FB_MaxIndex + 1)
      • -------- Sertup Spell Stuff --------
      • Set FB_Caster[FB_MaxIndex] = (Triggering unit)
      • Set FB_Owner[FB_MaxIndex] = (Owner of FB_Caster[FB_MaxIndex])
      • Set FB_Level[FB_MaxIndex] = (Level of FB_Ability for FB_Caster[FB_MaxIndex])
      • Set FB_PrimaryTarget[FB_MaxIndex] = (Target unit of ability being cast)
      • Set FB_Counter[FB_MaxIndex] = 0
      • Set FB_DistCalc[FB_MaxIndex] = 0
      • Set FB_CasterPoint[FB_MaxIndex] = (Position of FB_Caster[FB_MaxIndex])
      • Set FB_TargetPoint[FB_MaxIndex] = (Position of FB_PrimaryTarget[FB_MaxIndex])
      • Set FB_Distance[FB_MaxIndex] = (Distance between FB_CasterPoint[FB_MaxIndex] and FB_TargetPoint[FB_MaxIndex])
      • Set FB_EnemyGroup[FB_MaxIndex] = (Units within 1000.00 of FB_TargetPoint[FB_MaxIndex] matching (((Matching unit) belongs to an enemy of FB_Owner[FB_MaxIndex]) Equal to True))
      • -------- Fire the initial projectile --------
      • Set Projectile_AttackType = FB_AttackType
      • Set Projectile_Damage = 100.00
      • Set Projectile_DamageType = Magic
      • Set Projectile_Impact = Abilities\Spells\Other\FrostArrows\NagaColdArrowMissile.mdl
      • Set Projectile_Height = 60.00
      • Set Projectile_Model = Abilities\Spells\Other\FrostArrows\NagaColdArrowMissile.mdl
      • Set Projectile_Source = FB_Caster[FB_MaxIndex]
      • Set Projectile_Speed = FB_Speed[FB_Level[FB_MaxIndex]]
      • Set Projectile_TargetUnit = FB_PrimaryTarget[FB_MaxIndex]
      • Set Projectile_UnitOrPoint = True
      • Custom script: call TriggerExecute( gg_trg_CPS_Creating )
      • -------- Start the second phase --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FB_MaxIndex Equal to 1
        • Then - Actions
          • Trigger - Turn on FB Loop <gen>
        • Else - Actions

  • FB Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer FB_CurrentIndex) from 1 to FB_MaxIndex, do (Actions)
        • Loop - Actions
          • Set FB_DistCalc[FB_CurrentIndex] = ((Integer(FB_Distance[FB_CurrentIndex])) / (Integer(FB_Speed[FB_Level[FB_CurrentIndex]])))
          • -------- Increment the counter every 0.03 seconds, then check after the distance is traveled) --------
          • Set FB_Counter[FB_CurrentIndex] = (FB_Counter[FB_CurrentIndex] + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • FB_Counter[FB_CurrentIndex] Greater than or equal to FB_DistCalc[FB_CurrentIndex]
            • Then - Actions
              • -------- These actions occur when the projectile hits the target unit --------
              • Unit Group - Pick every unit in FB_EnemyGroup[FB_CurrentIndex] and do (Actions)
                • Loop - Actions
                  • Unit - Kill (Matching unit)
              • Custom script: call DestroyGroup(udg_FB_EnemyGroup[udg_FB_MaxIndex])
            • Else - Actions
          • -------- Recycling --------
          • Set FB_Counter[FB_CurrentIndex] = FB_Counter[FB_MaxIndex]
          • Set FB_Caster[FB_CurrentIndex] = FB_Caster[FB_MaxIndex]
          • Set FB_PrimaryTarget[FB_CurrentIndex] = FB_PrimaryTarget[FB_MaxIndex]
          • Set FB_DistCalc[FB_CurrentIndex] = FB_DistCalc[FB_MaxIndex]
          • Set FB_Distance[FB_CurrentIndex] = FB_Distance[FB_MaxIndex]
          • Set FB_Owner[FB_CurrentIndex] = FB_Owner[FB_MaxIndex]
          • Set FB_CasterPoint[FB_CurrentIndex] = FB_CasterPoint[FB_MaxIndex]
          • Set FB_TargetPoint[FB_CurrentIndex] = FB_TargetPoint[FB_MaxIndex]
          • Set FB_EnemyGroup[FB_CurrentIndex] = FB_EnemyGroup[FB_MaxIndex]
          • Set FB_Level[FB_CurrentIndex] = FB_Level[FB_MaxIndex]
          • Set FB_MaxIndex = (FB_MaxIndex - 1)
          • Set FB_CurrentIndex = (FB_CurrentIndex - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • FB_MaxIndex Equal to 0
            • Then - Actions
              • Trigger - Turn off (This trigger)
            • Else - Actions

The problem part is in the 'FB Loop' trigger. I tried testing the unit group selection with the Kill (Matching Unit), but they wouldn't die. I just know that at least three units are being selected, because when made to print out a message, the message is printed out three times. I just seem to not be able to do anything to those units.

I would appreciate some help, and if possible, some comments and critique on the code as a whole.
Would really help towards an improvement :D

Thank you for your time!
 
Level 2
Joined
Apr 13, 2018
Messages
14
Unit - Kill (Matching unit)
Should be picked unit, matching unit is when it is in a condition like "Pick every unit owned by Player 1 (Red) matching Condition"

Alas, good sir, I tried, and it still won't execute anything with regards to the picked units.

I tried changing the projectile system, but that doesn't seem to be the problem. I know it chooses the units at least, because it's able to print out a message when the picking occurs, but it doesn't seem to do anything beyond that.
 
Level 2
Joined
Apr 13, 2018
Messages
14
The recycling actions are in the wrong place. They are only meant to fire when the fireball impacts the unit. What is happening is you instantly destroy your spell instance before the fireball impacts.

Hmm I see!
Well, it certainly works now right after I moved the recycling actions right after the unit group selection.

But sigh, the darn missiles still won't create from the target loc and the new locations.
It's alright, I'll try to code the movement of the projectile myself this time.

Thank you guys for the help!
 
Status
Not open for further replies.
Top