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

[JASS] Why does this not worl?

Status
Not open for further replies.
Level 11
Joined
Apr 28, 2008
Messages
696
This function highlights the talentbuttons in one of my talentrees in dependence to the allready spent talentpoints. The talenttiers are packed together in unitgroups. In my GUI version it works perfect. But in this to jass converted version it doesn't. does anyone has an idea?

JASS:
function AdjustButtonBrightness takes nothing returns nothing
    call SetUnitVertexColor( GetEnumUnit(), 100, 100, 100, 0 )
endfunction

function LightTalentButton takes nothing returns nothing
if ( HeroStatPointsTalent > 0 ) then
    // STRENGTH DEF
    if ( TalentSpentTotalSTRDEF >= 20 ) then
        call ForGroup( TalentTierGroupSTRDEF[5], function AdjustButtonBrightness)
    else
        if ( TalentSpentTotalSTRDEF >= 15 ) then
            call ForGroup( TalentTierGroupSTRDEF[4], function AdjustButtonBrightness)
        else
            if ( TalentSpentTotalSTRDEF >= 10 ) then
                call ForGroup( TalentTierGroupSTRDEF[3], function AdjustButtonBrightness)
            else
                if ( TalentSpentTotalSTRDEF >= 5 ) then
                    call ForGroup( TalentTierGroupSTRDEF[2], function AdjustButtonBrightness)
                else
                    call ForGroup( TalentTierGroupSTRDEF[1], function AdjustButtonBrightness)
                endif
            endif
        endif
    endif

For comparing reasons, here is the GUI version:

  • TalentLightTalentbutton
    • Ereignisse
    • Bedingungen
      • HeroStatsPointsTalent (>) 0
    • Aktionen
      • -------- STRENGTH DEF --------
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • 'IF'-Bedingungen
            • TalentSpentTotalSTRDEF (>=) 20
          • 'THEN'-Aktionen
            • Einheitengruppe - Pick every unit in TalentTierGroupSTRDEF[5] and do (Actions)
              • Schleifen - Aktionen
                • Animation - Change (Picked unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
          • 'ELSE'-Aktionen
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • 'IF'-Bedingungen
                • TalentSpentTotalSTRDEF (>=) 15
              • 'THEN'-Aktionen
                • Einheitengruppe - Pick every unit in TalentTierGroupSTRDEF[4] and do (Actions)
                  • Schleifen - Aktionen
                    • Animation - Change (Picked unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
              • 'ELSE'-Aktionen
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • 'IF'-Bedingungen
                    • TalentSpentTotalSTRDEF (>=) 10
                  • 'THEN'-Aktionen
                    • Einheitengruppe - Pick every unit in TalentTierGroupSTRDEF[3] and do (Actions)
                      • Schleifen - Aktionen
                        • Animation - Change (Picked unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
                  • 'ELSE'-Aktionen
                    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • 'IF'-Bedingungen
                        • TalentSpentTotalSTRDEF (>=) 5
                      • 'THEN'-Aktionen
                        • Einheitengruppe - Pick every unit in TalentTierGroupSTRDEF[2] and do (Actions)
                          • Schleifen - Aktionen
                            • Animation - Change (Picked unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
                      • 'ELSE'-Aktionen
                        • Einheitengruppe - Pick every unit in TalentTierGroupSTRDEF[1] and do (Actions)
                          • Schleifen - Aktionen
                            • Animation - Change (Picked unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
The groups are initilized correctly, no compiling errors etc. So why the heck does the JASS version not work?
 
Level 11
Joined
Apr 28, 2008
Messages
696
The function is called, so I need no event. For single buttons it works, but not for the tiergroups, thats the strange part.
 
Level 11
Joined
Apr 28, 2008
Messages
696
I just found out why that code wasn't working as intended. The code itself is correct. but I messed up the initialisation of the groupsvariables. I forgot to set the elements of the group arrays to CreateGroup() before adding units to thh groups. Because of that there was no compiler error, but I simple tried to add units to a non intialized groupvariable.

Nevertheless thanks for trying to help me.

Srorry for double post ;(
 
Status
Not open for further replies.
Top