- @Lordarkangel escribió:
- Numero de -granjas- vivas que pertenecen al jugador de la unidad que cambio de bando
Bueno hice esto tambien pero aveces cuando la unidad cambia de bando no me lo cuenta
[gui]Farm Counter
Events
Unit - A unit Changes owner
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Ownership-changed unit)) Equal to Farm (0)
Then - Actions
Unit Group - Pick every unit in (Units of type Farm (0)) and do (Actions)
Loop - Actions
Set Farm[(Number of living Farm (0) units owned by (Owner of (Picked unit)))] = (Farm[(Number of living Farm (0) units owned by (Owner of (Picked unit)))] + 1)
Leaderboard - Sort (Last created leaderboard) by Value in Descending order
Leaderboard - Change the value for (Player((Number of living Farm (0) units owned by (Owner of (Picked unit))))) in (Last created leaderboard) to Farm[(Number of living Farm (0) units owned by (Owner of (Picked unit)))]
Else - Actions
[/gui]
Pues en realidad lo que dice ahí es "Granjas[SLOT VARIABLE] = Granjas[SLOT VARIABLE] + 1"
Realmente no funciona como vos esperas que funciona, porque dentro del corchete, tienes que poner un número que vos sepas cual es en todo momento(como el número id de un jugador), pues no entiendo que buscas, pero yo lo haría así:
[gui]Detonador sin nombre 001
Acontecimientos
Tiempo - Every 2.00 seconds of game time
Condiciones
Acciones
For each (Integer A) from 1 to 10, do (Actions)
Bucle: Acciones
Set GrupoGranjas = (Units owned by (Player((Integer A))) of type Granja)
Set Farms[(Integer A)] = (Number of units in GrupoGranjas)
Tabla de lÃderes - Change the value for (Player((Integer A))) in (Last created leaderboard) to Farms[(Integer A)]
Tabla de lÃderes - Sort (Last created leaderboard) by Valor in Descendiente order
Custom script: call DestroyGroup(udg_GrupoGranjas)
[/gui]
Esto se actualizaría cada 2 segundos y es corto y simple de entender