- Joined
- Nov 13, 2006
- Messages
- 1,814
have any down side for useing this? or later have problem if i replace more gui place with global jass functions what i use in gui later with call?
instead this?
JASS:
function AddHPMP takes boolean HP, boolean Inc, integer v, unit u returns nothing
local integer a
local integer s
local integer i
local integer l
local integer cv
local integer mv
if (HP == true) then
set a = udg_Abilities2[1]
else
set a = udg_Abilities2[2]
endif
if (Inc == true) then
set s = 1
else
set s = 5
endif
set cv = v
set mv = ModuloInteger(cv, 1000)
set l = ( ( cv - mv ) / 1000 )
set i = 1
loop
exitwhen i > l
call UnitAddAbility( u, a )
call SetUnitAbilityLevel( u, a, 4 + s)
call UnitRemoveAbility( u, a )
set i = i + 1
endloop
set cv = mv
set mv = ModuloInteger(cv, 100)
set l = ( ( cv - mv ) / 100 )
set cv = mv
set i = 1
loop
exitwhen i > l
call UnitAddAbility( u, a )
call SetUnitAbilityLevel( u, a, 3 + s )
call UnitRemoveAbility( u, a )
set i = i + 1
endloop
set mv = ModuloInteger(cv, 10)
set l = ( ( cv - mv ) / 10 )
set cv = mv
set i = 1
loop
exitwhen i > l
call UnitAddAbility( u, a )
call SetUnitAbilityLevel( u, a, 2 + s)
call UnitRemoveAbility( u, a )
set i = i + 1
endloop
set i = 1
loop
exitwhen i > cv
call UnitAddAbility( u ,a )
call SetUnitAbilityLevel( u, a, 1 + s )
call UnitRemoveAbility( u, a )
set i = i + 1
endloop
set u = null
endfunction
instead this?
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Max_HP Less than 0
-
Then - Actions
- Set TempNr2 = (Max_HP mod 1000)
- Set Loop_Integer = ((Max_HP - TempNr2) / 1000)
-
For each (Integer A) from 1 to Loop_Integer, do (Actions)
-
Loop - Actions
- Unit - Add Add HP to TempUnit
- Unit - Set level of Add HP for TempUnit to 5
- Unit - Remove Add HP from TempUnit
-
Loop - Actions
- Set Max_HP = TempNr2
- Set TempNr2 = (Max_HP mod 100)
- Set Loop_Integer = ((Max_HP - TempNr2) / 100)
- Set Max_HP = TempNr2
-
For each (Integer A) from 1 to Loop_Integer, do (Actions)
-
Loop - Actions
- Unit - Add Add HP to TempUnit
- Unit - Set level of Add HP for TempUnit to 4
- Unit - Remove Add HP from TempUnit
-
Loop - Actions
- Set TempNr2 = (Max_HP mod 10)
- Set Loop_Integer = ((Max_HP - TempNr2) / 10)
- Set Max_HP = TempNr2
-
For each (Integer A) from 1 to Loop_Integer, do (Actions)
-
Loop - Actions
- Unit - Add Add HP to TempUnit
- Unit - Set level of Add HP for TempUnit to 3
- Unit - Remove Add HP from TempUnit
-
Loop - Actions
-
For each (Integer A) from 1 to Max_HP, do (Actions)
-
Loop - Actions
- Unit - Add Add HP to TempUnit
- Unit - Set level of Add HP for TempUnit to 2
- Unit - Remove Add HP from TempUnit
-
Loop - Actions
-
Else - Actions
- Set TempNr2 = (Max_HP mod 1000)
- Set Loop_Integer = ((Max_HP - TempNr2) / 1000)
- Set Max_HP = TempNr2
-
For each (Integer A) from 1 to Loop_Integer, do (Actions)
-
Loop - Actions
- Unit - Add Add HP to TempUnit
- Unit - Set level of Add HP for TempUnit to 9
- Unit - Remove Add HP from TempUnit
-
Loop - Actions
- Set TempNr2 = (Max_HP mod 100)
- Set Loop_Integer = ((Max_HP - TempNr2) / 100)
- Set Max_HP = TempNr2
-
For each (Integer A) from 1 to Loop_Integer, do (Actions)
-
Loop - Actions
- Unit - Add Add HP to TempUnit
- Unit - Set level of Add HP for TempUnit to 8
- Unit - Remove Add HP from TempUnit
-
Loop - Actions
- Set TempNr2 = (Max_HP mod 10)
- Set Loop_Integer = ((Max_HP - TempNr2) / 10)
- Set Max_HP = TempNr2
-
For each (Integer A) from 1 to Loop_Integer, do (Actions)
-
Loop - Actions
- Unit - Add Add HP to TempUnit
- Unit - Set level of Add HP for TempUnit to 7
- Unit - Remove Add HP from TempUnit
-
Loop - Actions
-
For each (Integer A) from 1 to Max_HP, do (Actions)
-
Loop - Actions
- Unit - Add Add HP to TempUnit
- Unit - Set level of Add HP for TempUnit to 6
- Unit - Remove Add HP from TempUnit
-
Loop - Actions
-
If - Conditions