I'm trying to make a 4v4 map. Teams are fixed and tied to positions top vs bottom inside the yaml. That works.
What I'm looking for is a 'Short GTeam Modus' where the whole team loses once one of its members loses. So far, that's what I got:
Code: Select all
MissionSurvive = { }
Gamers = { }
ShortMode = function(player)
for i = 1,#Gamers do
if Gamers[i] ~= nil then
if Gamers[i].IsAlliedWith(player) then
Media.PlaySpeechNotification(Gamers[i], "Lose")
Gamers[i].MarkFailedObjective(MissionSurvive[i])
else
Media.PlaySpeechNotification(Gamers[i], "Win")
end
end
end
end
WorldLoaded = function()
Gamers = Player.GetPlayers(nil)
for i = 1,#Gamers do
if Gamers[i] ~= nil then
Trigger.OnPlayerLost(Gamers[i], ShortMode)
Trigger.OnObjectiveCompleted(Gamers[i], function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "You won")
end)
Trigger.OnObjectiveFailed(Gamers[i], function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "You lost")
end)
MissionSurvive[i] = Gamers[i].AddPrimaryObjective("All team members survive")
end
end
end
I don't really understand why the 'IsAlliedWith' fails here.
Can you help me? Thanks a lot!