bj_isSinglePlayer

LordXavier

TH.net Regular
Reaction score
16
I'm trying to help a friend with some triggers in his map, and some of them make things all screwed up if you use cheats and he also doesn't want people to use cheats in the first place. How do I properly use bj_isSinglePlayer?
 

Tom Jones

N/A
Reaction score
437
I don't understand the question. Just use as the boolean that it is.

If you're wondering where it gets assigned a value, it happens in this function:
JASS:
function InitBlizzardGlobals takes nothing returns nothing

    local integer index

    local integer userControlledPlayers

    local version v



    // Init filter function vars

    set filterIssueHauntOrderAtLocBJ = Filter(function IssueHauntOrderAtLocBJFilter)

    set filterEnumDestructablesInCircleBJ = Filter(function EnumDestructablesInCircleBJFilter)

    set filterGetUnitsInRectOfPlayer = Filter(function GetUnitsInRectOfPlayerFilter)

    set filterGetUnitsOfTypeIdAll = Filter(function GetUnitsOfTypeIdAllFilter)

    set filterGetUnitsOfPlayerAndTypeId = Filter(function GetUnitsOfPlayerAndTypeIdFilter)

    set filterMeleeTrainedUnitIsHeroBJ = Filter(function MeleeTrainedUnitIsHeroBJFilter)

    set filterLivingPlayerUnitsOfTypeId = Filter(function LivingPlayerUnitsOfTypeIdFilter)



    // Init force presets

    set index = 0

    loop

        exitwhen index == bj_MAX_PLAYER_SLOTS

        set bj_FORCE_PLAYER[index] = CreateForce()

        call ForceAddPlayer(bj_FORCE_PLAYER[index], Player(index))

        set index = index + 1

    endloop



    set bj_FORCE_ALL_PLAYERS = CreateForce()

    call ForceEnumPlayers(bj_FORCE_ALL_PLAYERS, null)



    // Init Cinematic Mode history

    set bj_cineModePriorSpeed = GetGameSpeed()

    set bj_cineModePriorFogSetting = IsFogEnabled()

    set bj_cineModePriorMaskSetting = IsFogMaskEnabled()



    // Init Trigger Queue

    set index = 0

    loop

        exitwhen index >= bj_MAX_QUEUED_TRIGGERS

        set bj_queuedExecTriggers[index] = null

        set bj_queuedExecUseConds[index] = false

        set index = index + 1

    endloop



    // Init singleplayer check

    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) //Here.



    // Init sounds

    //set bj_pingMinimapSound = CreateSoundFromLabel("AutoCastButtonClick", false, false, false, 10000, 10000)

    set bj_rescueSound = CreateSoundFromLabel("Rescue", false, false, false, 10000, 10000)

    set bj_questDiscoveredSound = CreateSoundFromLabel("QuestNew", false, false, false, 10000, 10000)

    set bj_questUpdatedSound = CreateSoundFromLabel("QuestUpdate", false, false, false, 10000, 10000)

    set bj_questCompletedSound = CreateSoundFromLabel("QuestCompleted", false, false, false, 10000, 10000)

    set bj_questFailedSound = CreateSoundFromLabel("QuestFailed", false, false, false, 10000, 10000)

    set bj_questHintSound = CreateSoundFromLabel("Hint", false, false, false, 10000, 10000)

    set bj_questSecretSound = CreateSoundFromLabel("SecretFound", false, false, false, 10000, 10000)

    set bj_questItemAcquiredSound = CreateSoundFromLabel("ItemReward", false, false, false, 10000, 10000)

    set bj_questWarningSound = CreateSoundFromLabel("Warning", false, false, false, 10000, 10000)

    set bj_victoryDialogSound = CreateSoundFromLabel("QuestCompleted", false, false, false, 10000, 10000)

    set bj_defeatDialogSound = CreateSoundFromLabel("QuestFailed", false, false, false, 10000, 10000)



    // Init corpse creation triggers.

    call DelayedSuspendDecayCreate()



    // Init version-specific data

    set v = VersionGet()

    if (v == VERSION_REIGN_OF_CHAOS) then

        set bj_MELEE_MAX_TWINKED_HEROES = bj_MELEE_MAX_TWINKED_HEROES_V0

    else

        set bj_MELEE_MAX_TWINKED_HEROES = bj_MELEE_MAX_TWINKED_HEROES_V1

    endif

endfunction
The above function is called during map initialization, before library and trigger initialization.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
IsGameOnline != only one player.

EDIT : But yes the player can't do cheat if the game is "Online" (local area network or battle.net/whatever)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top