Discussion Is Single Player bj variable O-o

Jesus4Lyf

Good Idea™
Reaction score
397
I believe that detects if there is one player in the game, not if the game is on single player mode vs lan/online. And hence is useless.

If I'm wrong, then usually the people using it use it to stop people from cheating in RPGs, etc. It isn't exactly subtle when someone can just search for that variable in code to remove it (or if it blocks people from saving when they play alone online, and hence can't cheat - the above point).

I believe the going method to detect if a game is single player is [LJASS]ReloadGameCachesFromDisk()[/LJASS].
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
From blizzard.j (i'm really disappointed that you didn't check it yourself)

JASS:
    set bj_isSinglePlayer = false
    set userControlledPlayers = 0
    set index = 0
    loop
        exitwhen index >= bj_MAX_PLAYERS
        if (GetPlayerController(Player(index)) == MAP_CONTROL_USER and GetPlayerSlotState(Player(index)) == PLAYER_SLOT_STATE_PLAYING) then
            set userControlledPlayers = userControlledPlayers + 1
        endif
        set index = index + 1
    endloop
    set bj_isSinglePlayer = (userControlledPlayers == 1)


So it's a no-no, also about the reload game cache thing it can fails in replay mode (but doesn't crash).
More about this detection here :
http://www.wc3c.net/showthread.php?t=104921

So if someone care about that, he could investigate a way with a TriggerSleepAction, (with and without a delay reducer).
 

Nestharus

o-o
Reaction score
84
Nah, I just saw the variable and thought, wonder if that really does single player ^_^.

Anyways, guess it doesn't, oh well : P
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top