Save/Load Code, Yet Another

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
> how you would combine the Save / Load All with the Save / Load Abilities


Start with the "all" triggers.
Copy the "add all abilities" block from the "Abilities" trigger.
Paste after the "add all items" of the save trigger.

Same for getting it all back.

> X amount of ...

Sooner or later (though rather later) the code will be longer than what you can type back in one go.
That's definitely when you try to save way too much info.

Though that's already over 100 characters... nothing to worry there :p


Now, for rather obvious reasons, the more you save, the longer the code will be.
Are you really sure you need it all?
 

Sevion

The DIY Ninja
Reaction score
413
Ace, when I try to combine the abilities Save/Load part into it then test the game removes my hero then I get no hero after attempting the load. This is what I have in the trigger:

Save:

Code:
SaveLoad Save All
    Events
        Player - Player 1 (Red) types a chat message containing -save as An exact match
        Player - Player 2 (Blue) types a chat message containing -save as An exact match
        Player - Player 3 (Teal) types a chat message containing -save as An exact match
        Player - Player 4 (Purple) types a chat message containing -save as An exact match
    Conditions
    Actions
        -------- Prepare the save array with this player's Hero --------
        Set SaveCount = 0
        -------- Player's Gold --------
        Set SaveCount = (SaveCount + 1)
        Set Save[SaveCount] = ((Triggering player) Current gold)
        -------- Take all Heroes --------
        Set UnitGroup = (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True))
        Set SaveCount = (SaveCount + 1)
        Set Save[SaveCount] = (Number of units in UnitGroup)
        Unit Group - Pick every unit in UnitGroup and do (Actions)
            Loop - Actions
                -------- Save the Hero --------
                Set SaveCount = (SaveCount + 1)
                Set TempUnit = (Picked unit)
                Custom script:   set udg_Save[udg_SaveCount] = SaveLoad_Unit2Integer( udg_TempUnit )
                -------- Hero Experience --------
                Set SaveCount = (SaveCount + 1)
                Set Save[SaveCount] = (Hero experience of (Picked unit))
                -------- Hero Position X --------
                Set SaveCount = (SaveCount + 1)
                Set Save[SaveCount] = (Integer((X of (Position of (Picked unit)))))
                -------- Hero Position Y --------
                Set SaveCount = (SaveCount + 1)
                Set Save[SaveCount] = (Integer((Y of (Position of (Picked unit)))))
                -------- How many items does he carry --------
                Set SaveCount = (SaveCount + 1)
                Set Save[SaveCount] = (Number of items carried by (Picked unit))
                -------- Add all items --------
                For each (Integer A) from 1 to 6, do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Item carried by (Picked unit) in slot (Integer A)) is owned) Equal to True
                            Then - Actions
                                -------- The actual item --------
                                Set SaveCount = (SaveCount + 1)
                                Set TempItem = (Item carried by (Picked unit) in slot (Integer A))
                                Custom script:   set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )
                                -------- The number of charges it has --------
                                Set SaveCount = (SaveCount + 1)
                                Set Save[SaveCount] = (Charges remaining in (Item carried by (Picked unit) in slot (Integer A)))
                            Else - Actions
                -------- Add all abilities --------
                For each (Integer A) from 1 to SaveLoad_Abilities_LastIndex, do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Level of SaveLoad_Abilities[(Integer A)] for (Picked unit)) Greater than 0
                            Then - Actions
                                -------- The actual ability --------
                                Set SaveCount = (SaveCount + 1)
                                Set Save[SaveCount] = (Integer A)
                                -------- Its level --------
                                Set SaveCount = (SaveCount + 1)
                                Set Save[SaveCount] = (Level of SaveLoad_Abilities[(Integer A)] for (Picked unit))
                            Else - Actions
        -------- Turn values into code --------
        Custom script:   set udg_Code = SaveLoad_Encode()
        -------- Show code to player --------
        Quest - Display to (Player group((Triggering player))) the Secret message: Your code:
        Game - Display to (Player group((Triggering player))) for 60.00 seconds the text: Code

Load:

