So I'm working on a hero arena that's interchangable between ctf/domination/deathmatch/aos, all is well so far. What I'm trying to do is award additional experience and autosave at the end of the match. Each gameplay mode has their own victory/defeat conditions which are linked to a custom function which executes the xp gain based on the winning teams average hero level. I use another custom function to calculate team avg hero level and it seems to work 100% of the time.
It properly executes the XP gain and Defeat for the losing team, and only sometimes the winning team gets XP. It doesn't end game for victory for the winning team, and I've tried different conditions to return the winning team (allies/enemies of player, alliance aspect), and i'm starting to think 'Repeat action # of times' is what's causing it. It's like it can only be executed once per trigger/function.
[team 1]
If
teamlevel[1] >= (teamlevel[2] + 3)
Actions
Award XP to winners team1 wins (custom function)
[team 2]
If
teamlevel[2] >= (teamlevel[1] + 3)
Actions
Award XP to winners team2 wins (custom function)
[Award XP to winners team2 wins]
<> - Award XP to winners (team 2)
Options: Action
Return Type: Boolean
Parameters
has_won = false <Boolean>
Grammar Text: Award XP to winners (team 2)(has_won)
Hint Text: Awards experience (and minerals) to all players at the end of a game.
Custom Script Code
Local Variables
<> - avg_herolvl = 0 <Integer>
<> - losing_team_xp = 0 <Integer>
Actions
Variable - Set avg_herolvl = (Return Average Hero Level for team (2))
Variable - Set losing_team_xp = (avg_herolvl * 7)
Player Group - Pick each player in (All players) and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Player (Picked player) is giving player 14 Non-aggression) == false
Then
General - Repeat (Actions) avg_herolvl times
Actions
Environment - Execute Hero - Experience +10 on Heroes[(Picked player)] from player 15
Game - End game in Victory for player (Picked player) (Show dialogs, Show score screen)
UI - Display ((Text((avg_herolvl * 10))) + " Experience gained. Hero saved") for (Player group((Picked player))) to Chat area
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Player (Picked player) is giving player 15 Non-aggression) == false
Then
General - Repeat (Actions) losing_team_xp times
Actions
Environment - Execute Hero - Experience +10 on Heroes[(Picked player)] from player 15
Game - End game in Defeat for player (Picked player) (Show dialogs, Show score screen)
UI - Display ((Text((losing_team_xp * 10))) + " Experience gained. Hero saved") for (Player group((Picked player))) to Chat area
Else
General - Return true
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
So I'm working on a hero arena that's interchangable between ctf/domination/deathmatch/aos, all is well so far. What I'm trying to do is award additional experience and autosave at the end of the match. Each gameplay mode has their own victory/defeat conditions which are linked to a custom function which executes the xp gain based on the winning teams average hero level. I use another custom function to calculate team avg hero level and it seems to work 100% of the time.
It properly executes the XP gain and Defeat for the losing team, and only sometimes the winning team gets XP. It doesn't end game for victory for the winning team, and I've tried different conditions to return the winning team (allies/enemies of player, alliance aspect), and i'm starting to think 'Repeat action # of times' is what's causing it. It's like it can only be executed once per trigger/function.
[team 1]
[team 2]
[Award XP to winners team2 wins]