~GaLs~
† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
- Reaction score
- 180
Now that I had holiday, starts my learning again.
Please explain what does this do:
I don't see it anywhere in the documentation...
What does the array do?
Edit -
Please explain what does this do:
I don't see it anywhere in the documentation...
What does the array do?
Edit -
Ah! Sorry for the confusing... guys.. It is from this post:
JASS://=========================================================================== // Demo spell for using PUI in combination with global arrays // to create counters that are attached to unit // // Author: Cohadar // Date: 2008.03.08 //=========================================================================== scope FleshHeap globals private constant integer AID_FLESH_HEAP = 039;A001039; private constant integer AID_STR_BONUS = 039;A002039; private constant integer HERO_PERCENT = 30 private constant integer UNIT_PERCENT = 3 endglobals globals // do NOT use this arrays directly, use below functions private unit array PUI_unit private integer array PUI_counter endglobals //=========================================================================== private function GetCount takes unit whichUnit returns integer local integer index = GetUnitIndex(whichUnit) if PUI_unit[index] != whichUnit then set PUI_unit[index] = whichUnit set PUI_counter[index] = 0 endif return PUI_counter[index] endfunction //=========================================================================== private function AddCount takes unit whichUnit, integer count returns nothing local integer index = GetUnitIndex(whichUnit) if PUI_unit[index] != whichUnit then set PUI_unit[index] = whichUnit set PUI_counter[index] = count else set PUI_counter[index] = PUI_counter[index] + count endif endfunction //=========================================================================== private function SetCount takes unit whichUnit, integer count returns nothing local integer index = GetUnitIndex(whichUnit) set PUI_unit[index] = whichUnit set PUI_counter[index] = count endfunction //=========================================================================== private function Actions takes nothing returns nothing local unit pudge = GetKillingUnit() local integer level = GetUnitAbilityLevel(pudge, AID_FLESH_HEAP) if IsUnitType(GetDyingUnit(), UNIT_TYPE_HERO) then call AddCount(pudge, level*HERO_PERCENT) else call AddCount(pudge, level*UNIT_PERCENT) endif if GetCount(pudge) >= 100 then call SetCount(pudge, 0) debug call BJDebugMsg("|c0000FF00" + "strength increased") call IncUnitAbilityLevel(pudge, AID_STR_BONUS) // green stat way //call SetHeroStr(pudge, GetHeroStr(pudge, false)+1, true) // Dota way endif set pudge = null endfunction //=========================================================================== private function Conditions takes nothing returns boolean return GetUnitAbilityLevel(GetKillingUnit(), AID_FLESH_HEAP) > 0 endfunction //=========================================================================== public function InitTrig takes nothing returns nothing local trigger trig = CreateTrigger() call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_DEATH ) call TriggerAddCondition( trig, Condition( function Conditions ) ) call TriggerAddAction( trig, function Actions ) set trig = null endfunction endscope
I saw something that is:
What does the arraying does?
@Sooda
I don't understand.