Code:
SaveLoad Load All
    Events
        Player - Player 1 (Red) types a chat message containing -load  as A substring
        Player - Player 2 (Blue) types a chat message containing -load  as A substring
        Player - Player 3 (Teal) types a chat message containing -load  as A substring
        Player - Player 4 (Purple) types a chat message containing -load  as A substring
    Conditions
        (Substring((Entered chat string), 1, 6)) Equal to (Matched chat string)
        (Length of (Entered chat string)) Greater than 6
    Actions
        -------- Try to decode what was typed --------
        Set Code = (Substring((Entered chat string), 7, (Length of (Entered chat string))))
        Custom script:   set udg_Validate = SaveLoad_Decode( udg_Code )
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Validate Equal to False
            Then - Actions
                -------- Invalid code --------
                Game - Display to (Player group((Triggering player))) the text: There's some error ...
                Skip remaining actions
            Else - Actions
        -------- It worked, let's do something with it --------
        Unit Group - Pick every unit in (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
            Loop - Actions
                Unit - Remove (Picked unit) from the game
        Set SaveCount = 1
        -------- Restore Gold --------
        Player - Set (Triggering player) Current gold to Save[SaveCount]
        -------- For "number of Heroes", do --------
        Set SaveCount = (SaveCount + 1)
        For each (Integer B) from 1 to Save[SaveCount], do (Actions)
            Loop - Actions
                -------- Restore Hero --------
                Set SaveCount = (SaveCount + 1)
                Custom script:   set udg_TempUnitType = SaveLoad_Integer2Unit(udg_Save[udg_SaveCount])
                Unit - Create 1 TempUnitType for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
                -------- Set Experience --------
                Set SaveCount = (SaveCount + 1)
                Hero - Set (Last created unit) experience to Save[SaveCount], Hide level-up graphics
                -------- Move to saved position --------
                Set SaveCount = (SaveCount + 1)
                Unit - Move (Last created unit) instantly to (Point((Real(Save[SaveCount])), (Real(Save[(SaveCount + 1)]))))
                Set SaveCount = (SaveCount + 1)
                -------- Recreate all items --------
                Set SaveCount = (SaveCount + 1)
                For each (Integer A) from 1 to Save[SaveCount], do (Actions)
                    Loop - Actions
                        -------- The actual item --------
                        Set SaveCount = (SaveCount + 1)
                        Custom script:   set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
                        Hero - Create TempItemType and give it to (Last created unit)
                        -------- Number of charges --------
                        Set SaveCount = (SaveCount + 1)
                        Item - Set charges remaining in (Last created item) to Save[SaveCount]
                Unit Group - Pick every unit in (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
                    Loop - Actions
                        Unit - Remove (Picked unit) from the game
                Set TempInteger = SaveCount
                Set SaveCount = 1
                Custom script:   set udg_TempUnitType = SaveLoad_Integer2Unit(udg_Save[udg_SaveCount])
                Unit - Create 1 TempUnitType for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
                Set SaveCount = (SaveCount + 1)
                Hero - Set (Last created unit) Hero-level to Save[SaveCount], Hide level-up graphics
                For each (Integer SaveCount) from (SaveCount + 1) to TempInteger, do (Actions)
                    Loop - Actions
                        For each (Integer A) from 1 to Save[(SaveCount + 1)], do (Actions)
                            Loop - Actions
                                Custom script:   call SelectHeroSkill( GetLastCreatedUnit(), udg_SaveLoad_Abilities[ udg_Save[ udg_SaveCount ] ] )
                        Set SaveCount = (SaveCount + 1)
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
Let's say, you run this with 1 Hero, holding 1 item, with no charges, and two abilities, learned to level 1:

> Set SaveCount = (SaveCount + 1)
> Set Save[SaveCount] = ((Triggering player) Current gold)

Save[1] = Gold

> Set UnitGroup = (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True))
> Set SaveCount = (SaveCount + 1)
> Set Save[SaveCount] = (Number of units in UnitGroup)

Save[2] = Number of Heroes

> Set SaveCount = (SaveCount + 1)
> Set TempUnit = (Picked unit)
> Custom script: set udg_Save[udg_SaveCount] = SaveLoad_Unit2Integer( udg_TempUnit )

Save[3] = Hero

> Set SaveCount = (SaveCount + 1)
> Set Save[SaveCount] = (Hero experience of (Picked unit))

Save[4] = Experience

> Set SaveCount = (SaveCount + 1)
> Set Save[SaveCount] = (Integer((X of (Position of (Picked unit)))))
> Set SaveCount = (SaveCount + 1)
> Set Save[SaveCount] = (Integer((Y of (Position of (Picked unit)))))

Save[5] = X of Hero
Save[6] = Y of Hero

> Set SaveCount = (SaveCount + 1)
> Set Save[SaveCount] = (Number of items carried by (Picked unit))

Save[7] = Number of items

> Set SaveCount = (SaveCount + 1)
> Set TempItem = (Item carried by (Picked unit) in slot (Integer A))
> Custom script: set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )

Save[8] = Item 1

> Set SaveCount = (SaveCount + 1)
> Set Save[SaveCount] = (Charges remaining in (Item carried by (Picked unit) in slot (Integer A)))

Save[9] = Charges of Item 1

> Set SaveCount = (SaveCount + 1)
> Set Save[SaveCount] = (Integer A)

Save[10] = Ability 1

> Set SaveCount = (SaveCount + 1)
> Set Save[SaveCount] = (Level of SaveLoad_Abilities[(Integer A)] for (Picked unit))

Save[11] = Level of Ability 1

Save[12] = Ability 2
Save[13] = Level of Ability 2


You end up with 13 values, that will be turned into a code:

Save[1] = Gold
Save[2] = Number of Heroes
Save[3] = Hero
Save[4] = Experience
Save[5] = X of Hero
Save[6] = Y of Hero
Save[7] = Number of items
Save[8] = Item 1
Save[9] = Charges of Item 1
Save[10] = Ability 1
Save[11] = Level of Ability 1
Save[12] = Ability 2
Save[13] = Level of Ability 2


Until here, looks OK.
You're probably saving more than you need with the number of Heroes...

Let's see what happens when you "load" that:

> Unit Group - Pick every unit in ... Unit - Remove (Picked unit) from the game

Remove the existing Heroes

> Set SaveCount = 1
> Player - Set (Triggering player) Current gold to Save[SaveCount]

Restore player's gold from Save[1].

> Set SaveCount = (SaveCount + 1)
> For each (Integer B) from 1 to Save[SaveCount], do (Actions)

From 1 to Save[2] (number of Heroes):

> Set SaveCount = (SaveCount + 1)
> Custom script: set udg_TempUnitType = SaveLoad_Integer2Unit(udg_Save[udg_SaveCount])
> Unit - Create 1 TempUnitType for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees

Create a Hero, from Save[3].

> Set SaveCount = (SaveCount + 1)
> Hero - Set (Last created unit) experience to Save[SaveCount], Hide level-up graphics

Set his experience to Save[4].

> Set SaveCount = (SaveCount + 1)
> Unit - Move (Last created unit) instantly to (Point((Real(Save[SaveCount])), (Real(Save[(SaveCount + 1)]))))
> Set SaveCount = (SaveCount + 1)

Move the Hero to x=Save[5] and y=Save[6].

> Set SaveCount = (SaveCount + 1)
> For each (Integer A) from 1 to Save[SaveCount], do (Actions)

From 1 to Save[7], number of Items:

> Set SaveCount = (SaveCount + 1)
> Custom script: set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
> Hero - Create TempItemType and give it to (Last created unit)

Create an item of type Save[8].

> Set SaveCount = (SaveCount + 1)
> Item - Set charges remaining in (Last created item) to Save[SaveCount]

Set its charges to Save[9].


Now, what remains are his abilities, there were saved like this:
Save[10] = Ability 1
Save[11] = Level of Ability 1
Save[12] = Ability 2
Save[13] = Level of Ability 2

