Enabling Single Player

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

zayasowhoa
Senior Member
Posts: 112
Joined: September 21st, 2008, 2:40 pm

Re: Enabling Single Player

Post by zayasowhoa »

The one on top should be the one i altered with and the bot was the original, I didn't do much to it. Hopefully this can hlep you guys explain my stupidity :(.
You do not have the required permissions to view the files attached to this post.
User avatar
Senethior459
Forum Staff
Posts: 2619
Joined: June 2nd, 2007, 6:53 pm
Title: I Just Lost the Game

Re: Enabling Single Player

Post by Senethior459 »

Okay. I searched for singleplayer, and found nothing. So I searched for single, with Match whole words checked. I didn't find it. I unchecked it, and after a few clicks of the Next button, I found this:

Code: Select all

//===========================================================================
// Trigger: NoSingle
//===========================================================================
//TESH.scrollpos=2
//TESH.alwaysfold=0
function InitTrig_NoSingle takes nothing returns nothing
    local player p
    local integer pcoust= 0
    local integer i= 0
    loop
        exitwhen i > 11
        set p = Player(i)
        if GetPlayerSlotState(p) == PLAYER_SLOT_STATE_PLAYING and GetPlayerController(p) == MAP_CONTROL_USER then
            set pcoust = pcoust + 1
        endif
        set i = i + 1
    endloop
    if pcoust <= 1 then
        call DisableTrigger(gg_trg_SaveLoad_Save_All)
        if ( IsPlayerInForce(GetLocalPlayer() , bj_FORCE_ALL_PLAYERS) ) then
        call DisplayTimedTextToPlayer(GetLocalPlayer() , 0 , 0 , 20 , "You play alone!-Save disabled")
        endif
        else
        call EnableTrigger(gg_trg_SaveLoad_Save_All)
    endif
endfunction

Now, see how it's set up a loop, to exit when i>11 ? Inside that loop, it's checking each player slot to see if it meets two conditions: PLAYER_SLOT_STATE_PLAYING (which means that player slot is occupied) and MAP_CONTROL_USER (which means it's a human, vs a computer). If both of those conditions are true for player i, it sets pcoust=pcoust+1 (basically, it adds one). No matter what, it sets i=i+1 (basically, it adds one to i) and loops back to the beginning, doing the same thing for player i again (but player i is now one higher. This type of thing is just simpler than making 12 functions, one for each player). Eventually, after i has been set to 12 (higher than the amount of player slots), the loop exits, and it does the real singleplayer disabling stuff.
See the "if pcoust <=1" stuff? Basically, if it's less than or equal to one, then 1 or less human players are in the game. So, it disables the save trigger, and displays that message to the person. And then the "else" is there, so that if it isn't less than or equal to 1, it enables the saving triggers.
Now that we've identified it and its function, let's disable it.
All the stuff between "if pcoust<=1" and "else" is the bad stuff. Now, you can delete everything between "function" and "endfunction" except for the "call EnableTrigger(gg_trg_SaveLoad_All)", which is what you need to keep. Or, you can replace everything between the "if pcoust" and the "else" with "call DoNothing()". I think the first is a better option, because then you don't have a bunch of useless code.
So, you can this way:

Code: Select all

function InitTrig_NoSingle takes nothing returns nothing
call EnableTrigger(gg_trg_SaveLoad_Save_All)
endfunction

or this way (not as good!):

Code: Select all

function InitTrig_NoSingle takes nothing returns nothing
    local player p
    local integer pcoust= 0
    local integer i= 0
    loop
        exitwhen i > 11
        set p = Player(i)
        if GetPlayerSlotState(p) == PLAYER_SLOT_STATE_PLAYING and GetPlayerController(p) == MAP_CONTROL_USER then
            set pcoust = pcoust + 1
        endif
        set i = i + 1
    endloop
    if pcoust <= 1 then
        call DoNothing()
        else
        call EnableTrigger(gg_trg_SaveLoad_Save_All)
    endif
endfunction
My Warcraft III Tool Collection
If you want to chat/game with me:
Blizzard: Senethior459#1962
Discord: Kyle#7409
Steam: Spacekidkyle
zayasowhoa
Senior Member
Posts: 112
Joined: September 21st, 2008, 2:40 pm

Re: Enabling Single Player

Post by zayasowhoa »

So now that you've done most of the work for me, and that map is looped, for this rpg, and if this is the trigger(I think, I think this map isn't looped) I searched singleplayer without match whole words and found nothing, and search for single afterwards and found plenty of things, but I didn't think it was related to the save trigger so i went on and tried -save and got this.
function Trig_SaveLoad_Save_All_Actions takes nothing returns nothing
set udg_SaveCount=0
set udg_SaveCount=(udg_SaveCount+1)
set udg_Save[udg_SaveCount]=GetPlayerState(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD)
set udg_SaveCount=(udg_SaveCount+1)
set udg_Save[udg_SaveCount]=GetPlayerState(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER)
set udg_UnitGroup=GetUnitsOfPlayerMatching(GetTriggerPlayer(),Condition(function Trig_SaveLoad_Save_All_Func010002002))
set udg_SaveCount=(udg_SaveCount+1)
set udg_Save[udg_SaveCount]=CountUnitsInGroup(udg_UnitGroup)
call ForGroupBJ(udg_UnitGroup,function Trig_SaveLoad_Save_All_Func013A)
set udg_Code=SaveLoad_Encode()
call QuestMessageBJ(GetForceOfPlayer(GetTriggerPlayer()),bj_QUESTMESSAGE_SECRET,"TRIGSTR_8435")
call DisplayTimedTextToForce(GetForceOfPlayer(GetTriggerPlayer()),60.00,udg_Code)
endfunction

