• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Spell Help

Status
Not open for further replies.
Level 12
Joined
Nov 20, 2007
Messages
660
Hello guys, i tryed to make a Death Coil by using triggers (Missle System) but i have a problem with indexing system. Missles stuck when i start spamming Death Coil. +rep for peoples who can help me :goblin_yeah:
  • Death Coil
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Death Coil (DK)
    • Actions
      • Set DK_DC_Index[2] = (DK_DC_Index[2] + 1)
      • Set DK_DC_Index[3] = (DK_DC_Index[3] + 1)
      • Set DK_DC_Caster[DK_DC_Index[2]] = (Casting unit)
      • Set DK_DC_Target[DK_DC_Index[2]] = (Target unit of ability being cast)
      • Set DK_DC_Missle_Distance[DK_DC_Index[2]] = (Distance between (Position of DK_DC_Missle[DK_DC_Index[2]]) and (Position of DK_DC_Target[DK_DC_Index[2]]))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DK_DC_Target[DK_DC_Index[2]] belongs to an ally of (Owner of DK_DC_Caster[DK_DC_Index[2]])) Equal to True
        • Then - Actions
          • Set DK_DC_Heal[DK_DC_Index[2]] = (2.00 x Hero_Attack_Power[(Player number of (Owner of DK_DC_Caster[DK_DC_Index[2]]))])
        • Else - Actions
          • Set DK_DC_Damage[DK_DC_Index[2]] = (400.00 + Hero_Attack_Power[(Player number of (Owner of DK_DC_Caster[DK_DC_Index[2]]))])
      • Set Spells_Crit_Chance = (Random real number between 1.00 and 100.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Spells_Crit_Chance Less than or equal to Hero_Critical_Strike[(Player number of (Owner of DK_DC_Caster[DK_DC_Index[2]]))]
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DK_DC_Damage[DK_DC_Index[2]] Greater than 0.00
            • Then - Actions
              • Set DK_DC_Damage[DK_DC_Index[2]] = (DK_DC_Damage[DK_DC_Index[2]] x 2.00)
            • Else - Actions
              • Set DK_DC_Heal[DK_DC_Index[2]] = (DK_DC_Heal[DK_DC_Index[2]] x 2.00)
        • Else - Actions
      • Set DK_DC_Leak_Point = ((Position of DK_DC_Caster[DK_DC_Index[2]]) offset by 150.00 towards (Facing of DK_DC_Caster[DK_DC_Index[2]]) degrees)
      • Unit - Create 1 Death Coil (Missle) for (Owner of DK_DC_Caster[DK_DC_Index[2]]) at DK_DC_Leak_Point facing (Angle from (Position of DK_DC_Caster[DK_DC_Index[2]]) to (Position of DK_DC_Target[DK_DC_Index[2]])) degrees
      • Set DK_DC_Missle[DK_DC_Index[2]] = (Last created unit)
      • Custom script: call RemoveLocation (udg_DK_DC_Leak_Point)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DK_DC_Index[3] Equal to 1
        • Then - Actions
          • Trigger - Turn on Death Coil Move <gen>
        • Else - Actions

  • Death Coil Move
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer DK_DC_Index[1]) from 1 to DK_DC_Index[2], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DK_DC_Missle_Distance[DK_DC_Index[1]] Greater than or equal to 100.00
            • Then - Actions
              • Set DK_DC_Leak_Point = ((Position of DK_DC_Missle[DK_DC_Index[1]]) offset by 30.00 towards (Angle from (Position of DK_DC_Missle[DK_DC_Index[1]]) to (Position of DK_DC_Target[DK_DC_Index[1]])) degrees)
              • Unit - Move DK_DC_Missle[DK_DC_Index[1]] instantly to DK_DC_Leak_Point, facing (Angle from (Position of DK_DC_Missle[DK_DC_Index[1]]) to (Position of DK_DC_Target[DK_DC_Index[1]])) degrees
              • Set DK_DC_Missle_Distance[DK_DC_Index[1]] = (Distance between (Position of DK_DC_Missle[DK_DC_Index[1]]) and (Position of DK_DC_Target[DK_DC_Index[1]]))
            • Else - Actions
              • Unit - Remove DK_DC_Missle[DK_DC_Index[1]] from the game
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DK_DC_Damage[DK_DC_Index[1]] Greater than 0.00
                • Then - Actions
                  • Unit - Cause DK_DC_Caster[DK_DC_Index[1]] to damage DK_DC_Target[DK_DC_Index[1]], dealing DK_DC_Damage[DK_DC_Index[1]] damage of attack type Spells and damage type Normal
                • Else - Actions
                  • Unit - Set life of DK_DC_Target[DK_DC_Index[1]] to ((Life of DK_DC_Target[DK_DC_Index[1]]) + DK_DC_Heal[DK_DC_Index[1]])
              • Set SDD_Unit = DK_DC_Target[DK_DC_Index[1]]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DK_DC_Damage[DK_DC_Index[1]] Greater than 0.00
                • Then - Actions
                  • Set SDD_Text = (String(DK_DC_Damage[DK_DC_Index[1]]))
                  • Set SDD_Text_Color = |cffffcc00
                • Else - Actions
                  • Set SDD_Text = (String(DK_DC_Heal[DK_DC_Index[1]]))
                  • Set SDD_Text_Color = |cff66ff00
              • Trigger - Run Spell Damage Display <gen> (ignoring conditions)
              • Set DK_DC_Caster[DK_DC_Index[1]] = DK_DC_Caster[DK_DC_Index[2]]
              • Set DK_DC_Target[DK_DC_Index[1]] = DK_DC_Target[DK_DC_Index[2]]
              • Set DK_DC_Missle[DK_DC_Index[1]] = DK_DC_Missle[DK_DC_Index[2]]
              • Set DK_DC_Missle_Distance[DK_DC_Index[1]] = DK_DC_Missle_Distance[DK_DC_Index[2]]
              • Set DK_DC_Damage[DK_DC_Index[1]] = DK_DC_Damage[DK_DC_Index[2]]
              • Set DK_DC_Heal[DK_DC_Index[1]] = DK_DC_Heal[DK_DC_Index[2]]
              • Set DK_DC_Index[2] = (DK_DC_Index[2] - 1)
              • Set DK_DC_Index[3] = (DK_DC_Index[3] - 1)
          • Custom script: call RemoveLocation (udg_DK_DC_Leak_Point)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DK_DC_Index[3] Equal to 0
            • Then - Actions
              • Trigger - Turn off (This trigger)
            • Else - Actions
