• 🏆 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] spell not working! (medium difficulty)

Status
Not open for further replies.
Level 9
Joined
Jan 14, 2008
Messages
366
  • nova of light
    • Events
      • Unit - Southern paladin 0009 <gen> Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Nova of light
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Nova of light for (Triggering unit)) Equal to 1
        • Then - Actions
          • Set Temp_Integer_NOL = 50
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Nova of light for (Triggering unit)) Equal to 2
        • Then - Actions
          • Set Temp_Integer_NOL = 80
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Nova of light for (Triggering unit)) Equal to 3
        • Then - Actions
          • Set Temp_Integer_NOL = 140
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Nova of light for (Triggering unit)) Equal to 4
        • Then - Actions
          • Set Temp_Integer_NOL = 190
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Nova of light for (Triggering unit)) Equal to 5
        • Then - Actions
          • Set Temp_Integer_NOL = 245
        • Else - Actions
      • Set Temp_Point = (Position of (Triggering unit))
      • Set Temp_Integer_NOL2 = (150 + ((Level of Nova of light for (Triggering unit)) x 25))
      • Sound - Play MarkOfChaos <gen> at 100.00% volume, located at Temp_Point with Z offset 25.00
      • Special Effect - Create a special effect at Temp_Point using TheHolyBomb.mdx
      • Special Effect - Destroy (Last created special effect)
      • Unit Group - Pick every unit in (Units within (Real(Temp_Integer_NOL2)) of Temp_Point matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to Unitgroup1
      • Unit - Create 1 nova of light armorbonus dummy for (Owner of (Triggering unit)) at Temp_Point facing (Facing of (Triggering unit)) degrees
      • Unit - Set level of DM inner fire for nova of light for (Last created unit) to (Number of units in Unitgroup1)
      • Advanced - Make (Last created unit) unselectable and untargetable
      • Unit - Order (Last created unit) to Human Priest - Inner Fire (Triggering unit)
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Custom script: call DestroyGroup( udg_Unitgroup1 )
      • Custom script: call DestroyGroup (udg_Unitgroup1)
the spell works perfectly fine, the only problem is, that after it has been cast once, somehow the integer that counts the number of units in the "unitgroup1" unit group, always is 1. wich is obviously incorrect.

therefore the problem must be something with the unit group.
i suspect i didnt destroy the group correctly or something similar
must be the cause of the problem.

any help greatly appreciated.
 
Level 9
Joined
Apr 3, 2008
Messages
700
No. Matching unit is only for filtring units in group.

1. To optimize a trigger, you can make a loop, local integer i = ability levels, global integer array TempInt instead of Temp_Integer_NOL
2. There is a sound leak in your trigger.
3. Use local unit groups and your problem will be solved.
 
Level 3
Joined
Jan 5, 2009
Messages
50
a local variable is a variable that can only be used in that one trigger. its for MUI stuff
 
Level 9
Joined
Apr 3, 2008
Messages
700
Look info about locals in Jass tutorials for beginners.
Globals are variable that you set before all code. (Between globals and endglobals tags, you can look it in war3map.j)
Local varaibles should be difined in the first lines of function body.
local <variable type> <variable name>=<variable value>
 
Status
Not open for further replies.
Top