| 02-15-2006, 03:36 PM | #1 |
Right, im making a TD type map, you can select difficulty which changes units HP. This function will trigger for every unit that enters a specific place. I get 1294 errors when i try this, and iv got no idea why. Any help ?Code:
function CheckExtreme takes integer player returns boolean
if ( not ( udg_PlayerHasChosenDifficulty[player] == "Extreme" ) ) then
return false
endif
return true
endfunction
function CheckHard takes integer player returns boolean
if ( not ( udg_PlayerHasChosenDifficulty[player] == "Hard" ) ) then
return false
endif
return true
endfunction
function CheckNormal takes integer player returns boolean
if ( not ( udg_PlayerHasChosenDifficulty[player] == "Normal" ) ) then
return false
endif
return true
endfunction
function CheckEasy takes integer player returns boolean
if ( not ( udg_PlayerHasChosenDifficulty[player] == "Easy" ) ) then
return false
endif
return true
endfunction
function CheckNooby takes integer player returns boolean
if ( not ( udg_PlayerHasChosenDifficulty[player] == "Nooby" ) ) then
return false
endif
return true
endfunction
function CheckDiff takes unit u integer p returns nothing
local real percent
if ( CheckExtreme(p) then
set percent = 100.00
else
if ( CheckHard(p) ) then
set percent = 80.00
else
if ( CheckNormal(p) ) then
set percent = 60.00
else
if ( CheckEasy(p) ) then
set percent = 40.00
else
if ( CheckNooby(p) ) then
set percent = 20.00
else
endif
endif
endif
endif
endif
call SetUnitLifePercentBJ( u, percent )
endfunction |
| 02-15-2006, 03:46 PM | #2 |
Without else... you hit nesting limit |
| 02-15-2006, 03:52 PM | #3 | |
Quote:
Nesting limit? could you explain yourself in more detail please |
| 02-15-2006, 10:42 PM | #4 |
Dont convert trigger to jass and post, either optimize it and post with [ jass ] tag or post the GUI using [ trigger ] tags EDIT: Missing parantesses:if ( CheckExtreme(p) then Missing comma after unit u:function CheckDiff takes unit u integer p returns nothing EDIT 2: Cant use player as argument, cuz its a type:integer player EDIT 3: here i optmized it 4 u JASS:function CheckDiff takes unit u, integer p returns nothing if udg_PlayerHasChosenDifficulty[p] == "Extreme" then call SetUnitLifePercentBJ( u, 100 ) elseif udg_PlayerHasChosenDifficulty[p] == "Hard" then call SetUnitLifePercentBJ( u, 80 ) elseif udg_PlayerHasChosenDifficulty[p] == "Normal" then call SetUnitLifePercentBJ( u, 60 ) elseif udg_PlayerHasChosenDifficulty[p] == "Easy" then call SetUnitLifePercentBJ( u, 40 ) elseif udg_PlayerHasChosenDifficulty[p] == "Nooby" then call SetUnitLifePercentBJ( u, 20 ) else return endif endfunction |
| 02-16-2006, 02:39 AM | #5 | |
Quote:
|