Instead though, you have:
> Unit Group - Pick every unit in (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
> Unit - Remove (Picked unit) from the game

Remove all units?
Uhm... yeah, well, the new Hero is gone now... that's probably not what you wanted.
Remove that loop.


> Set TempInteger = SaveCount

This should be at the very beginning, after loading was successful.

> Set SaveCount = 1

Resetting the current count?
No!
Remove that line, you do want to continue where you left of, at 10, not 1.

> Custom script: set udg_TempUnitType = SaveLoad_Integer2Unit(udg_Save[udg_SaveCount])
> Unit - Create 1 TempUnitType for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees

Those two lines create a Hero of type "Gold"???
Remove them.

> Set SaveCount = (SaveCount + 1)
> Hero - Set (Last created unit) Hero-level to Save[SaveCount], Hide level-up graphics

The Hero is already at the correct level, remove those lines too.

> For each (Integer SaveCount) from (SaveCount + 1) to TempInteger, do (Actions)

This would go from 11 to 13.
Should be from 10 to 13.

> Loop - Actions

The final loop is probably correct.
It depends though on the previous actions...


Seems like you didn't really try to get how this works, or how it might be used.
 
R

rai

Guest
i add Gold, Lumber, Hero, Hero Experience, Hero Str, Hero Agi, Hero Int, Hero Skill Points, Hero carry items and Vault carry items.

there are 250 items in my map.

when filling items in the hero(have 6) and vault(have 6), i can't save.

i type -save,never display any codes.

but i drop 2, 3 or more items, the save is functioning.

what to do i can save more items?
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
Have a careful look at one of the provided, and working, triggers, for inspiration.
You did, of course, copy over some category, to have, at least, the "init" stuff?


Other than that, right-click your trigger's name, use "copy as text" and post it here.
Preferably with [noparse]
Code:
 <your trigger >
[/noparse] tags around (the "#" button).
 
R

rai

Guest
yes, i know that copy and paste all trigger.
but i add many items in the map.(about 250 items)

i test gold 1000000, lumber 1000000, hero lv 150, str 999, agi 999, int 999, hero skill points 450, hero and vault filled items.
it can't save.
i drop 2, 3 or many items, it can.

i set SaveLoad_Items_LastIndex=250
i think items-type too more to save.

what to do i can save more than hundred items

this is save
Code:
function Trig_SaveLoad_Save_test_Func010001002 takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) == true )
endfunction

function Trig_SaveLoad_Save_test_Func010Func021Func001C takes nothing returns boolean
    if ( not ( IsItemOwned(UnitItemInSlotBJ(GetEnumUnit(), GetForLoopIndexA())) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_SaveLoad_Save_test_Func010A takes nothing returns nothing
    // Save the Hero
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_TempUnit = GetEnumUnit()
    set udg_Save[udg_SaveCount] = SaveLoad_Unit2Integer( udg_TempUnit )
    // Hero Experience
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_Save[udg_SaveCount] = GetHeroXP(GetEnumUnit())
    // Hero Str
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_Save[udg_SaveCount] = GetHeroStatBJ(bj_HEROSTAT_STR, GetEnumUnit(), false)
    // Hero Agi
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_Save[udg_SaveCount] = GetHeroStatBJ(bj_HEROSTAT_AGI, GetEnumUnit(), false)
    // Hero Int
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_Save[udg_SaveCount] = GetHeroStatBJ(bj_HEROSTAT_INT, GetEnumUnit(), false)
    // How many items does he carry
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_Save[udg_SaveCount] = UnitInventoryCount(GetEnumUnit())
    // Add all items
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 6
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        if ( Trig_SaveLoad_Save_test_Func010Func021Func001C() ) then
            // The actual item
            set udg_SaveCount = ( udg_SaveCount + 1 )
            set udg_TempItem = UnitItemInSlotBJ(GetEnumUnit(), GetForLoopIndexA())
            set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )
            // The number of charges it has
            set udg_SaveCount = ( udg_SaveCount + 1 )
            set udg_Save[udg_SaveCount] = GetItemCharges(UnitItemInSlotBJ(GetEnumUnit(), GetForLoopIndexA()))
        else
        endif
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
endfunction

function Trig_SaveLoad_Save_test_Func015Func001C takes nothing returns boolean
    if ( not ( IsItemOwned(UnitItemInSlotBJ(gg_unit_hpea_0016, GetForLoopIndexA())) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_SaveLoad_Save_test_Actions takes nothing returns nothing
    // Prepare the save array with this player's Hero
    set udg_SaveCount = 0
    // Player's Gold
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_Save[udg_SaveCount] = GetPlayerState(GetTriggerPlayer(), PLAYER_STATE_RESOURCE_GOLD)
    // Player's Lumber
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_Save[udg_SaveCount] = GetPlayerState(GetTriggerPlayer(), PLAYER_STATE_RESOURCE_LUMBER)
    // Take all Heroes (assumes there is only one)
    call ForGroupBJ( GetUnitsOfPlayerMatching(GetTriggerPlayer(), Condition(function Trig_SaveLoad_Save_test_Func010001002)), function Trig_SaveLoad_Save_test_Func010A )
    // How many items does he carry
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_Save[udg_SaveCount] = UnitInventoryCount(gg_unit_hpea_0016)
    // Add all items
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 6
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        if ( Trig_SaveLoad_Save_test_Func015Func001C() ) then
            // The actual item
            set udg_SaveCount = ( udg_SaveCount + 1 )
            set udg_TempItem = UnitItemInSlotBJ(gg_unit_hpea_0016, GetForLoopIndexA())
            set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )
            // The number of charges it has
            set udg_SaveCount = ( udg_SaveCount + 1 )
            set udg_Save[udg_SaveCount] = GetItemCharges(UnitItemInSlotBJ(gg_unit_hpea_0016, GetForLoopIndexA()))
        else
        endif
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    set udg_Code = SaveLoad_Encode()
    // Show code to player
    call QuestMessageBJ( GetForceOfPlayer(GetTriggerPlayer()), bj_QUESTMESSAGE_SECRET, "TRIGSTR_030" )
    call DisplayTimedTextToForce( GetForceOfPlayer(GetTriggerPlayer()), 300.00, udg_Code )
endfunction

//===========================================================================
function InitTrig_SaveLoad_Save_test takes nothing returns nothing
    set gg_trg_SaveLoad_Save_test = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Save_test, Player(0), "-save", true )
    call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Save_test, Player(1), "-save", true )
    call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Save_test, Player(2), "-save", true )
    call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Save_test, Player(3), "-save", true )
    call TriggerAddAction( gg_trg_SaveLoad_Save_test, function Trig_SaveLoad_Save_test_Actions )
endfunction

Code:
function Trig_SaveLoad_Load_test_Conditions takes nothing returns boolean
    if ( not ( SubStringBJ(GetEventPlayerChatString(), 1, 6) == GetEventPlayerChatStringMatched() ) ) then
        return false
    endif
    if ( not ( StringLength(GetEventPlayerChatString()) > 6 ) ) then
        return false
    endif
    return true
endfunction

function Trig_SaveLoad_Load_test_Func004C takes nothing returns boolean
    if ( not ( udg_Validate == false ) ) then
        return false
    endif
    return true
endfunction

function Trig_SaveLoad_Load_test_Func006001002 takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) == true )
endfunction

function Trig_SaveLoad_Load_test_Func006A takes nothing returns nothing
    call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_SaveLoad_Load_test_Actions takes nothing returns nothing
    // Try to decode what was typed
    set udg_Code = SubStringBJ(GetEventPlayerChatString(), 7, StringLength(GetEventPlayerChatString()))
    set udg_Validate = SaveLoad_Decode( udg_Code )
    if ( Trig_SaveLoad_Load_test_Func004C() ) then
        // Invalid code
        call DisplayTextToForce( GetForceOfPlayer(GetTriggerPlayer()), "TRIGSTR_029" )
        return
    else
    endif
    // It worked, let's do something with it
    call ForGroupBJ( GetUnitsOfPlayerMatching(GetTriggerPlayer(), Condition(function Trig_SaveLoad_Load_test_Func006001002)), function Trig_SaveLoad_Load_test_Func006A )
    set udg_SaveCount = 1
    // Restore Gold
    call SetPlayerStateBJ( GetTriggerPlayer(), PLAYER_STATE_RESOURCE_GOLD, udg_Save[udg_SaveCount] )
    // Restore Lumber
    set udg_SaveCount = ( udg_SaveCount + 1 )
    call SetPlayerStateBJ( GetTriggerPlayer(), PLAYER_STATE_RESOURCE_LUMBER, udg_Save[udg_SaveCount] )
    // Restore Hero
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_TempUnitType = SaveLoad_Integer2Unit(udg_Save[udg_SaveCount])
    call CreateNUnitsAtLoc( 1, udg_TempUnitType, GetTriggerPlayer(), GetPlayerStartLocationLoc(GetTriggerPlayer()), bj_UNIT_FACING )
    // Set Experience
    set udg_SaveCount = ( udg_SaveCount + 1 )
    call SetHeroXP( GetLastCreatedUnit(), udg_Save[udg_SaveCount], false )
    // Set Str
    set udg_SaveCount = ( udg_SaveCount + 1 )
    call ModifyHeroStat( bj_HEROSTAT_STR, GetLastCreatedUnit(), bj_MODIFYMETHOD_SET, udg_Save[udg_SaveCount] )
    // Set Agi
    set udg_SaveCount = ( udg_SaveCount + 1 )
    call ModifyHeroStat( bj_HEROSTAT_AGI, GetLastCreatedUnit(), bj_MODIFYMETHOD_SET, udg_Save[udg_SaveCount] )
    // Set Int
    set udg_SaveCount = ( udg_SaveCount + 1 )
    call ModifyHeroStat( bj_HEROSTAT_INT, GetLastCreatedUnit(), bj_MODIFYMETHOD_SET, udg_Save[udg_SaveCount] )
    set udg_SaveCount = ( udg_SaveCount + 1 )
    // Recreate all items
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = udg_Save[udg_SaveCount]
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        // The actual item
        set udg_SaveCount = ( udg_SaveCount + 1 )
        set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
        call UnitAddItemByIdSwapped( udg_TempItemType, GetLastCreatedUnit() )
        // Number of charges
        set udg_SaveCount = ( udg_SaveCount + 1 )
        call SetItemCharges( GetLastCreatedItem(), udg_Save[udg_SaveCount] )
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    // Recreate all items
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = udg_Save[udg_SaveCount]
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        // The actual item
        set udg_SaveCount = ( udg_SaveCount + 1 )
        set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
        call UnitAddItemByIdSwapped( udg_TempItemType, gg_unit_hpea_0016 )
        // Number of charges
        set udg_SaveCount = ( udg_SaveCount + 1 )
        call SetItemCharges( GetLastCreatedItem(), udg_Save[udg_SaveCount] )
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
endfunction

//===========================================================================
function InitTrig_SaveLoad_Load_test takes nothing returns nothing
    set gg_trg_SaveLoad_Load_test = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Load_test, Player(0), "-load ", false )
    call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Load_test, Player(1), "-load ", false )
    call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Load_test, Player(2), "-load ", false )
    call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Load_test, Player(3), "-load ", false )
    call TriggerAddCondition( gg_trg_SaveLoad_Load_test, Condition( function Trig_SaveLoad_Load_test_Conditions ) )
    call TriggerAddAction( gg_trg_SaveLoad_Load_test, function Trig_SaveLoad_Load_test_Actions )
endfunction
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
Converted GUI?


> I set SaveLoad_Items_LastIndex=250

And all of those are actually in that item array?

Anyway, do you get a code if you
Set SaveLoad_Items_LastIndex = 1
?
 
R

rai

Guest
> I set SaveLoad_Items_LastIndex=250

>And all of those are actually in that item array?

yes, those are actually in it.

>Set SaveLoad_Items_LastIndex = 1

