Azlier
Old World Ghost
- Reaction score
- 461
set MyUnitVariable = Random Unit From (Sheeps)
Something like that.
Something like that.
set MyUnitVariable = Random Unit From (Sheeps)
Something like that.
Set random sheep
Events
Conditions
Actions
Set RandomSheep = (Random unit from Sheeps)
Sheep Spawn
Events
Time - Elapsed game time is 0.01 seconds
Conditions
Actions
If (((Player 1 (Red) slot status) Equal to Is playing) and (((Player 1 (Red) controller) Equal to User) and ((Owner of RandomSheep) Equal to Neutral Passive))) then do (Unit - Change ownership of RandomSheep to Player 1 (Red) and Change color) else do (Unit - Remove RandomSheep from the game)
((Owner of RandomSheep) Equal to Neutral Passive)))
Unit - Change ownership of RandomSheep to Player 1 (Red) and Change color)
(Unit - Remove RandomSheep from the game)
Set RandomSheep = (Random unit from Sheeps)
>that is why i need picked random unit not just random unit from unit group sheeps.
What's the difference? There's no such function as 'Pick Random Unit' in JASS, either.
Every time you need to 'pick' a random unit, do this action:
Code:Set RandomSheep = (Random unit from Sheeps)
Event - time elapsed 0.01
condition -
Action -If,The,Else multiple function
If player 1 red = user and is playing then random sheep
If Picked unit owned by nuetral passive then change ownership to player1 red
else Loop
wait ok so if i set that vaiarble and use it like this
Code:Event - time elapsed 0.01 condition - Action -If,The,Else multiple function If player 1 red = user and is playing then random sheep If Picked unit owned by nuetral passive then change ownership to player1 red else Loop
would that work you think?
f player 1 red = user and is playing [B]then random sheep[/B]
Randomize spawn
Events
Time - Elapsed game time is 0.01 seconds
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Player 1 (Red) slot status) Equal to Is playing) and ((Player 1 (Red) controller) Equal to User)
Then - Actions
Else - Actions
Randomize spawn
Events
Time - Elapsed game time is 0.01 seconds
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Player 1 (Red) slot status) Equal to Is playing) and ((Player 1 (Red) controller) Equal to User)
Then - Actions
If ((Owner of RandomSheep) Equal to Neutral Passive) then do (Unit - Change ownership of (Matching unit) to Player 1 (Red) and Change color) else do (-------- Loop --------)
Else - Actions
Trigger:
- Untitled Trigger 001
- Events
- Time - Elapsed game time is 0.01 seconds
- Conditions
- Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Player 1 (Red) slot status) Equal to Is playing
- (Player 1 (Red) controller) Equal to User
- Then - Actions
- Set RandomSheep = (Random unit from Sheep)
- Unit - Explode RandomSheep
- -------- Or whatever you want to happen. Add more conditions if you need to. --------
- Else - Actions
Obviously you have to set the unit group variable first...
For each Integer A from....
OR
Pick every unit in Sheeps and...
Both those two actions create loops. What on earth are you trying to loop through?
Randomize spawn
Events
Time - Elapsed game time is 0.01 seconds
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Player 1 (Red) slot status) Equal to Is playing) and ((Player 1 (Red) controller) Equal to User)
Then - Actions
If ((Owner of RandomSheep) Equal to Neutral Passive) then do (Unit - Change ownership of (Matching unit) to Player 1 (Red) and Change color) else do (-------- Loop --------)
Else - Actions
Randomize spawn
Events
Time - Elapsed game time is 0.01 seconds
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Player 1 (Red) slot status) Equal to Is playing) and ((Player 1 (Red) controller) Equal to User)
Then - Actions
If ((Owner of RandomSheep) Equal to Neutral Passive) then do (Unit - Change ownership of (Matching unit) to Player 1 (Red) and Change color) else do (-------- Loop untill red recieves a unit from random sheep --------)
Else - Actions
Unit - Remove (Random unit from Sheeps) from the game
RandomSheep
Events
Conditions
Actions
Set RandomSheep = (Random unit from Sheeps)
function Trig_Randomize_spawn_Func001Func002001 takes nothing returns boolean
return ( GetOwningPlayer(udg_RandomSheep) == Player(PLAYER_NEUTRAL_PASSIVE) )
endfunction
function Trig_Randomize_spawn_Func001Func003001 takes nothing returns boolean
return ( GetPlayerSlotState(Player(0)) == PLAYER_SLOT_STATE_PLAYING )
endfunction
function Trig_Randomize_spawn_Func001Func003002 takes nothing returns boolean
return ( GetPlayerController(Player(0)) == MAP_CONTROL_USER )
endfunction
function Trig_Randomize_spawn_Func001C takes nothing returns boolean
if ( not GetBooleanAnd( Trig_Randomize_spawn_Func001Func003001(), Trig_Randomize_spawn_Func001Func003002() ) ) then
return false
endif
return true
endfunction
function Trig_Randomize_spawn_Actions takes nothing returns nothing
if ( Trig_Randomize_spawn_Func001C() ) then
if ( Trig_Randomize_spawn_Func001Func002001() ) then
call SetUnitOwner( GetFilterUnit(), Player(0), true )
else
// Loop untill red recieves a unit from random sheep
endif
else
call RemoveUnit( GroupPickRandomUnit(udg_Sheeps) )
endif
endfunction
//===========================================================================
function InitTrig_Randomize_spawn takes nothing returns nothing
set gg_trg_Randomize_spawn = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Randomize_spawn, 0.01 )
call TriggerAddAction( gg_trg_Randomize_spawn, function Trig_Randomize_spawn_Actions )
endfunction
function Setting takes nothing recieves nothing
global integer boolean pick
set pick = false
//this is the part i dont know how to do
if (player(0) = OWNS_UNIT_IN_SHEEPS) then
set pick = true
else
endfunction
function LoopTrigger teakes nothing recieves nothing
if pick = false loop
loop
exitwhen (pick=true)
endloop
else DoNothing
if (player(0) = OWNS_UNIT_IN_SHEEPS)
RandomSheep
Events
Conditions
Actions
Set RandomSheep = (Random unit from Sheeps)
Sheeps
Events
Map initialization
Conditions
Actions
Unit Group - Pick every unit in (Units in Sheeps <gen>) and do (Actions)
Loop - Actions
Unit Group - Add (Picked unit) to Sheeps