- Joined
- Dec 12, 2007
- Messages
- 489
hello guys,
this is about my project map, titled "Chaos Legion",
few days ago everything seems to go well, until i noticed
something strange happen with the hero selection,
the hero selection system in the map is goes by:
1. a tavern that sold the Legion that the Hero will own,
2. each Legion(s) will be different by amount of units and hero that
control them.
3. when user pick the Legion, the Legion is moved to the spawn spot and
check what Legion it is then creates a corresponding hero beside it, and
create few another Legion with it, assign the Legion into a struct then
then hide them for use with the Summon ability on the hero.
4. the way i check what corresponding hero of the legion and the number of
Legion is on the map init, i assign 3 array, each one is Legion's unit id,
the hero's id, and the number of Legion created. and when the Legion
picked, i loop through those array checking the Legion's unit id to obtain
the array index of the Legion, and then create the hero etc.
i have narrowed the problem and found out that everything gone well
except point 4, which when the function is called, it always return index 0,
the function is :
i have wasted few days to spot where i did wrong, but still unable to find out.
so i need someone to help me find where the fail is, thanks before
this is about my project map, titled "Chaos Legion",
few days ago everything seems to go well, until i noticed
something strange happen with the hero selection,
the hero selection system in the map is goes by:
1. a tavern that sold the Legion that the Hero will own,
2. each Legion(s) will be different by amount of units and hero that
control them.
3. when user pick the Legion, the Legion is moved to the spawn spot and
check what Legion it is then creates a corresponding hero beside it, and
create few another Legion with it, assign the Legion into a struct then
then hide them for use with the Summon ability on the hero.
4. the way i check what corresponding hero of the legion and the number of
Legion is on the map init, i assign 3 array, each one is Legion's unit id,
the hero's id, and the number of Legion created. and when the Legion
picked, i loop through those array checking the Legion's unit id to obtain
the array index of the Legion, and then create the hero etc.
i have narrowed the problem and found out that everything gone well
except point 4, which when the function is called, it always return index 0,
the function is :
JASS:
library LegionData initializer init
globals
integer array HERO_LEGION
constant integer HERO_TOTAL = 7
endglobals
private function legion takes nothing returns nothing
set HERO_LEGION[0] = 'O000'
set HERO_LEGION[1] = 'O001'
set HERO_LEGION[2] = 'O002'
set HERO_LEGION[3] = 'O003'
set HERO_LEGION[4] = 'O005'
set HERO_LEGION[5] = 'O004'
set HERO_LEGION[6] = 'O006'
endfunction
// the "takes integer id" is taking the Legion's unit rawcode
function GetLegionIndex takes integer id returns integer
local integer i = 0
local integer x = 0
loop
exitwhen i > HERO_TOTAL
if (HERO_LEGION[i] == id) then
set x = i
endif
set i = i + 1
endloop
return x
// here lies the trouble, the returned value is always 0
endfunction
private function init takes nothing returns nothing
call ExecuteFunc(SCOPE_PRIVATE+"legion")
endfunction
endlibrary
i have wasted few days to spot where i did wrong, but still unable to find out.
so i need someone to help me find where the fail is, thanks before