yes,i set it and i can get a code.
i set SaveLoad_Items_LastIndex = 50,too

but i set SaveLoad_Items_LastIndex is above 200, i can't.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
Well, in that case, with 200+, you hit the thread execution limit...

Nothing you can do there.
However, you still do get a working code with less.
The only difference will be that it is slightly longer...
 
R

rai

Guest
Set SaveLoad_Items_LastIndex=124
hero and vault carried all items.
i can't get codes.

and i want save more items in the hero and vault.

help me, plz.
 
R

rai

Guest
i test it.
when above two heroes are in the map, it seem doesn't save for hundreds of items.

i want to increase to save values.
how to do it?
please, tell me.
or are there other methods?
 

Knights

You can change this now in User CP.
Reaction score
71
Okay, heres my trigger to save:

Abilities
Gold
HeroLevel
HeroExp
PositionX
PositionY
Items
Ability Levels

Code:
SaveLoad Save All
    Events
        Player - Player 1 (Red) types a chat message containing -save as An exact match
        Player - Player 2 (Blue) types a chat message containing -save as An exact match
        Player - Player 3 (Teal) types a chat message containing -save as An exact match
        Player - Player 4 (Purple) types a chat message containing -save as An exact match
    Conditions
    Actions
        -------- Prepare the save array with this player's Hero --------
        Set SaveCount = 0
        -------- Player's Gold --------
        Set SaveCount = (SaveCount + 1)
        Set Save[SaveCount] = ((Triggering player) Current gold)
        -------- Take all Heroes --------
        Set UnitGroup = (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True))
        Set SaveCount = (SaveCount + 1)
        Set Save[SaveCount] = (Number of units in UnitGroup)
        Unit Group - Pick every unit in UnitGroup and do (Actions)
            Loop - Actions
                -------- Save the Hero --------
                Set SaveCount = (SaveCount + 1)
                Set TempUnit = (Picked unit)
                Custom script:   set udg_Save[udg_SaveCount] = SaveLoad_Unit2Integer( udg_TempUnit )
                -------- Hero Experience --------
                Set SaveCount = (SaveCount + 1)
                Set Save[SaveCount] = (Hero experience of (Picked unit))
                -------- Hero Position X --------
                Set SaveCount = (SaveCount + 1)
                Set Save[SaveCount] = (Integer((X of (Position of (Picked unit)))))
                -------- Hero Position Y --------
                Set SaveCount = (SaveCount + 1)
                Set Save[SaveCount] = (Integer((Y of (Position of (Picked unit)))))
                -------- How many items does he carry --------
                Set SaveCount = (SaveCount + 1)
                Set Save[SaveCount] = (Number of items carried by (Picked unit))
                -------- Add all items --------
                For each (Integer A) from 1 to 6, do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Item carried by (Picked unit) in slot (Integer A)) is owned) Equal to True
                            Then - Actions
                                -------- The actual item --------
                                Set SaveCount = (SaveCount + 1)
                                Set TempItem = (Item carried by (Picked unit) in slot (Integer A))
                                Custom script:   set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )
                                -------- The number of charges it has --------
                                Set SaveCount = (SaveCount + 1)
                                Set Save[SaveCount] = (Charges remaining in (Item carried by (Picked unit) in slot (Integer A)))
                            Else - Actions
                -------- Add all abilities --------
                For each (Integer A) from 1 to SaveLoad_Abilities_LastIndex, do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Level of SaveLoad_Abilities[(Integer A)] for (Picked unit)) Greater than 0
                            Then - Actions
                                -------- The actual ability --------
                                Set SaveCount = (SaveCount + 1)
                                Set Save[SaveCount] = (Integer A)
                                -------- Its level --------
                                Set SaveCount = (SaveCount + 1)
                                Set Save[SaveCount] = (Level of SaveLoad_Abilities[(Integer A)] for (Picked unit))
                            Else - Actions
        -------- Turn values into code --------
        Custom script:   set udg_Code = SaveLoad_Encode()
        -------- Show code to player --------
        Quest - Display to (Player group((Triggering player))) the Secret message: Your code:
        Game - Display to (Player group((Triggering player))) for 60.00 seconds the text: Code

Code:
SaveLoad Load All
    Events
        Player - Player 1 (Red) types a chat message containing -load  as A substring
        Player - Player 2 (Blue) types a chat message containing -load  as A substring
        Player - Player 3 (Teal) types a chat message containing -load  as A substring
        Player - Player 4 (Purple) types a chat message containing -load  as A substring
    Conditions
        (Substring((Entered chat string), 1, 6)) Equal to (Matched chat string)
        (Length of (Entered chat string)) Greater than 6
    Actions
        -------- Try to decode what was typed --------
        Set Code = (Substring((Entered chat string), 7, (Length of (Entered chat string))))
        Custom script:   set udg_Validate = SaveLoad_Decode( udg_Code )
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Validate Equal to False
            Then - Actions
                -------- Invalid code --------
                Game - Display to (Player group((Triggering player))) the text: There's some error ...
                Skip remaining actions
            Else - Actions
        -------- It worked, let's do something with it --------
        Unit Group - Pick every unit in (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
            Loop - Actions
                Unit - Remove (Picked unit) from the game
        Set SaveCount = 1
        -------- Restore Gold --------
        Player - Set (Triggering player) Current gold to Save[SaveCount]
        -------- For "number of Heroes", do --------
        Set SaveCount = (SaveCount + 1)
        For each (Integer B) from 1 to Save[SaveCount], do (Actions)
            Loop - Actions
                -------- Restore Hero --------
                Set SaveCount = (SaveCount + 1)
                Custom script:   set udg_TempUnitType = SaveLoad_Integer2Unit(udg_Save[udg_SaveCount])
                Unit - Create 1 TempUnitType for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
                -------- Set Experience --------
                Set SaveCount = (SaveCount + 1)
                Hero - Set (Last created unit) experience to Save[SaveCount], Hide level-up graphics
                -------- Move to saved position --------
                Set SaveCount = (SaveCount + 1)
                Unit - Move (Last created unit) instantly to (Point((Real(Save[SaveCount])), (Real(Save[(SaveCount + 1)]))))
                Set SaveCount = (SaveCount + 1)
                -------- Recreate all items --------
                Set SaveCount = (SaveCount + 1)
                For each (Integer A) from 1 to Save[SaveCount], do (Actions)
                    Loop - Actions
                        -------- The actual item --------
                        Set SaveCount = (SaveCount + 1)
                        Custom script:   set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
                        Hero - Create TempItemType and give it to (Last created unit)
                        -------- Number of charges --------
                        Set SaveCount = (SaveCount + 1)
                        Item - Set charges remaining in (Last created item) to Save[SaveCount]
                For each (Integer SaveCount) from (SaveCount + 1) to TempInteger, do (Actions)
                    Loop - Actions
                        For each (Integer A) from 1 to Save[(SaveCount + 1)], do (Actions)
                            Loop - Actions
                                Custom script:   call SelectHeroSkill( GetLastCreatedUnit(), udg_SaveLoad_Abilities[ udg_Save[ udg_SaveCount ] ] )
                        Set SaveCount = (SaveCount + 1)

The ability levels don't save tho :(, nor do the abilities even show up.

I don't understand why though :S

Thanks,
Knights:cool:
 

Nestharus

o-o
Reaction score
84
Above your Set SaveCount = 1
You need
Set TempInteger = SaveCount

If you look at your loop, your loop uses that integer. It can't really use that integer if you don't set it, well it can, but it'll be weird : P

kk

Oh hey guys, now to my own problems

so, I'm trying to put in some extra security features that will make this code near impossible to crack and uh, yea :p

So, first, I increased the alphabet base, then I increased the Encoder base, then I added in color coding

Then..


I created a random thingie to pick between a multitude of alphabet bases ^_^

After that, I encrypted the first random thingie with a second random thingie, then i encrypted the second with a set base alphabet, then I encrypt the first half of the save/load code with the second and the second half of the save/load code with the first.

Atm, it's the entire save/load code with the first encryption, but yea, this will make all of those cheaters very confused, hehehe

Ok, so here's what I'm looking at

I sorta stopped working with the decoding after I added in the second random encryption ><, it got um, annoyg, lolz..

So, each encryption key = 2 characters
A = w/e

AAAA-restofcode split up into 4's

The next thing I'm going to put in is make it so the code doesn't save in the same sequence every time. It'll be like alphabet keys, except sequence keys instead. This will make the code even more random. Half of the sequence key will be encrypted by one of the random encrypts, the other half will be encrypted by the other random encrypt.

This means that a code will be fairly long, about 32 characters, but it will be impossible to get into.
A = Sequence
B = Encryption
S = Code

Estimated Max Code Length

BBBB-AAAA-SSSS-SSSS-SSSS-SSSS-SSSS-SSSS-SSSS-SSS-SSSS-SSSS

yea, when u get way up there, it'll be pretty long :\, but 8 extra characters ensures a very protected code : D

Ok, so here's what I got so far:

Code:
Actions
    -------- List of Heroes --------
    Set SaveLoad_Heroes[1] = Paladin
    Set SaveLoad_Heroes[2] = Archmage
    Set SaveLoad_Heroes[3] = Mountain King
    Set SaveLoad_Heroes[4] = Blood Mage
    -------- Number of Heroes --------
    Set SaveLoad_Heroes_LastIndex = 4
    -------- List of Items --------
    Set SaveLoad_Items[1] = Claws of Attack +15
    Set SaveLoad_Items[2] = Cheese
    Set SaveLoad_Items[3] = Wand of Lightning Shield
    Set SaveLoad_Items[4] = Magic Key Chain
    -------- Number of Items --------
    Set SaveLoad_Items_LastIndex = 4
    -------- List of Abilities --------
    Set SaveLoad_Abilities[1] = Banish
    Set SaveLoad_Abilities[2] = Flame Strike
    Set SaveLoad_Abilities[3] = Phoenix
    Set SaveLoad_Abilities[4] = Siphon Mana
    -------- Number of Abilities --------
    Set SaveLoad_Abilities_LastIndex = 4
    -------- Encryption ^)^ --------
    Set Alphabet[1] = abcjkl$%&mwxyNOPQRSzABCDM456TUVWnopqrstuvXYZ012EFGHIJKL3789@#<>?defghi=+~\
    Set Alphabet[2] = @%fx1B&<0C>?=+~\abc#$deyzDAEvwF6789Gghijklm2345nopqrstuHIJKLMNOPQRSTUVWXYZ
    Set Alphabet[3] = $%&=+~\a<>?ghiCDjkl01ef2634mOPQnKopqzbcd57uvy89BA@#ErstFGXHIJLMNRwxSTUVWYZ
    Set Alphabet[4] = U+~\Ya<?4ghDjkl0EtFr5pf3=mOeoQT>1iCqZPzbc%d7uvyW89nV2KB$&A@#s6GXHIJLMNRwxS
    Set Alphabet[5] = eMDjkl\0Etbc%7uvy2KB$U+hr5pf3=m1iC4g&A@#s6~GXHOYa<?NFqZPzRwoQT>dIJLW89nVxS
    Set Alphabet[6] = RwoQT>5pf3=mA@#s6~1iC4g&GXHOYac%7uvy2<?NFqZetbKB$U+hrPzdIJLW89nVxSMDjkl\0E
    Set Alphabet[8] = =T>#5mAp@sCy?42\0EgoQHVxS6~1Gvw<U+%NbKFtWBR7f3XOuDjkqZeYac$hrPzdIJL89nliM&
    Set basemax = 8
    Set SaveLoad_CaseSensitive = True
    Set SaveLoad_UsePlayername = True
    -------- Required: false --------
    Set SaveLoad_Initialized = False
    -------- Leave as is. Used to autocreate variables when copy & pasting to a new map --------
    Set Code = AceHart
    Set Save[1] = 0
    Set SaveCount = 1
    Set Validate = False
    Set SaveLoad_Compress[1] = 0
    Set SaveLoad_Uncompress[1] = 0

