• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Loop

Status
Not open for further replies.
Greetings everyone
I'm not used to custom scripts but I tried to make a trigger where it writes a name for AI players on a multiboard and gives 2 items for all player's base circle. I'm 100% sure that the trigger fires via a diffirent trigger. It should end when the current player = the total amount of players in the game.

  • CompNames
    • Events
    • Conditions
    • Actions
      • Custom script: loop
      • Game - Display to (All players) the text: ((String(iPlayerNumber)) + (__ + (String(iPlayerCount))))
      • Hero - Create Item[(Random integer number between 1 and 7)] and give it to uBaseCircle[iPlayerNumber]
      • Hero - Create Item[(Random integer number between 1 and 7)] and give it to uBaseCircle[iPlayerNumber]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Player(iPlayerNumber)) controller) Equal to Computer
        • Then - Actions
          • Set Temp_Int = (Random integer number between 1 and iNameCount)
          • Set Temp_Int = iNameIndex[Temp_Int]
          • Multiboard - Set the text for Multiboard item in column 2, row (iPlayerNumber + 1) to (PlayerC[iPlayerNumber] + (sNameIndex[Temp_Int] + |r))
          • Set iNameIndex[Temp_Int] = iNameIndex[iNameCount]
          • Set iNameCount = (iNameCount - 1)
        • Else - Actions
      • Set iPlayerNumber = (iPlayerNumber + 1)
      • Custom script: exitwhen udg_iPlayerNumber == udg_iPlayerCount
      • Custom script: endloop
Previously I used 'every 0.01 secs of game time' and turned of this trigger when iPlayerNumber = iPlayerCount and it worked fine.
 
Last edited:
Note: I updated the trigger above.


I'm doning it here
  • Set iPlayerNumber = (iPlayerNumber + 1)
But the loop stopped when iPlayerNumber = 1. I told it to exit when iPlayerNumber = 2(number of players)

you edited it after i said that lol. It isn't a good idea to edit things then tell someone that they were wrong. Did you try to see what gets shown ?
Move the exitwhen to the top of the loop.
 
you edited it after i said that lol. It isn't a good idea to edit things then tell someone that they were wrong. Did you try to see what gets shown ?
Move the exitwhen to the top of the loop.

It was there but in an ITE function so you probably didn't see it clearly. Sorry about that. Anyways I moved the 'exitwhen' to right under the 'loop' but the same thing happens.
 
Status
Not open for further replies.
Top