I deleted all except
function Trig_SaveLoad_Save_All_Actions takes nothing returns nothing
call ForGroupBJ(udg_UnitGroup,function Trig_SaveLoad_Save_All_Func013A)
endfunction

Would this be right?
User avatar
Senethior459
Forum Staff
Posts: 2619
Joined: June 2nd, 2007, 6:53 pm
Title: I Just Lost the Game

Re: Enabling Single Player

Post by Senethior459 »

zayasowhoa wrote:So now that you've done most of the work for me, and that map is looped, for this rpg, and if this is the trigger(I think, I think this map isn't looped) I searched singleplayer without match whole words and found nothing, and search for single afterwards and found plenty of things, but I didn't think it was related to the save trigger so i went on and tried -save and got this.
function Trig_SaveLoad_Save_All_Actions takes nothing returns nothing
set udg_SaveCount=0
set udg_SaveCount=(udg_SaveCount+1)
set udg_Save[udg_SaveCount]=GetPlayerState(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD)
set udg_SaveCount=(udg_SaveCount+1)
set udg_Save[udg_SaveCount]=GetPlayerState(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER)
set udg_UnitGroup=GetUnitsOfPlayerMatching(GetTriggerPlayer(),Condition(function Trig_SaveLoad_Save_All_Func010002002))
set udg_SaveCount=(udg_SaveCount+1)
set udg_Save[udg_SaveCount]=CountUnitsInGroup(udg_UnitGroup)
call ForGroupBJ(udg_UnitGroup,function Trig_SaveLoad_Save_All_Func013A)
set udg_Code=SaveLoad_Encode()
call QuestMessageBJ(GetForceOfPlayer(GetTriggerPlayer()),bj_QUESTMESSAGE_SECRET,"TRIGSTR_8435")
call DisplayTimedTextToForce(GetForceOfPlayer(GetTriggerPlayer()),60.00,udg_Code)
endfunction

I deleted all except
function Trig_SaveLoad_Save_All_Actions takes nothing returns nothing
call ForGroupBJ(udg_UnitGroup,function Trig_SaveLoad_Save_All_Func013A)
endfunction

Would this be right?

No. That's the save function. It's important; deleting parts of it is bad. You're not trying to disable the save triggers, you're trying to find triggers that disable the save functions and get rid of them. That trigger doesn't have DisableTrigger, it doesn't have DestroyTrigger, and it doesn't have CustomDefeat (sometimes, if they're tricky, they use CustomVictory, which does the same thing, but most people don't search for it. Rarely does this happen, though. I've only seen it once or twice as an anti-singleplayer), so it's probably safe to assume that it's not anti-singleplayer. That looping thing I showed is used by lots of mapmakers, for lots of things (even for some of the cheatpacks!). Finding it in a trigger doesn't mean you found the anti-singleplayer functions. You could have found something else. However, if PLAYER_SLOT_STATE_PLAYING and MAP_CONTROL_USER are in the loop, you can usually assume it's checking for players, and there will be an anti-singleplayer around somewhere.
My Warcraft III Tool Collection
If you want to chat/game with me:
Blizzard: Senethior459#1962
Discord: Kyle#7409
Steam: Spacekidkyle
zayasowhoa
Senior Member
Posts: 112
Joined: September 21st, 2008, 2:40 pm

Re: Enabling Single Player

Post by zayasowhoa »

