Hola muchachos!
Ire directo al grano. Estoy haciendo un mapa donde un héroe tiene un hechizo que le permite crear un portal. Una vez que crea 2 estos se conectan y permite moverse entre ambos. Hasta ahí funciona bien.
El problema es que si se crea un nuevo portal, este debe reemplazar al más antiguo, para lo cual importe Unit indexer sin saber como usarlo con tal objetivo.
Intento además que el spell pueda ser usado por al menos 6 jugadores (de momento).
Sin más que decir les dejo el deto para que le echen una mirada:
[gui]
Portal cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to (==) Portal
Actions
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in Portal_Group[(Player number of (Owner of (Triggering unit)))]) Equal to (==) 0
Then - Actions
Set Portal_Group[(Player number of (Owner of (Triggering unit)))] = Portal_Group[(Player number of (Owner of (Triggering unit)))]
Unit - Create 1 Dummy Portal for (Owner of (Triggering unit)) at Portal_Point[Portal_MUI] facing Default building facing (270.0) degrees
Set PORTAL[Portal_MUI] = (Last created unit)
Set Portal_Point[Portal_MUI] = (Position of PORTAL[Portal_MUI])
Unit Group - Add PORTAL[Portal_MUI] to Portal_Group[(Player number of (Owner of (Triggering unit)))]
Unit - Add Portal (unidad dummy) to PORTAL[Portal_MUI]
Unit - Add Habilidad Puerta to PORTAL[Portal_MUI]
Set Portal_MUI = (Portal_MUI + 1)
Else - Actions
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in Portal_Group[(Player number of (Owner of (Triggering unit)))]) Equal to (==) 1
Then - Actions
Unit - Create 1 Dummy Portal for (Owner of (Triggering unit)) at Portal_Point[Portal_MUI] facing Default building facing (270.0) degrees
Set PORTAL[Portal_MUI] = (Last created unit)
Set Portal_Point[Portal_MUI] = (Position of PORTAL[Portal_MUI])
Unit Group - Add PORTAL[Portal_MUI] to Portal_Group[(Player number of (Owner of (Triggering unit)))]
Unit - Add Portal (unidad dummy) to PORTAL[Portal_MUI]
Unit - Add Habilidad Puerta to PORTAL[Portal_MUI]
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of PORTAL[(Portal_MUI - 1)]) Equal to (==) (Owner of PORTAL[Portal_MUI])
Then - Actions
Neutral Building - Set PORTAL[Portal_MUI] destination to Portal_Point[(Portal_MUI - 1)]
Neutral Building - Set PORTAL[(Portal_MUI - 1)] destination to Portal_Point[Portal_MUI]
Neutral Building - Enable PORTAL[Portal_MUI]
Neutral Building - Enable PORTAL[(Portal_MUI - 1)]
Lightning - Create a Spirit Link lightning effect from source Portal_Point[Portal_MUI] to target Portal_Point[(Portal_MUI - 1)]
Set Portal_Lightning[(Player number of (Owner of PORTAL[Portal_MUI]))] = (Last created lightning effect)
Lightning - Change color of Portal_Lightning[(Player number of (Owner of PORTAL[Portal_MUI]))] to (0.43 0.14 0.51) with 1.00 alpha
Else - Actions
Unit Group - Pick every unit in Portal_Group[(Player number of (Owner of PORTAL[Portal_MUI]))] and do (Actions)
Loop - Actions
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Picked unit) Not equal to (!=) PORTAL[Portal_MUI]
Then - Actions
Set Portal_Point[(Custom value of (Picked unit))] = (Position of (Picked unit))
Neutral Building - Set PORTAL[Portal_MUI] destination to Portal_Point[(Custom value of (Picked unit))]
Neutral Building - Set (Picked unit) destination to Portal_Point[Portal_MUI]
Lightning - Create a Spirit Link lightning effect from source Portal_Point[Portal_MUI] to target Portal_Point[(Custom value of (Picked unit))]
Set Portal_Lightning[(Player number of (Owner of PORTAL[Portal_MUI]))] = (Last created lightning effect)
Lightning - Change color of Portal_Lightning[(Player number of (Owner of PORTAL[Portal_MUI]))] to (0.43 0.14 0.51) with 1.00 alpha
Else - Actions
Set Portal_MUI = (Portal_MUI + 1)
Else - Actions
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in Portal_Group[(Player number of (Owner of (Triggering unit)))]) Equal to (==) 2
Then - Actions
Unit Group - Pick every unit in Portal_Group[(Player number of (Owner of (Triggering unit)))] and do (Actions)
Loop - Actions
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Custom value of (Picked unit)) Less than (<) (Custom value of (Picked unit))
Then - Actions
Else - Actions
Unit - Create 1 Dummy Portal for (Owner of (Triggering unit)) at Portal_Point[Portal_MUI] facing Default building facing (270.0) degrees
Set PORTAL[Portal_MUI] = (Last created unit)
Set Portal_Point[Portal_MUI] = (Position of PORTAL[Portal_MUI])
Unit Group - Add PORTAL[Portal_MUI] to Portal_Group[(Player number of (Owner of (Triggering unit)))]
Unit - Add Portal (unidad dummy) to PORTAL[Portal_MUI]
Unit - Add Habilidad Puerta to PORTAL[Portal_MUI]
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of PORTAL[(Portal_MUI - 1)]) Equal to (==) (Owner of PORTAL[Portal_MUI])
Then - Actions
Neutral Building - Set PORTAL[Portal_MUI] destination to Portal_Point[(Portal_MUI - 1)]
Neutral Building - Set PORTAL[(Portal_MUI - 1)] destination to Portal_Point[Portal_MUI]
Neutral Building - Enable PORTAL[Portal_MUI]
Neutral Building - Enable PORTAL[(Portal_MUI - 1)]
Lightning - Create a Spirit Link lightning effect from source Portal_Point[Portal_MUI] to target Portal_Point[(Portal_MUI - 1)]
Set Portal_Lightning[(Player number of (Owner of PORTAL[Portal_MUI]))] = (Last created lightning effect)
Lightning - Change color of Portal_Lightning[(Player number of (Owner of PORTAL[Portal_MUI]))] to (0.43 0.14 0.51) with 1.00 alpha
Else - Actions
Unit Group - Pick every unit in Portal_Group[(Player number of (Owner of PORTAL[Portal_MUI]))] and do (Actions)
Loop - Actions
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Picked unit) Not equal to (!=) PORTAL[Portal_MUI]
Then - Actions
Set Portal_Point[(Custom value of (Picked unit))] = (Position of (Picked unit))
Neutral Building - Set PORTAL[Portal_MUI] destination to Portal_Point[(Custom value of (Picked unit))]
Neutral Building - Set (Picked unit) destination to Portal_Point[Portal_MUI]
Lightning - Create a Spirit Link lightning effect from source Portal_Point[Portal_MUI] to target Portal_Point[(Custom value of (Picked unit))]
Set Portal_Lightning[(Player number of (Owner of PORTAL[Portal_MUI]))] = (Last created lightning effect)
Lightning - Change color of Portal_Lightning[(Player number of (Owner of PORTAL[Portal_MUI]))] to (0.43 0.14 0.51) with 1.00 alpha
Else - Actions
Set Portal_MUI = (Portal_MUI + 1)
Else - Actions
[/gui]

Haz click a una de las imagenes y entra a un trip