- Joined
- Nov 30, 2007
- Messages
- 1,202
This is the current index system that I use, but I need one exeption to be made. If the dying unit is in townGroup and the entering unit is of tonwGroup type. (Does this trigger befor i could possible add a created unit to townGroup?)
I just want to take the deindexed units values and give it to the entering. Preferbly without moving it to the last. (Since they have alot of information stored in them which in turn would have to be moved.)
Perhaps if I add a small delay to the IndexUnit part, and if IsUnitInGroup(GetTriggerUnit(), uIndexGroup) == FALSE then
How should i best look for unitTypes for townGroup and indexGroup?
Would look something like this:
Edit: This returns compile error...
*Edit 2: It doesn't like my call TriggerSleepAction(0,3).... Oh, wait.... is it because I'm european? Damned decimasl!!!!!!!!!!!!!
I also have another question, if I am going to create about 50-150 units on map initialization is "preloading" required to reduce lagg, and how do I do that?
I just want to take the deindexed units values and give it to the entering. Preferbly without moving it to the last. (Since they have alot of information stored in them which in turn would have to be moved.)
Perhaps if I add a small delay to the IndexUnit part, and if IsUnitInGroup(GetTriggerUnit(), uIndexGroup) == FALSE then
How should i best look for unitTypes for townGroup and indexGroup?
Would look something like this:
JASS:
globals
group uIndexGroup = CreateGroup()
integer uIndexMax = -1
unit array uIndexUnit
group array uIndexLocalGroup
unitpool indexable = CreateUnitPool()
endglobals
function LookForIndexType takes unit u returns boolean
if GetUnitTypeId(u) == 'A000' then
return TRUE
elseif GetUnitTypeId(u) == 'A001' then
return TRUE
elseif GetUnitTypeId(u) == 'A002' then
return TRUE
elseif GetUnitTypeId(u) == 'A003' then
return TRUE
elseif GetUnitTypeId(u) == 'A004' then
return TRUE
elseif GetUnitTypeId(u) == 'A005' then
return TRUE
elseif GetUnitTypeId(u) == 'A006' then
return TRUE
elseif GetUnitTypeId(u) == 'A007' then
return TRUE
elseif GetUnitTypeId(u) == 'A008' then
return TRUE
elseif GetUnitTypeId(u) == 'A009' then
return TRUE
elseif GetUnitTypeId(u) == 'A010' then
return TRUE
elseif GetUnitTypeId(u) == 'A011' then
return TRUE
elseif GetUnitTypeId(u) == 'A012' then
return TRUE
endif
return FALSE
endfunction
function UnitIndexFunc takes nothing returns nothing
if GetTriggerEventId() == EVENT_PLAYER_UNIT_DEATH then
// Deindex Unit
if IsUnitInGroup(GetTriggerUnit(), uIndexGroup) == TRUE and IsUnitInGroup(GetTriggerUnit(), townGroup) == FALSE then
set uIndexUnit[GetUnitUserData(GetTriggerUnit())] = uIndexUnit[uIndexMax]
call SetUnitUserData(uIndexUnit[GetUnitUserData(GetTriggerUnit())], GetUnitUserData(GetTriggerUnit()) )
call GroupRemoveUnit(uIndexGroup, uIndexUnit[uIndexMax])
set uIndexMax = uIndexMax - 1
endif
else
// Index Unit
if IsUnitInGroup(GetTriggerUnit(), uIndexGroup) == FALSE and LookForIndexType(GetTriggerUnit()) == TRUE then
set uIndexMax = uIndexMax + 1
set uIndexUnit[uIndexMax] = GetTriggerUnit()
call SetUnitUserData(uIndexUnit[uIndexMax], uIndexMax)
if uIndexLocalGroup[uIndexMax] == null then
set uIndexLocalGroup[uIndexMax] = CreateGroup()
endif
endif
endif
endfunction
function InitTrig_IndexUnit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple(t, GetWorldBounds())
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction(t, function UnitIndexFunc)
set t = null
endfunction
Edit: This returns compile error...
*Edit 2: It doesn't like my call TriggerSleepAction(0,3).... Oh, wait.... is it because I'm european? Damned decimasl!!!!!!!!!!!!!
I also have another question, if I am going to create about 50-150 units on map initialization is "preloading" required to reduce lagg, and how do I do that?
Last edited: