GameStatus - Replay Detection

This bundle is marked as approved. It works and satisfies the submission rules.
  • Like
Reactions: deepstrasz and pyf
This map allows you to detect if the game is online, offline, or a replay. Based on: [vJASS] - GameStatus (Replay Detection)

  • GameStatus
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • -------- Initialize --------
      • Set GAME_STATUS_OFFLINE = 0
      • Set GAME_STATUS_ONLINE = 1
      • Set GAME_STATUS_REPLAY = 2
      • -------- Find a playing player --------
      • Set GameStatus_Temp = 1
      • For each (Integer GameStatus_Temp) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set GameStatus_TempPlayer = (Player(GameStatus_Temp))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (GameStatus_TempPlayer controller) Equal to User
              • (GameStatus_TempPlayer slot status) Equal to Is playing
            • Then - Actions
              • Set GameStatus_Temp = 99
            • Else - Actions
      • -------- Find out the game status --------
      • Unit - Create 1 Footman for GameStatus_TempPlayer at (GameStatus_TempPlayer start location) facing Default building facing degrees
      • Selection - Select (Last created unit) for GameStatus_TempPlayer
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Last created unit) is selected by GameStatus_TempPlayer) Equal to True
        • Then - Actions
          • Custom script: if (ReloadGameCachesFromDisk()) then
          • Set GameStatus = GAME_STATUS_OFFLINE
          • Custom script: else
          • Set GameStatus = GAME_STATUS_REPLAY
          • Custom script: endif
        • Else - Actions
          • Set GameStatus = GAME_STATUS_ONLINE
      • Unit - Remove (Last created unit) from the game
      • Set GameStatus_Initialized = True
  • Test
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • -------- Make sure the system was initialized --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GameStatus_Initialized Equal to False
        • Then - Actions
          • Game - Display to (All players) the text: GameStatus has not ...
          • Skip remaining actions
        • Else - Actions
      • -------- Display the game status --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GameStatus Equal to GAME_STATUS_OFFLINE
        • Then - Actions
          • Game - Display to (All players) the text: This game is offlin...
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GameStatus Equal to GAME_STATUS_ONLINE
        • Then - Actions
          • Game - Display to (All players) the text: This game is online.
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GameStatus Equal to GAME_STATUS_REPLAY
        • Then - Actions
          • Game - Display to (All players) the text: You are viewing a r...
        • Else - Actions
Contents

GameStatus - Replay Detection (Map)

Reviews
KILLCIDE
System works as intended. Not much else to say about it! Needs Fixed Nothing Suggestions Not sure why you're setting GameStatus_Temp = 1 right before the loop. The GUI loop function automatically sets the integer variable to whatever your lower...
Level 10
Joined
Oct 5, 2008
Messages
355
Thats a simple, yet great system ( which also tells me i need to look more into wc3's structure. I haven't worked much with replays, so i could look to open up a leaderboard so reviwers of a game have more infornation about the game state.
Will test it soon and give then a rating :) .

edit: It works ingame and gives a bit flexibility when working on improving someones play. so i can give it a full star rating.
 
Last edited:
Level 36
Joined
Jul 22, 2015
Messages
3,491
System works as intended. Not much else to say about it!

Needs Fixed

  • Nothing

Suggestions

  • Not sure why you're setting GameStatus_Temp = 1 right before the loop. The GUI loop function automatically sets the integer variable to whatever your lower bound value is
  • Instead of breaking out of the loop by setting the loop integer to some arbitary value, you can just use exitwhen true
  • Instead of calling (Last created unit) 3 times, you should just store it into a variable

Status

Approved
 
Top