- Joined
- Jan 15, 2013
- Messages
- 251
i make one loop, 1 to 5, but when i create an action for display value of Integer A, it shows 6, WHY?
what is it? ITE?
So, Unit Type 1, Counter 1, Message 1, right ?
Why don't you do it like this;
- Initialize
- Events
- Map initialization
- Conditions
- Actions
- -------- Index 1 --------
- Set UnitType[1] = Footman
- Set Message[1] = Footman has died.
- -------- /////////////// --------
- -------- .................. --------
- -------- .................. --------
- -------- Index n --------
- Set UnitType[5] = Knight
- Set Message[5] = Knight has died.
- -------- /////////////// --------
- -------- Total Index --------
- Set TotalIndex = 5
As said by others, don't use IntegerA/B, use your custom-variable, namely LoopingInteger - For Each Integer Variable
- Unit Dies
- Events
- Unit - A unit Dies
- Conditions
- Actions
- For each (Integer LoopingInteger) from 1 to TotalIndex, do (Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Unit-type of (Triggering unit)) Equal to UnitType[LoopingInteger]
- Then - Actions
- Set Counter[LoopingInteger] = (Counter[LoopingInteger] + 1)
- Set LoopingInteger = TotalIndex
- Else - Actions
Explain.as they leak
Explain.
integer bj_forLoopAIndex=0
integer bj_forLoopAIndexEnd=0
integer bj_forLoopBIndex=0
integer bj_forLoopBIndexEnd=0
It cannot leaks because it maps to integer globals. These neither allocate or deallocate anything when used.
JASS:integer bj_forLoopAIndex=0 integer bj_forLoopAIndexEnd=0 integer bj_forLoopBIndex=0 integer bj_forLoopBIndexEnd=0