• 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.

[vJASS] Undeclared variables...for some reason.

Status
Not open for further replies.
Level 4
Joined
Apr 7, 2012
Messages
63
I made a script that is suppose to set the stats(custom made by me)of the hero when he enters a region.The syntax check said that all the globals are undeclared.Reputation will be given to those who help me with this.

JASS:
scope SettingGlobals initializer Init

globals
     integer array udg_StatsBlockChance
     integer array udg_StatsEvadeChance
     integer array udg_StatsPhysicalPower
     integer array udg_StatsPhysicalCriticalPower
     integer array udg_StatsPhysicalCriticalChance
     integer array udg_StatsMentalPower
     integer array udg_StatsMentalCriticalPower
     integer array udg_StatsMentalCriticalChance
     integer array udg_Booleanstats
endglobals     

private function SettingGlobals_Conditions takes nothing returns boolean
    return ((IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true ) ) and udg_Booleanstats[GetConvertedPlayerId(GetOwningPlayer(GetEnteringUnit()))] == 0 
endfunction

private function Actions takes nothing returns nothing
     local real int 
     local real str
     local real agi
     local unit hero
     local player owner
     local integer pid

      
      set hero = GetTriggerUnit()
      set owner = GetOwningPlayer(hero)
      set pid = GetPlayerId(owner) + 1
      set int = GetHeroInt(hero,true)
      set str = GetHeroStr(hero,true)           
      set agi = GetHeroAgi(hero,true)
      
      set udg_StatsBlockChance[pid] = R2I(str*0.15) + udg_StatsBlockChance[pid]
      set udg_StatsEvadeChance[pid] = R2I(agi*0.15) + udg_StatsEvadeChance[pid]
      set udg_StatsPhysicalPower[pid] = R2I(str*0.25) + udg_StatsPhysicalPower[pid]
      set udg_StatsPhysicalPowerCriticalChance[pid] = 0
      set udg_StatsPhysicalPowerCriticalPower[pid] = 0
      set udg_StatsMentalPower[pid]= R2I(int*0.25) + udg_StatsMentalPower[pid]
      set udg_StatsMentalPowerCriticalChance[pid] = 0 
      set udg_StatsMentalPowerCriticalPower[pid] = 0
endfunction

//===========================================================================
function Init takes nothing returns nothing
    local trigger SettingGlobalsTrg = CreateTrigger()
     call TriggerRegisterEnterRectSimple( SettingGlobalsTrg, gg_rct_Hero_Start_Place )
    call TriggerAddCondition( SettingGlobalsTrg, Condition( function SettingGlobals_Conditions ) )
    call TriggerAddAction( SettingGlobalsTrg, function Actions )
endfunction
endscope
 
Are you using the syntax checker that is in the trigger editor? That is the TESH one and it does not use the jasshelper syntax checker. Just ignore the TESH one and just save to do an actual syntax check. ;) It should compile just fine.

P.S. You don't need to put udg_ in front of globals that are declared that way unless you prefer it that way. :)
 
Level 4
Joined
Apr 7, 2012
Messages
63
Ok thanks,but I am using the new generation world editor wit the most updated jass helper.I don't use the normal syntax check but the auto one that triggers when saving.I'll try again though.
EDIT:Fixed it,the globals I created didn't match the globals I setted in the actions.Plus repped you anyway for the effort:p
 
Status
Not open for further replies.
Top