Arena Scheduler Use

Discussion in 'Plugin Development' started by MrTwiggy, Jul 12, 2012.

Thread Status:
Not open for further replies.
  1. Offline


    Hey there, was hoping for some help with my problem.

    I'm at a bit of a road block with how to structure this. I'm writing a plugin for a sort of 'arena' system, where players can join the server, pick a match (There will be multiple matches running simultaneously) and it will teleport the players to a lobby, wait a while, and then teleport them into the arena, etc.

    So, I'm trying to think of a clean and accurate way of how to do this whole flow. I need it basically to go (Match Is Ready For Players To Join) > (X Players Have Joined, Countdown Started Until Match Begins) > (Countdown Has Ended, Game Starts, Players Are Teleported To Their Spawn Locations) > etc...

    But I don't know how to do this. I was thinking I would maybe having a RepeatingTask scheduler that will go through a list of all the matches going on, and call their respective GameFlow() functions every tick. Then inside this GameFlow() function, I would logic that progresses from one state of the match to the next, with an enum of GameState, so like 'PREGAME', 'GAMEPHASE', 'ENDGAME', etc. But, the issue comes when I need to add more repeating/delayed schedulers inside the GameFlow() function so that I can do the countdown timer, check game states, update it, etc.

    Because if I have a repeating scheduler calling GameFlow() every tick, and then I have a repeating scheduler starting the countdown timer, now I've got a hundred countdown timers started, or I need to add some arbitrary boolean value for whether the timer has started, etc.. And it seems to get very complicated/messy very fast.

    Any ideas/examples/advice?

    EDIT: Also, it gets even more complicated, because I want there to be multiple rounds in each match, so Round 1, Round 2, etc. x_x
Thread Status:
Not open for further replies.

Share This Page