• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Unit Groups not working properly

Status
Not open for further replies.
Level 19
Joined
Aug 8, 2007
Messages
2,765
JASS:
function Abilitys_Func takes nothing returns nothing
    if GetLearnedSkill() == 'A03W' then
        call GroupAddUnitSimple(GetLearningUnit(), udg_LightningStormGroup)
    else
        call DisplayTextToForce(GetPlayersAll(), "Not A Recognized Ability")
    endif
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_005 takes nothing returns nothing
    set Abilitys = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ(Abilitys, EVENT_PLAYER_HERO_SKILL)
    call TriggerAddAction(Abilitys, function Abilitys_Func)
endfunction

globals
    trigger Abilitys
endglobals

I use this to init my ability learn trigger and when i learn 'A03W' it doesnt say Not a Recognized ability so that should be all good.

  • Lightning Periodic
    • Events
      • Time - Every 6.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in LightningStormGroup) Not equal to 0
        • Then - Actions
          • Unit Group - Pick every unit in LightningStormGroup and do (Actions)
            • Loop - Actions
              • Set TempUnit = (Picked unit)
              • Set TempLoc = (Position of TempUnit)
              • Set TempUnitGroup2 = (Units within (525.00 + (75.00 x (Real((Level of Mind of the Storm T1 ELEM for TempUnit))))) of TempLoc matching (((Owner of TempUnit) Equal to Neutral Hostile) or ((Owner of TempUnit) Equal to Player 12 (Brown))))
              • Custom script: call RemoveLocation(udg_TempLoc)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in TempUnitGroup2) Not equal to 0
                • Then - Actions
                  • Unit Group - Pick every unit in TempUnitGroup2 and do (Actions)
                    • Loop - Actions
                      • Game - Display to (All players) for 30.00 seconds the text: Successful?
                      • Set TempLoc = (Position of (Picked unit))
                      • Special Effect - Create a special effect at TempLoc using war3mapImported\Great Lightning.mdx
                      • Special Effect - Destroy (Last created special effect)
                      • Unit - Cause TempUnit to damage (Picked unit), dealing (((Real((Intelligence of TempUnit (Include bonuses)))) x (2.00 + (Real((Level of Mind of the Storm T1 ELEM for (Picked unit)))))) + 0.00) damage of attack type Spells and damage type Normal
                      • Custom script: call RemoveLocation(udg_TempLoc)
                      • Game - Display to (All players) for 30.00 seconds the text: Successful!
                • Else - Actions
                  • Game - Display to (All players) for 30.00 seconds the text: No Targets!
        • Else - Actions
          • Game - Display to (All players) for 30.00 seconds the text: No Heroes!
This always returns no heroes!! Even if i learn 'A03W' and it doesnt print not recogniezd ability! what the hell am i doing wrong
 
This might be because of the set bj_wantDestroyGroup = true.
That script may be destroying LightningStormGroup, therefore your trigger will only work in the first time it runs (when this group still exists). When it's destroyed, the following executions will fail.

Try removing that line and test it.
If it works, try putting that line just before the second "Pick" (the group that actually should be destroyed).

I have no WE here, so I may be wrong. It's just a quick look on it... xD
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
but why u use bj_wantDestroyGroup if u use unit group variable? if i am not wrong then it is usefull when u dont use variable for pick units

dont need to destory a temp unit group if u use more time during the game, u must destroy that groups what u dont use anymore and not what u willl use later
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Not done yet.. heres my current trigger

  • Lightning Periodic
    • Events
      • Time - Every 6.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in LightningStormGroup) Not equal to 0
        • Then - Actions
          • Unit Group - Pick every unit in LightningStormGroup and do (Actions)
            • Loop - Actions
              • Set TempUnit = (Picked unit)
              • Set TempLoc = (Position of TempUnit)
              • Set TempUnitGroup2 = (Units within (525.00 + (75.00 x (Real((Level of Mind of the Storm T1 ELEM for TempUnit))))) of TempLoc matching (((Owner of (Picked unit)) Equal to Neutral Hostile) or ((Owner of (Picked unit)) Equal to Player 12 (Brown))))
              • Custom script: call RemoveLocation(udg_TempLoc)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in TempUnitGroup2) Not equal to 0
                • Then - Actions
                  • Unit Group - Pick every unit in TempUnitGroup2 and do (Actions)
                    • Loop - Actions
                      • Game - Display to (All players) for 30.00 seconds the text: Successful?
                      • Set TempLoc = (Position of (Picked unit))
                      • Special Effect - Create a special effect at TempLoc using war3mapImported\Great Lightning.mdx
                      • Special Effect - Destroy (Last created special effect)
                      • Unit - Cause TempUnit to damage (Picked unit), dealing (((Real((Intelligence of TempUnit (Include bonuses)))) x (2.00 + (Real((Level of Mind of the Storm T1 ELEM for (Picked unit)))))) + 0.00) damage of attack type Spells and damage type Normal
                      • Custom script: call RemoveLocation(udg_TempLoc)
                      • Game - Display to (All players) for 30.00 seconds the text: Successful!
                • Else - Actions
                  • Game - Display to (All players) for 30.00 seconds the text: No Targets!
        • Else - Actions
          • Game - Display to (All players) for 30.00 seconds the text: No Heroes!
Now returns "No Targets!"
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
when u do pick all unit with condition then there use matching unit not picked unit like here

  • Unit Group - Pick every unit in (Units within 512.00 of point matching (((Owner of (Matching unit)) Equal to Neutral Hostile) or ((Owner of (Matching unit)) Equal to Player 12 (Brown)))) and do (Actions)
    • Loop - Actions
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Now the trigger works, but it only deals damage to 1 unit even though it displays all of the lighnting models... :s
 
Status
Not open for further replies.
Top