Argh... Now I really want to give up on enabling single player, but I'm determined to get the title Cheater T_T
ATM, I'm trying to enable single player for Dark Sun ORPG, I searched -save but I didn't see any destroy function and such or any loop for single player.
User avatar
Senethior459
Forum Staff
Posts: 2619
Joined: June 2nd, 2007, 6:53 pm
Title: I Just Lost the Game

Re: Enabling Single Player

Post by Senethior459 »

Don't look for loop. Look for DisableTrigger(savetrigger) or DestroyTrigger(savetrigger). Note that savetrigger isn't the function name, it's the trigger it uses (often starts with gg_trg_ ). Also, CustomDefeat and CustomVictory (careful on both of those, though, because they aren't always anti-singleplayer triggers).
My Warcraft III Tool Collection
If you want to chat/game with me:
Blizzard: Senethior459#1962
Discord: Kyle#7409
Steam: Spacekidkyle
User avatar
itsonlyaname
Senior Member
Posts: 195
Joined: February 13th, 2008, 5:30 pm

Re: Enabling Single Player

Post by itsonlyaname »

Enabling SP means u gotta know how jass works, and see when it does something that's not good.
U said that u where trying to enable SP on Dark Sun ORPG, so, i downloaded the map and look a look at it. (Dark Sun RPG v3.4.1)

The first thing i do i play the game, just to see what happens. possible things are: instant win/defeat, '-save' has no effect or gives a "no singleplayer" message, ...

Nothing happened when i started in SP, '-save' even worked. I opened the jass file and searched for '-save', then u find this function:

Code: Select all

function InitTrig_SaveLoad_Save_All takes nothing returns nothing
set gg_trg_SaveLoad_Save_All=CreateTrigger()
call TriggerRegisterPlayerChatEvent(gg_trg_SaveLoad_Save_All,Player(0),"-save",true)
call TriggerRegisterPlayerChatEvent(gg_trg_SaveLoad_Save_All,Player(1),"-save",true)
call TriggerRegisterPlayerChatEvent(gg_trg_SaveLoad_Save_All,Player(2),"-save",true)
call TriggerRegisterPlayerChatEvent(gg_trg_SaveLoad_Save_All,Player(3),"-save",true)
call TriggerRegisterPlayerChatEvent(gg_trg_SaveLoad_Save_All,Player(4),"-save",true)
call TriggerAddAction(gg_trg_SaveLoad_Save_All,function Trig_SaveLoad_Save_All_Actions)
endfunction

Pretty obvious what it does :)

When searching for 'gg_trg_SaveLoad_Save_All' i found this function:

Code: Select all

function Trig_AnitCheat_Whosyourdaddy_Actions takes nothing returns nothing
call DisplayTextToForce(GetPlayersAll(),"Cheat Detected (|cffff9115Whosyourdaddy|r) saving has been disabled.")
call DisableTrigger(gg_trg_SaveLoad_Initialization_All)
call DisableTrigger(gg_trg_SaveLoad_Load_All)
call DisableTrigger(gg_trg_SaveLoad_Save_All)
endfunction
function InitTrig_AnitCheat_Whosyourdaddy takes nothing returns nothing
set gg_trg_AnitCheat_Whosyourdaddy=CreateTrigger()
call TriggerRegisterUnitEvent(gg_trg_AnitCheat_Whosyourdaddy,gg_unit_hhou_0426,EVENT_UNIT_DEATH)
call TriggerAddAction(gg_trg_AnitCheat_Whosyourdaddy,function Trig_AnitCheat_Whosyourdaddy_Actions)
endfunction

So, this games detects when u use whosyourdaddy and then disables saving.

Just delete everything of the functions (but not the functions itself) so it looks like this:

Code: Select all

function Trig_AnitCheat_Whosyourdaddy_Actions takes nothing returns nothing
endfunction
function InitTrig_AnitCheat_Whosyourdaddy takes nothing returns nothing
endfunction


There is also a AnitCheat_Gold trigger, but it just limits gold to 20.000 so it's safe to ignore it. (if you load with more then 20K in a official map it will reset anyway)

Didn't find anything else beside that, so that should be all.
zayasowhoa
Senior Member
Posts: 112
Joined: September 21st, 2008, 2:40 pm

Re: Enabling Single Player

Post by zayasowhoa »

Well this RPG was recieved from the fulfilled requests section, but it was the original version. I enabled single player in this, but this map was fairly easy to me and it just stuck out infront of my eyes.
I still may need help on enabling single player for other rpgs.
You do not have the required permissions to view the files attached to this post.