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