- Joined
- Feb 3, 2009
- Messages
- 3,292
EDIT: Solved, I just messed up a few things in the other triggers.
Bellow are the 3 triggers that affect the function. So basically what it's supposed to do is that each hero has an index of PossibleHeroes (unit type variable) and then CheckHero function randomly generates integers and should check if PossibleHeroes[gen] doesn't have a unity type assigned, and if it does then it returns the Id.
The problem is that even when the egenerated number was 1 (which is Drow Ranger) it didn't end the loop.
Hope you understand.
The problem is that even when the egenerated number was 1 (which is Drow Ranger) it didn't end the loop.
Hope you understand.
-
Add Heroes
- Events
- Conditions
-
Actions
- -------- STR --------
- -------- AGI --------
- Neutral Building - Add Drow Ranger to Agillity (Scourge - 1) 0120 <gen> with 0 in stock and a max stock of 1
- Set PossibleHeroes[1] = Drow Ranger
- -------- INT --------
-
Ar
-
Events
- Player - Player 2 (Blue) types a chat message containing -ar as An exact match
- Conditions
-
Actions
- Game - Display to (All players) for 30.00 seconds the text: (Colour[(Player number of Player 2 (Blue))] + ((Name of Player 2 (Blue)) + |r has selected mode |cff00ffffAll Random.|r))
- Trigger - Turn off Ap <gen>
- Trigger - Turn off (This trigger)
- Trigger - Turn off Default <gen>
- Trigger - Turn off Random <gen>
- Set Mode = ar
-
For each (Integer A) from 2 to 6, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Player((Integer A))) slot status) Equal to Is playing
-
Then - Actions
- Custom script: set udg_RandomSelectedHero = CheckHero()
- Unit - Create 1 PossibleHeroes[RandomSelectedHero] for (Player((Integer A))) at (Center of GetHero <gen>) facing Default building facing degrees
- Game - Display to (All players) for 15.00 seconds the text: (|cff + ((Colour[(Player number of (Owner of (Triggering unit)))] + (Name of (Owner of (Triggering unit)))) + (|r + ( has randomed |cff0080ff + ((Name of (Triggering unit)) + |r)))))
- Wait 0.50 seconds
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
For each (Integer A) from 8 to 12, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Player((Integer A))) slot status) Equal to Is playing
-
Then - Actions
- Custom script: set udg_RandomSelectedHero = CheckHero()
- Unit - Create 1 PossibleHeroes[RandomSelectedHero] for (Player((Integer A))) at (Center of GetHero <gen>) facing Default building facing degrees
- Game - Display to (All players) for 15.00 seconds the text: (|cff + ((Colour[(Player number of (Owner of (Triggering unit)))] + (Name of (Owner of (Triggering unit)))) + (|r + ( has randomed |cff0080ff + ((Name of (Triggering unit)) + |r)))))
- Wait 0.50 seconds
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
Events
JASS:
function CheckHero takes nothing returns integer i
local integer gen
loop
set gen = GetRandomInt(1, 100)
exitwhen udg_PossibleHeroes[gen] != 0
call BJDebugMsg(I2S(gen))
call TriggerSleepAction(0.1)
endloop
call BJDebugMsg(I2S(gen))
call BJDebugMsg(I2S(gen))
call BJDebugMsg(I2S(gen))
return gen
endfunction
Last edited: