[General] Looping until a point != itself

Status
Not open for further replies.
Hey do you have any idea how to solve this problem?
the idea is:
loop until RaceCurrentInt != RaceRandomInt.
If != , then set it to RaceRandomInt.
The goal here is to avoid setting/re-setting the new point where the previous point was.
  • For each (Integer A) from 1 to 10, do (Actions)
    • Loop - Actions
      • Set Race_RandomInt = (Random integer number between 1 and Settings_Race_Jumps)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Race_CurrentInt Not equal to Race_RandomInt
        • Then - Actions
          • Set Race_CurrentInt = Race_RandomInt
          • Set Race_CurrentPoint = KOTH_POINTS[(Random integer number between 1 and Settings_Race_Jumps)]
          • Item - Create Race Flag at Race_CurrentPoint
          • Skip remaining actions
        • Else - Actions
 
Last edited:
I think I might solved it
JASS:
function Trig_SetNextPoint takes nothing returns nothing
  
    loop
        exitwhen udg_Race_CurrentInt != udg_Race_RandomInt
        set udg_Race_RandomInt = GetRandomInt(1, udg_Settings_Race_Jumps)
    endloop
    set udg_Race_CurrentInt = udg_Race_RandomInt
    set udg_Race_CurrentPoint = udg_KOTH_POINTS[GetRandomInt(1, udg_Settings_Race_Jumps)]
    call CreateItemLoc( 'rflx', udg_Race_CurrentPoint )
    call DisplayTextToForce( GetPlayersAll(), "A new flag has been spawned! Check the minimap!" )
endfunction

//===========================================================================
function InitTrig_Race_Set_Next_Point takes nothing returns nothing
    set gg_trg_Race_Set_Next_Point = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Race_Set_Next_Point, function Trig_SetNextPoint )
endfunction
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Sure, if you have jass knowledge it is easier. Wrda tried to keep things in GUI.
 
Status
Not open for further replies.
Top