Hello i need some help for the following idea: a unit attacks if it has an specific item it has a chance of 1 to (10 - customvalue of the item) to create a unit on a point with polar offset random range from x-y and random degree. the point should be walkable so a needed a while-loop (while the created point is not walkable keep creating new points) i decide to quickly learn Jass former i learnd C# (does it help?). I had all i needed for my trigger except the loop. i took my if's and call's from the GUI trigger and tried to set them into the right places etc. but it doesn't work and worldeditor says that pretty much everything is an error. Here is my code:
JASS:
function Tentacle_Spawn takes nothing level returns nothing
local integer RND = GetRandomInt(1, ( 10 - GetItemUserData(GetItemOfTypeFromUnitBJ(GetAttacker(), 'oflg')) ))//'item'
if RND == 1 then
local location pt // TentaklePunkt Variable
local boolean begehbar = true //Check ob pt brauchbar ist
loop
// Erzeuge zufälligen Polaren Punkt
set pt = PolarProjectionBJ(GetUnitLoc(GetTriggerUnit()), GetRandomReal(50.00, 350.00), GetRandomDirectionDeg())
if ( not ( IsTerrainPathableBJ(pt, PATHING_TYPE_WALKABILITY) == false ) ) then
set bgehbar = false
endif
exitwhen begehbar = false
endloop
// Debug: Richtige Unit?
call CreateNUnitsAtLocFacingLocBJ( 1, 'o004', GetOwningPlayer(GetAttacker()), pt, GetUnitLoc(GetAttackedUnitBJ()) )
else
call SetItemUserData( UnitItemInSlotBJ(GetAttacker(), 1), ( GetItemUserData(GetItemOfTypeFromUnitBJ(GetAttacker(), 'oflg')) + 1 ) )
endfunction