A lot of that probably looks familiar, I just started this

next

Code:
Actions
    -------- Prepare the save array with this player's Hero --------
    Set SaveLoad_UsePlayername = False
    Set SaveCount = 1
    Set base = (Random integer number between 1 and basemax)
    Set base2 = base
    Set Save[SaveCount] = base
    Set base = (Random integer number between 1 and basemax)
    Custom script:   set udg_Code = SaveLoad_Encode()
    Set Save[SaveCount] = base
    Set base = basemax
    Custom script:   set udg_Code = udg_Code + SaveLoad_Encode() + "-"
    Set SaveLoad_UsePlayername = True
    Set SaveCount = 0
    -------- Gold/Lumber/Variables --------
    Set SaveCount = (SaveCount + 1)
    Set Save[SaveCount] = ((Triggering player) Current gold)
    Set SaveCount = (SaveCount + 1)
    Set Save[SaveCount] = ((Triggering player) Current lumber)
    -------- Take all Heroes (assumes there is only one) --------
    Unit Group - Pick every unit in (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
        Loop - Actions
            -------- Save the Hero --------
            Set SaveCount = (SaveCount + 1)
            Set TempUnit = (Picked unit)
            Custom script:   set udg_Save[udg_SaveCount] = SaveLoad_Unit2Integer( udg_TempUnit )
            -------- Hero level --------
            Set SaveCount = (SaveCount + 1)
            Set Save[SaveCount] = (Hero level of (Picked unit))
            -------- How many items does he carry --------
            Set SaveCount = (SaveCount + 1)
            Set Save[SaveCount] = (Number of items carried by (Picked unit))
            -------- Add all items --------
            For each (Integer A) from 1 to 6, do (Actions)
                Loop - Actions
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        If - Conditions
                            ((Item carried by (Picked unit) in slot (Integer A)) is owned) Equal to True
                        Then - Actions
                            -------- The actual item --------
                            Set SaveCount = (SaveCount + 1)
                            Set TempItem = (Item carried by (Picked unit) in slot (Integer A))
                            Custom script:   set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )
                            -------- The number of charges it has --------
                            Set SaveCount = (SaveCount + 1)
                            Set Save[SaveCount] = (Charges remaining in (Item carried by (Picked unit) in slot (Integer A)))
                        Else - Actions
            -------- Add all abilities --------
            For each (Integer A) from 1 to SaveLoad_Abilities_LastIndex, do (Actions)
                Loop - Actions
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        If - Conditions
                            (Level of SaveLoad_Abilities[(Integer A)] for (Picked unit)) Greater than 0
                        Then - Actions
                            -------- The actual ability --------
                            Set SaveCount = (SaveCount + 1)
                            Set Save[SaveCount] = (Integer A)
                            -------- Its level --------
                            Set SaveCount = (SaveCount + 1)
                            Set Save[SaveCount] = (Level of SaveLoad_Abilities[(Integer A)] for (Picked unit))
                        Else - Actions
    -------- Turn values into code --------
    Set base = base2
    Custom script:   set udg_Code = udg_Code + SaveLoad_Encode()
    -------- Show code to player --------
    Quest - Display to (Player group((Triggering player))) the Secret message: Your code:
    Game - Display to (Player group((Triggering player))) for 60.00 seconds the text: Code

here's where it gets interesting

The above is my 3-base encryption. The first one encrypts the main code atm. At one point, it'll be both encrypting the main code.

When the sequencing goes in there, i'll just make every save have its own value and set up bases to go thru the values in different orders. The sequencers will be randomized to those bases just like the encryption keys above. The sequencers will be made first, then their sequencing will be stored, then the first encryption will come in, encrypt one sequencer, the next will come in, encrypt the other sequencer and the first encryption, then the set value will come in and encrypt the second random value. After that will come the code based on the sequences. One half will be encrypted with the first encryption and the other half will be encrypted with the second encryption.

In the end, a person will have a very difficult time cracking this code. One save and their entire code radically changes, so they will have to completely re-crack it. Yes, it's possible to crack it by guess and check a million times, but if you save, you have to re guess and check another million times.

pretty much, it won't be worht it : P

lol

Now, the load hasn't really been worked on because it's juts giving me a headache

Here's what I really plan on doing

The code starts at 7
12 is your first 5 characters (AAAA-)
at 13 is where the encryption keys start
So first do a sub string for 15,16 (that's your second encryption set)
decrypt that using your set value, use that to decrypt the second half of the code (it doesn't matter what values the second half of the code have, you'll always be decrypting and encrypting the same things). The sequencer will actually be 2 characters long, the other thing will be the value holder thingie : P. It'll say how many characters the second encryption key decrypts. Subtract 8 from your total, and then the this value from what you get and you get how many characters your first encryption key decrypts.

After that, the first encryption key decrypts the other half of the code and the sequencer. From there, the sequencer tells the loader in what order to load things in : ).

That's what I want it to do, heh : P

How the Sequencer Base works is it'll have something like

01030204060508090710

This'll be one of the values in your huge array, it could be, w/e

Now, every 2 digits up there represents 1 digit, it can be changed to every one represents one or 3 or w/e, but 2 because it's doubtful someoe's ganna be loading less than 10 things and more than 99 things : P

So in reality, the above is

1 3 2 4 6 5 8 9 7 10

10 things being loaded

Now how this works is it'll keep running the loader trigger goign thru if statements

So set your loader = substring 1,2 (01)

After that, run the loader

Everything you load has a value on it. The loader will go thru a set of if statements to check when that value = loader

you just keep repeating until you've done them all, just like a loop ^)^

So, that's how I'm trying to get this code to work, and so far it's proving difficult : P

Here's my load atm.. yes, it's going to be split up into 2 diff triggers and it's going to change a lot ><

All of this is based on Acehart's beautiful system btw : D