attachment.php


PROBLEM STATUS : SOLVED
Peoples who helped me:
-InfinateAnswers

Update : I started testing and i guess there is a problem with recycling, still testing
Update : Problem found : i forget to add "Missle" to recycling :D, but the spell is still bugged (Triggers refreshed)
Update : Observation ! when missle hit the target, if there is other missle launched it will stop
Update : Triggers Refresh (Some changes)
Update : The problem is next : if you launch 2,3,4,...,n missles, when the first missle touch the target, all missles STOP
Update : Problem fixed, triggers reloaded and rep given
 

Attachments

  • bug.JPG
    bug.JPG
    245.7 KB · Views: 295
Last edited:
  • Set DK_DC_Index[2] = (DK_DC_Index[2] - 1)
  • Set DK_DC_Index[3] = (DK_DC_Index[3] - 1)
This should be:
  • Set DK_DC_Index[3] = (DK_DC_Index[3] - 1)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • DK_DC_Index[3] Equal to 0
    • Then - Actions
      • Set DK_DC_Index[2] = 0
      • Trigger - Turn off (This trigger)
 
  • Set DK_DC_Index[2] = (DK_DC_Index[2] - 1)
  • Set DK_DC_Index[3] = (DK_DC_Index[3] - 1)
This should be:
  • Set DK_DC_Index[3] = (DK_DC_Index[3] - 1)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • DK_DC_Index[3] Equal to 0
    • Then - Actions
      • Set DK_DC_Index[2] = 0
      • Trigger - Turn off (This trigger)

neah, that's not it :)
  • MissileLoop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer SPELL_LOOP) from 1 to SPELL_Index_Size, do (Actions)
        • Loop - Actions
          • -------- This let look everything cleaner. --------
          • Set TempInt = SPELL_Index[SPELL_LOOP]
          • -------- Condition... --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SPELL_DUR[TempInt] Greater than 0.00
            • Then - Actions
              • -------- Actions --------
              • Set TempLoc = (Position of SPELL_MISSILE[TempInt])
              • Set TempLoc2 = (TempLoc offset by SPELL_SPEED[TempInt] towards SPELL_ANGLE[TempInt] degrees)
              • Unit - Move SPELL_MISSILE[TempInt] instantly to TempLoc2, facing SPELL_ANGLE[TempInt] degrees
              • Custom script: set bj_wantDestroyGroup=true
              • Unit Group - Pick every unit in (Units within 200.00 of TempLoc2) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (SPELL_CASTER[TempInt] belongs to an enemy of (Owner of (Picked unit))) Equal to True
                    • Then - Actions
                      • Unit - Cause SPELL_CASTER[TempInt] to damage (Picked unit), dealing 75.00 damage of attack type Spells and damage type Normal
                      • Set SPELL_DUR[TempInt] = 0.00
                    • Else - Actions
              • Set SPELL_DUR[TempInt] = (SPELL_DUR[TempInt] - 0.03)
              • Custom script: call RemoveLocation(udg_TempLoc)
              • Custom script: call RemoveLocation(udg_TempLoc2)
            • Else - Actions
              • -------- Destroy handles --------
              • Unit - Kill SPELL_MISSILE[TempInt]
              • -------- RecycleIndex --------
              • Set SPELL_Index[SPELL_LOOP] = SPELL_Index[SPELL_Index_Size]
              • Set SPELL_Index[SPELL_Index_Size] = TempInt
              • Set SPELL_Index_Size = (SPELL_Index_Size - 1)
              • Set SPELL_LOOP = (SPELL_LOOP - 1)
      • -------- Turn the trigger again off if the index_size is below 0... --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SPELL_Index_Size Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions

Tutorial

The problem is with recycling i guess ...
 
i solve the problem (check the triggers if you want :D), but it was bugged on that fixed version. I uploaded the replay if you wanna see it :)
The solution is:
Change DK_DC_Index[1] to DK_DC_Index[2] and vice versa
  • Set DK_DC_Caster[DK_DC_Index[2]] = DK_DC_Caster[DK_DC_Index[1]]
The right way
  • Set DK_DC_Caster[DK_DC_Index[1]] = DK_DC_Caster[DK_DC_Index[2]]
+rep for you and thanks for help :ogre_haosis:
 

Attachments

Status
Not open for further replies.
Back
Top