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

Problem with a spell

Status
Not open for further replies.
Level 7
Joined
Apr 1, 2010
Messages
289
  • ChargeLoop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer CM) from 1 to ChargeMax, do (Actions)
        • Loop - Actions
          • Game - Display to (All players) the text: is casting
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (ChargeCaster[CM] is alive) Equal to True
              • (Current order of ChargeCaster[CM]) Equal to (Order(stampede))
            • Then - Actions
              • Set Integer1 = (Random integer number between 1 and 100)
              • Set Loc_to_remove2 = (Position of ChargeCaster[CM])
              • Set zzangle = (Facing of ChargeCaster[CM])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Integer1 Less than or equal to ChargeSpawn[CM]
                • Then - Actions
                  • Set Real1 = (Random real number between (zzangle + 100.00) and (zzangle + 260.00))
                  • Set Loc_to_remove = (Loc_to_remove2 offset by 570.00 towards Real1 degrees)
                  • Unit - Create 1 Chivalric Knight for ChargePlayer[CM] at Loc_to_remove facing zzangle degrees
                  • Unit Group - Add (Last created unit) to ChargeGroup[CM]
                  • Animation - Play (Last created unit)'s walk animation
                • Else - Actions
              • Unit Group - Pick every unit in ChargeGroup[CM] and do (Actions)
                • Loop - Actions
                  • Set Unit1 = (Picked unit)
                  • Set Loc_to_remove = (Position of Unit1)
                  • Set TempPoint = (Loc_to_remove offset by 20.00 towards zzangle degrees)
                  • Custom script: call SetUnitX(udg_Unit1,GetLocationX(udg_TempPoint))
                  • Custom script: call SetUnitY(udg_Unit1,GetLocationY(udg_TempPoint))
                  • Custom script: call RemoveLocation(udg_Loc_to_remove)
                  • Set Loc_to_remove = (Loc_to_remove offset by 2.00 towards zzangle degrees)
                  • Set Loc_to_remove3 = (Loc_to_remove offset by -2.00 towards zzangle degrees)
                  • Set Real2 = (Distance between Loc_to_remove and TempPoint)
                  • Set Real2 = (Real2 / (Distance between Loc_to_remove3 and TempPoint))
                  • Set Real2 = (Real2 x 0.50)
                  • Set Real3 = (Distance between Loc_to_remove2 and TempPoint)
                  • Set Real1 = (Abs((Real2 / Real3)))
                  • Set Real1 = (Real1 x 100.00)
                  • Custom script: call RemoveLocation(udg_Loc_to_remove3)
                  • Custom script: call RemoveLocation(udg_Loc_to_remove)
                  • Animation - Change Unit1's vertex coloring to (100.00%, 100.00%, 100.00%) with Real1% transparency
                  • Set Group1 = (Units within 78.00 of TempPoint 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 ChargePlayer[CM]) Equal to True))))
                  • For each (Integer A) from 1 to (Number of units in Group1), do (Actions)
                    • Loop - Actions
                      • Set Unit2 = (Random unit from Group1)
                      • Unit Group - Remove Unit2 from Group1
                      • Set Loc_to_remove = (Position of Unit2)
                      • Set zzangle = (Angle from TempPoint to Loc_to_remove)
                      • Set Loc_to_remove3 = (Loc_to_remove offset by 20.00 towards zzangle degrees)
                      • Unit - Cause ChargeCaster[CM] to damage Unit2, dealing (ChargeDamage[CM] x Real1) damage of attack type Siege and damage type Normal
                      • Unit - Move Unit2 instantly to Loc_to_remove3
                      • Special Effect - Create a special effect attached to the chest of Unit2 using Abilities\Spells\Orc\MirrorImage\MirrorImageDeathCaster.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Custom script: call RemoveLocation(udg_Loc_to_remove3)
                      • Custom script: call RemoveLocation(udg_Loc_to_remove)
                  • Custom script: call DestroyGroup(udg_Group1)
                  • Set Group1 = (Units within 600.00 of Loc_to_remove2)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit1 is in Group1) Equal to False
                    • Then - Actions
                      • Unit - Remove Unit1 from the game
                      • Special Effect - Create a special effect at TempPoint using Units\NightElf\Wisp\WispExplode.mdl
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                  • Custom script: call DestroyGroup(udg_Group1)
              • Custom script: call RemoveLocation(udg_Loc_to_remove2)
            • Else - Actions
              • Unit Group - Pick every unit in ChargeGroup[CM] and do (Actions)
                • Loop - Actions
                  • Set Unit1 = (Picked unit)
                  • Set Loc_to_remove = (Position of Unit1)
                  • Unit - Remove Unit1 from the game
                  • Special Effect - Create a special effect at Loc_to_remove using Units\NightElf\Wisp\WispExplode.mdl
                  • Special Effect - Destroy (Last created special effect)
              • Custom script: call DestroyGroup(udg_ChargeGroup[udg_CM])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TM Equal to TacticsMax
                • Then - Actions
                  • Set TacticsMax = (TacticsMax - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • TacticsMax Equal to 0
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
  • ChargeCast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Charge!!
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ChargeMax Equal to 0
        • Then - Actions
          • Trigger - Turn on ChargeLoop <gen>
        • Else - Actions
      • Set ChargeMax = (ChargeMax + 1)
      • Set ChargeCaster[ChargeMax] = (Triggering unit)
      • Set ChargePlayer[ChargeMax] = (Triggering player)
      • Set Integer1 = (Level of Charge!! for ChargeCaster[ChargeMax])
      • Set ChargeDamage[ChargeMax] = ((5.00 x (Real(Integer1))) + 15.00)
      • Set ChargeSpawn[ChargeMax] = ((2 x Integer1) + 2)
The first cast works if
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Unit1 is in Group1) Equal to False
    • Then - Actions
      • Unit - Remove Unit1 from the game
      • Special Effect - Create a special effect at TempPoint using Units\NightElf\Wisp\WispExplode.mdl
      • Special Effect - Destroy (Last created special effect)
    • Else - Actions
is disabled. but only the first cast works , after that it creates the units but they don't move. and the trigger doesn't turn off.
 
Level 16
Joined
May 1, 2008
Messages
1,605
Well aren't some things not correct, or just my bad GUI understanding?

1) In the loop trigger, where you pick all units in the ChargeGroup, you set "Loc_To_Remove = (Position of Unit1)", then you set the TempPoint to it and use the custom script "call DestroyLocation(udg_Loc_to_remove), but when you set "set loc_to_remove = loc_to_remove + ....) " but at this case "loc_to_remove" is 0 because you destroyed it...

2) The last if then else should be out of the loop as far as I know. Also where you set "TacticsMax" and "TM"?, because I don't see it.

3) Why is "Set Loc_to_remove2 = (Position of ChargeCaster[CM])" in the loop trigger. When I see your order check the caster can't move anyway, so put it in the cast trigger.

4) Also your way to use "Integer1" variable confuse me, first you set the level of the casted ability in it, then you use this variable for a Random Integer from 1 to 100? Also shouldn't "Integer1" be a array variable too?

5) I learned GUI like this that if you use "For each (Integer CM) from 1 to ChargeMax, do (Actions)" that all used variables in this loop must contain an array like [CM] here =O

Well there are some things more I don't get so Maker right, upload the testmap - need to know this
 
Status
Not open for further replies.
Top