Code:
Actions
    -------- Try to decode what was typed --------
    Set SaveLoad_UsePlayername = False
    Set base = basemax
    Set Code = (Substring((Entered chat string), 7, 8))
    Custom script:   set udg_Validate = SaveLoad_Decode( udg_Code )
    Set SaveLoad_UsePlayername = True
    Set base = (Integer(Code))
    Set Code = (Substring((Entered chat string), 9, (Length of (Entered chat string))))
    Custom script:   set udg_Validate = SaveLoad_Decode( udg_Code )
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            Validate Equal to False
        Then - Actions
            -------- Invalid code --------
            Game - Display to (Player group((Triggering player))) the text: There's some error ...
            Skip remaining actions
        Else - Actions
    -------- It worked, let's do something with it --------
    Unit Group - Pick every unit in (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
        Loop - Actions
            Unit - Remove (Picked unit) from the game
    Set TempInteger = SaveCount
    Set SaveCount = 1
    Player - Set (Triggering player) Current gold to Save[SaveCount]
    Set SaveCount = (SaveCount + 1)
    Player - Set (Triggering player) Current lumber to Save[SaveCount]
    Set SaveCount = (SaveCount + 1)
    Custom script:   set udg_TempUnitType = SaveLoad_Integer2Unit(udg_Save[udg_SaveCount])
    Unit - Create 1 TempUnitType for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
    Set SaveCount = (SaveCount + 1)
    Hero - Set (Last created unit) Hero-level to Save[SaveCount], Hide level-up graphics
    Set SaveCount = (SaveCount + 1)
    For each (Integer A) from 1 to Save[SaveCount], do (Actions)
        Loop - Actions
            Set SaveCount = (SaveCount + 1)
            Custom script:   set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
            Hero - Create TempItemType and give it to (Last created unit)
            Set SaveCount = (SaveCount + 1)
            Item - Set charges remaining in (Last created item) to Save[SaveCount]
    For each (Integer SaveCount) from (SaveCount + 1) to TempInteger, do (Actions)
        Loop - Actions
            For each (Integer A) from 1 to Save[(SaveCount + 1)], do (Actions)
                Loop - Actions
                    Custom script:   call SelectHeroSkill( GetLastCreatedUnit(), udg_SaveLoad_Abilities[ udg_Save[ udg_SaveCount ] ] )
            Set SaveCount = (SaveCount + 1)

So..

How should I go about doing this in code? The above didn't work out too well for decrypting when I had one random decryption and 1 set decryption ><

News:
Put in the sequencer : P
It went from semi-randomness to zamg o_O
As you get more info to save, it gets harder to crack cuz of the sequencer

Changed the 2 encryptions to 1 encryption, bleh, don't need 2 ><, lol
Now it's like
A = Sequencer
B = Randomer
S = Code

ABB-SSSS-SSSS-SSSS

Loading for the sequencer should be easy to figure out ^)^
 

Nestharus

o-o
Reaction score
84
a post on why sequencing + encryption is a better security measure thatn simply encryption alone

With pool of 10 different encryptions, you have 10 possible outcomes. If you include 10 different sequences as well, you suddenly have 100 possible outcomes when all info is stored. You can see this is extremely significant to security.

With Acehart's system and a base of 68 different characters, you can easily 68 different encryptions and
(sequences are limited by amount of info you are saving. I'm saving 7 pieces of info atm, so I can go up to 49 sequences)
68 sequences.

With Acehart's system atm, my set of 7 and 7 only adds 3 new characters. It'll probably stick with those 3 characters for 68*68*68
heh

So, in the end, if you want security features, you need to sequence your code differently and you need to randomize the encryption key. For security, you never have to change your encryption key or sequences in later versions. This large base will be sufficient to keep cheaters back ^)^

If they crack one sequence/encryption key combo, the minute they save again, they have to 100% recrack it or save over and over and over and over and over again in the hopes to get that same sequence/encryption key combo again. As you can see above, with a pool of 50 diff encryptions and 50 diff sequences, you get 2500 different combos. Say good luck to the cheaters as they might try 2500*2500*2500 times to get that same encryption key/sequencer combo again.

In short, you can't really crack the code on this system. If you do, you can never save again.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
> You can see this is extremely significant to security.

Can I?
Not really...

The entire en/decoder is still there.


Anyway, this does, indeed, add way more work to the trigger.
It doesn't add anything significant to "security".

How could it?
It's all in the map. In plain view.

And, after all, a code that says abcd-1234 isn't any less secure than a code that looks like a1b2-c3d4...


The original does a base 36 conversion and adds a player name check.
That's more than enough already.

You can't really guess anyway what code character is what actual value.
And, if you can, it works with an extra swapped character or two just the same.
 

Arkan

Nobody rides for free
Reaction score
92
I have used this code succesfully until recently when I got the error msg "Hit Op Limit in function SaveLoad_InitialSetup" when I try to load (saving works just fine it seems). Now I haven't changed anything in the core code so I guess it's because my code is too long, can I make the code longer somehow without reaching the op limit?

It seems
Code:
QqCj-GBD3-NlMG-9bFU-3wig-frX5-qKg1-Qp29-9rBT-jIVi-3KLl-1Pd7-XqzR-Rfnm-n0
is just a few letters too long (I know this, because if I save/load with 100gold/lumber instead of 1000000gold/lumber, it works), but I really need everything, is it impossible with this Save/Load code?

If it matters, the code stores: HeroId, HeroLevel, HeroStr, HeroAgi, HeroInt, 5 integers (values between 0 and 4), 2 integers (values between 0 and 300), 1 integer (value between 0 and 20), 3 integers (value between 0 and 1000000) 7 abilities and 6 items.

So yeah, can I somehow modify the core code so it doesn't reach the op limit?
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
> 5 integers (values between 0 and 4)

Make 1 from that.
value5 * 10000 + value4 * 1ooo + value3 * 100 + value2 * 10 + value1

> 2 integers (values between 0 and 300)

Same here.
value3 * 1000 + value1



Though... while 29 values sounds like rather long code, it doesn't sound line "op limit"...
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top