• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Save/Load System

Status
Not open for further replies.
Level 1
Joined
Apr 16, 2012
Messages
4
My Save and Load are disabled and I don't know what's wrong...

Here's Save Category :

HTML:
//***************************************************************************
//*
//*  Global Variables
//*
//***************************************************************************

globals
    // User-defined
    player                  udg_Instagator             = null
    timerdialog             udg_Timer                  = null
    timer                   udg_Survie                 = null
    string                  udg_Code
    force                   udg_Players                = null
    integer array           udg_Save
    integer                 udg_SaveCount              = 0
    integer array           udg_SaveLoad_Abilities
    integer                 udg_SaveLoad_Abilities_LastIndex = 0
    string                  udg_SaveLoad_Alphabet
    boolean                 udg_SaveLoad_CaseSensitive = false
    integer array           udg_SaveLoad_Compress
    integer array           udg_SaveLoad_Heroes
    integer                 udg_SaveLoad_Heroes_LastIndex = 0
    boolean                 udg_SaveLoad_Initialized   = false
    integer array           udg_SaveLoad_Items
    integer                 udg_SaveLoad_Items_LastIndex = 0
    integer array           udg_SaveLoad_Uncompress
    boolean                 udg_SaveLoad_UsePlayername = false
    integer array           udg_SaveLoadAbilitiesStored
    integer                 udg_SaveLoadBlockSize      = 0
    string array            udg_SaveLoadCharacterNumbers
    string                  udg_SaveLoadCharacterSet
    string array            udg_SaveLoadEncryptionSet
    boolean array           udg_SaveLoadHasLoaded
    integer array           udg_SaveLoadHeroesStored
    integer array           udg_SaveLoadItemsStored
    integer                 udg_SaveLoadMaxAbilitiesStored = 0
    integer                 udg_SaveLoadMaxCharacters  = 0
    integer                 udg_SaveLoadMaxEncryptionSets = 0
    integer                 udg_SaveLoadMaxHeroesStored = 0
    integer                 udg_SaveLoadMaxItemsStored = 0
    unit array              udg_SaveLoadPlayerHeroSingle
    integer                 udg_SaveLoadSlotsAbilities = 0
    integer                 udg_SaveLoadSlotsGold      = 0
    integer                 udg_SaveLoadSlotsHero      = 0
    integer                 udg_SaveLoadSlotsHeroLevel = 0
    integer                 udg_SaveLoadSlotsItem      = 0
    integer                 udg_SaveLoadSlotsLumber    = 0
    integer                 udg_SaveLoadSlotsStats     = 0
    integer array           udg_SaveLoadVariablesStored
    item                    udg_TempItem               = null
    integer                 udg_TempItemType           = 0
    unit                    udg_TempUnit               = null
    integer                 udg_TempUnitType           = 0
    group                   udg_UnitGroup              = null
    boolean                 udg_Validate               = false
    group                   udg_duelpeople             = null

    // Generated
    rect                    gg_rct_Attaque_zombie      = null
    rect                    gg_rct_Vague_2             = null
    rect                    gg_rct_Vague_3             = null
    rect                    gg_rct_Attaque_zombie_2    = null
    rect                    gg_rct_Ouest               = null
    rect                    gg_rct_Est                 = null
    rect                    gg_rct_Renfort             = null
    rect                    gg_rct_Maison_1            = null
    rect                    gg_rct_Maison_2            = null
    rect                    gg_rct_Entree_maison_1     = null
    rect                    gg_rct_Sortie_maison_1     = null
    rect                    gg_rct_Entree_maison_2     = null
    rect                    gg_rct_Sortie_maison_2     = null
    rect                    gg_rct_quitter_2           = null
    rect                    gg_rct_quitter_1           = null
    rect                    gg_rct_vague_forte         = null
    rect                    gg_rct_boss                = null
    rect                    gg_rct_Vague_mutant        = null
    rect                    gg_rct_Vague_mutant_2      = null
    rect                    gg_rct_Game_creator        = null
    rect                    gg_rct_Merci               = null
    rect                    gg_rct_renfort_1           = null
    rect                    gg_rct_renfort_2           = null
    rect                    gg_rct_renfort_3           = null
    rect                    gg_rct_renfort_4           = null
    rect                    gg_rct_renfort_5           = null
    rect                    gg_rct_Spawn_maison_est    = null
    rect                    gg_rct_Spawn_maison_ouest  = null
    rect                    gg_rct_CodeItems           = null
    rect                    gg_rct_Load_Heroes         = null
    camerasetup             gg_cam_Camera_001          = null
    string                  gg_snd_Tension
    string                  gg_snd_Drowning_Pool___01___Bodies
    trigger                 gg_trg_SaveLoadPreInizialization_Copy = null
    trigger                 gg_trg_SaveLoadRealInizialization_Copy = null
    trigger                 gg_trg_Save_Copy           = null
    trigger                 gg_trg_Load_Copy           = null
    trigger                 gg_trg_Activer             = null
    trigger                 gg_trg_Activer_Copier      = null
    trigger                 gg_trg_boss                = null
    trigger                 gg_trg_boss_Copier         = null
    trigger                 gg_trg_vague_forte_arrive  = null
    trigger                 gg_trg_vague_2_arrive      = null
    trigger                 gg_trg_vague_3_arrive      = null
    trigger                 gg_trg_Debut               = null
    trigger                 gg_trg_Objet_apparition    = null
    trigger                 gg_trg_tourelle            = null
    trigger                 gg_trg_Vague_zombie_sans_arret = null
    trigger                 gg_trg_Renfort             = null
    trigger                 gg_trg_Avant_poste_detruit = null
    trigger                 gg_trg_bois                = null
    trigger                 gg_trg_lal                 = null
    trigger                 gg_trg_texte_flottant      = null
    trigger                 gg_trg_meurt               = null
    trigger                 gg_trg_meurt_Copier        = null
    trigger                 gg_trg_meurt_Copier_2      = null
    trigger                 gg_trg_meurt_Copier_3      = null
    trigger                 gg_trg_meurt_Copier_4      = null
    trigger                 gg_trg_meurt_Copier_5      = null
    trigger                 gg_trg_meurt_Copier_6      = null
    trigger                 gg_trg_meurt_Copier_7      = null
    trigger                 gg_trg_meurt_Copier_8      = null
    trigger                 gg_trg_meurt_Copier_9      = null
    trigger                 gg_trg_chargeur_1          = null
    trigger                 gg_trg_attaque             = null
    trigger                 gg_trg_Quete_1             = null
    trigger                 gg_trg_Quete_3             = null
    trigger                 gg_trg_Quete_3_Copier      = null
    trigger                 gg_trg_mourir              = null
    trigger                 gg_trg_maison_1            = null
    trigger                 gg_trg_maison_2            = null
    trigger                 gg_trg_quitter_1           = null
    trigger                 gg_trg_quitter_2           = null
    trigger                 gg_trg_ally                = null
    trigger                 gg_trg_Declare_War_1       = null
    trigger                 gg_trg_Declare_War_1_Copier = null
    trigger                 gg_trg_Declare_War_1_Copier_2 = null
    trigger                 gg_trg_Declare_War_1_Copier_3 = null
    trigger                 gg_trg_Declare_War_1_Copier_4 = null
    trigger                 gg_trg_Declare_War_1_Copier_5 = null
    trigger                 gg_trg_Declare_War_1_Copier_6 = null
    trigger                 gg_trg_Declare_War_1_Copier_7 = null
    trigger                 gg_trg_Declare_War_1_Copier_8 = null
    trigger                 gg_trg_Declare_War_1_Copier_9 = null
    trigger                 gg_trg_Remove_Left_Players = null
    trigger                 gg_trg_Turn_On             = null
    trigger                 gg_trg_Turn_Off            = null
    trigger                 gg_trg_Survivants_gagnants = null
    trigger                 gg_trg_gagnes              = null
    trigger                 gg_trg_code                = null
    unit                    gg_unit_h000_0184          = null
    unit                    gg_unit_H002_0021          = null
    unit                    gg_unit_H002_0020          = null
    unit                    gg_unit_H002_0019          = null
    unit                    gg_unit_H002_0018          = null
    unit                    gg_unit_H002_0012          = null
    unit                    gg_unit_H002_0013          = null
    unit                    gg_unit_H002_0014          = null
    unit                    gg_unit_H002_0015          = null
    unit                    gg_unit_H002_0016          = null
    unit                    gg_unit_H002_0017          = null
    unit                    gg_unit_Eevi_0042          = null
endglobals

function InitGlobals takes nothing returns nothing
    local integer i = 0
    set udg_Survie = CreateTimer()
    set udg_Code = ""
    set udg_Players = CreateForce()
    set i = 0
    loop
        exitwhen (i > 1)
        set udg_Save[i] = 0
        set i = i + 1
    endloop

    set udg_SaveCount = 0
    set udg_SaveLoad_Abilities_LastIndex = 0
    set udg_SaveLoad_Alphabet = ""
    set udg_SaveLoad_CaseSensitive = false
    set i = 0
    loop
        exitwhen (i > 1)
        set udg_SaveLoad_Compress[i] = 0
        set i = i + 1
    endloop

    set udg_SaveLoad_Heroes_LastIndex = 0
    set udg_SaveLoad_Initialized = false
    set udg_SaveLoad_Items_LastIndex = 0
    set i = 0
    loop
        exitwhen (i > 1)
        set udg_SaveLoad_Uncompress[i] = 0
        set i = i + 1
    endloop

    set udg_SaveLoad_UsePlayername = false
    set udg_SaveLoadBlockSize = 0
    set i = 0
    loop
        exitwhen (i > 1)
        set udg_SaveLoadCharacterNumbers[i] = ""
        set i = i + 1
    endloop

    set udg_SaveLoadCharacterSet = ""
    set i = 0
    loop
        exitwhen (i > 1)
        set udg_SaveLoadEncryptionSet[i] = ""
        set i = i + 1
    endloop

    set i = 0
    loop
        exitwhen (i > 1)
        set udg_SaveLoadHasLoaded[i] = false
        set i = i + 1
    endloop

    set udg_SaveLoadMaxAbilitiesStored = 0
    set udg_SaveLoadMaxCharacters = 0
    set udg_SaveLoadMaxEncryptionSets = 0
    set udg_SaveLoadMaxHeroesStored = 0
    set udg_SaveLoadMaxItemsStored = 0
    set udg_SaveLoadSlotsAbilities = 0
    set udg_SaveLoadSlotsGold = 0
    set udg_SaveLoadSlotsHero = 0
    set udg_SaveLoadSlotsHeroLevel = 0
    set udg_SaveLoadSlotsItem = 0
    set udg_SaveLoadSlotsLumber = 0
    set udg_SaveLoadSlotsStats = 0
    set i = 0
    loop
        exitwhen (i > 1)
        set udg_SaveLoadVariablesStored[i] = 0
        set i = i + 1
    endloop

    set udg_UnitGroup = CreateGroup()
    set udg_Validate = false
    set udg_duelpeople = CreateGroup()
endfunction

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

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

function Trig_Save_Copy_Func007A takes nothing returns nothing
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_TempUnit = GetEnumUnit()
    set udg_Save[udg_SaveCount] = SaveLoad_Unit2Integer(udg_TempUnit)
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_Save[udg_SaveCount] = GetHeroXP(GetEnumUnit())
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_Save[udg_SaveCount] = R2I(GetLocationX(GetUnitLoc(GetEnumUnit())))
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_Save[udg_SaveCount] = R2I(GetLocationY(GetUnitLoc(GetEnumUnit())))
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_Save[udg_SaveCount] = UnitInventoryCount(GetEnumUnit())
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 6
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        if ( Trig_Save_Copy_Func007Func012Func001C() ) then
            set udg_SaveCount = ( udg_SaveCount + 1 )
            set udg_TempItem = UnitItemInSlotBJ(GetEnumUnit(), GetForLoopIndexA())
            set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )
            set udg_SaveCount = ( udg_SaveCount + 1 )
            set udg_Save[udg_SaveCount] = GetItemCharges(UnitItemInSlotBJ(GetEnumUnit(), GetForLoopIndexA()))
        else
        endif
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_Save[udg_SaveCount] = GetPlayerState(GetTriggerPlayer(), PLAYER_STATE_RESOURCE_LUMBER)
endfunction

function Trig_Save_Copy_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_UnitGroup = GetUnitsOfPlayerMatching(GetTriggerPlayer(), Condition(function Trig_Save_Copy_Func004002002))
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_Save[udg_SaveCount] = CountUnitsInGroup(udg_UnitGroup)
    call ForGroupBJ( udg_UnitGroup, function Trig_Save_Copy_Func007A )
    set udg_Code = SaveLoad_Encode()
    call QuestMessageBJ( GetForceOfPlayer(GetTriggerPlayer()), bj_QUESTMESSAGE_SECRET, "TRIGSTR_250" )
    call DisplayTimedTextToForce( GetForceOfPlayer(GetTriggerPlayer()), 300.00, udg_Code )
    call QuestMessageBJ( GetForceOfPlayer(GetTriggerPlayer()), bj_QUESTMESSAGE_SECRET, "TRIGSTR_251" )
endfunction

//===========================================================================
function InitTrig_Save_Copy takes nothing returns nothing
    set gg_trg_Save_Copy = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_Save_Copy, Player(0), "-save", true )
    call TriggerRegisterPlayerChatEvent( gg_trg_Save_Copy, Player(1), "-save", true )
    call TriggerRegisterPlayerChatEvent( gg_trg_Save_Copy, Player(2), "-save", true )
    call TriggerRegisterPlayerChatEvent( gg_trg_Save_Copy, Player(3), "-save", true )
    call TriggerRegisterPlayerChatEvent( gg_trg_Save_Copy, Player(4), "-save", false )
    call TriggerRegisterPlayerChatEvent( gg_trg_Save_Copy, Player(5), "-save", false )
    call TriggerRegisterPlayerChatEvent( gg_trg_Save_Copy, Player(6), "-save", false )
    call TriggerRegisterPlayerChatEvent( gg_trg_Save_Copy, Player(7), "-save", false )
    call TriggerRegisterPlayerChatEvent( gg_trg_Save_Copy, Player(8), "-save", false )
    call TriggerRegisterPlayerChatEvent( gg_trg_Save_Copy, Player(9), "-save", false )
    call TriggerRegisterPlayerChatEvent( gg_trg_Save_Copy, Player(10), "-save", false )
    call TriggerAddAction( gg_trg_Save_Copy, function Trig_Save_Copy_Actions )
endfunction

Problems :

HTML:
set udg_Save[udg_SaveCount] = SaveLoad_Unit2Integer(udg_TempUnit)
HTML:
set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )
HTML:
set udg_Code = SaveLoad_Encode()

Then Load Category :

HTML:
//***************************************************************************
//*
//*  Global Variables
//*
//***************************************************************************

globals
    // User-defined
    player                  udg_Instagator             = null
    timerdialog             udg_Timer                  = null
    timer                   udg_Survie                 = null
    string                  udg_Code
    force                   udg_Players                = null
    integer array           udg_Save
    integer                 udg_SaveCount              = 0
    integer array           udg_SaveLoad_Abilities
    integer                 udg_SaveLoad_Abilities_LastIndex = 0
    string                  udg_SaveLoad_Alphabet
    boolean                 udg_SaveLoad_CaseSensitive = false
    integer array           udg_SaveLoad_Compress
    integer array           udg_SaveLoad_Heroes
    integer                 udg_SaveLoad_Heroes_LastIndex = 0
    boolean                 udg_SaveLoad_Initialized   = false
    integer array           udg_SaveLoad_Items
    integer                 udg_SaveLoad_Items_LastIndex = 0
    integer array           udg_SaveLoad_Uncompress
    boolean                 udg_SaveLoad_UsePlayername = false
    integer array           udg_SaveLoadAbilitiesStored
    integer                 udg_SaveLoadBlockSize      = 0
    string array            udg_SaveLoadCharacterNumbers
    string                  udg_SaveLoadCharacterSet
    string array            udg_SaveLoadEncryptionSet
    boolean array           udg_SaveLoadHasLoaded
    integer array           udg_SaveLoadHeroesStored
    integer array           udg_SaveLoadItemsStored
    integer                 udg_SaveLoadMaxAbilitiesStored = 0
    integer                 udg_SaveLoadMaxCharacters  = 0
    integer                 udg_SaveLoadMaxEncryptionSets = 0
    integer                 udg_SaveLoadMaxHeroesStored = 0
    integer                 udg_SaveLoadMaxItemsStored = 0
    unit array              udg_SaveLoadPlayerHeroSingle
    integer                 udg_SaveLoadSlotsAbilities = 0
    integer                 udg_SaveLoadSlotsGold      = 0
    integer                 udg_SaveLoadSlotsHero      = 0
    integer                 udg_SaveLoadSlotsHeroLevel = 0
    integer                 udg_SaveLoadSlotsItem      = 0
    integer                 udg_SaveLoadSlotsLumber    = 0
    integer                 udg_SaveLoadSlotsStats     = 0
    integer array           udg_SaveLoadVariablesStored
    item                    udg_TempItem               = null
    integer                 udg_TempItemType           = 0
    unit                    udg_TempUnit               = null
    integer                 udg_TempUnitType           = 0
    group                   udg_UnitGroup              = null
    boolean                 udg_Validate               = false
    group                   udg_duelpeople             = null

    // Generated
    rect                    gg_rct_Attaque_zombie      = null
    rect                    gg_rct_Vague_2             = null
    rect                    gg_rct_Vague_3             = null
    rect                    gg_rct_Attaque_zombie_2    = null
    rect                    gg_rct_Ouest               = null
    rect                    gg_rct_Est                 = null
    rect                    gg_rct_Renfort             = null
    rect                    gg_rct_Maison_1            = null
    rect                    gg_rct_Maison_2            = null
    rect                    gg_rct_Entree_maison_1     = null
    rect                    gg_rct_Sortie_maison_1     = null
    rect                    gg_rct_Entree_maison_2     = null
    rect                    gg_rct_Sortie_maison_2     = null
    rect                    gg_rct_quitter_2           = null
    rect                    gg_rct_quitter_1           = null
    rect                    gg_rct_vague_forte         = null
    rect                    gg_rct_boss                = null
    rect                    gg_rct_Vague_mutant        = null
    rect                    gg_rct_Vague_mutant_2      = null
    rect                    gg_rct_Game_creator        = null
    rect                    gg_rct_Merci               = null
    rect                    gg_rct_renfort_1           = null
    rect                    gg_rct_renfort_2           = null
    rect                    gg_rct_renfort_3           = null
    rect                    gg_rct_renfort_4           = null
    rect                    gg_rct_renfort_5           = null
    rect                    gg_rct_Spawn_maison_est    = null
    rect                    gg_rct_Spawn_maison_ouest  = null
    rect                    gg_rct_CodeItems           = null
    rect                    gg_rct_Load_Heroes         = null
    camerasetup             gg_cam_Camera_001          = null
    string                  gg_snd_Tension
    string                  gg_snd_Drowning_Pool___01___Bodies
    trigger                 gg_trg_SaveLoadPreInizialization_Copy = null
    trigger                 gg_trg_SaveLoadRealInizialization_Copy = null
    trigger                 gg_trg_Save_Copy           = null
    trigger                 gg_trg_Load_Copy           = null
    trigger                 gg_trg_Activer             = null
    trigger                 gg_trg_Activer_Copier      = null
    trigger                 gg_trg_boss                = null
    trigger                 gg_trg_boss_Copier         = null
    trigger                 gg_trg_vague_forte_arrive  = null
    trigger                 gg_trg_vague_2_arrive      = null
    trigger                 gg_trg_vague_3_arrive      = null
    trigger                 gg_trg_Debut               = null
    trigger                 gg_trg_Objet_apparition    = null
    trigger                 gg_trg_tourelle            = null
    trigger                 gg_trg_Vague_zombie_sans_arret = null
    trigger                 gg_trg_Renfort             = null
    trigger                 gg_trg_Avant_poste_detruit = null
    trigger                 gg_trg_bois                = null
    trigger                 gg_trg_lal                 = null
    trigger                 gg_trg_texte_flottant      = null
    trigger                 gg_trg_meurt               = null
    trigger                 gg_trg_meurt_Copier        = null
    trigger                 gg_trg_meurt_Copier_2      = null
    trigger                 gg_trg_meurt_Copier_3      = null
    trigger                 gg_trg_meurt_Copier_4      = null
    trigger                 gg_trg_meurt_Copier_5      = null
    trigger                 gg_trg_meurt_Copier_6      = null
    trigger                 gg_trg_meurt_Copier_7      = null
    trigger                 gg_trg_meurt_Copier_8      = null
    trigger                 gg_trg_meurt_Copier_9      = null
    trigger                 gg_trg_chargeur_1          = null
    trigger                 gg_trg_attaque             = null
    trigger                 gg_trg_Quete_1             = null
    trigger                 gg_trg_Quete_3             = null
    trigger                 gg_trg_Quete_3_Copier      = null
    trigger                 gg_trg_mourir              = null
    trigger                 gg_trg_maison_1            = null
    trigger                 gg_trg_maison_2            = null
    trigger                 gg_trg_quitter_1           = null
    trigger                 gg_trg_quitter_2           = null
    trigger                 gg_trg_ally                = null
    trigger                 gg_trg_Declare_War_1       = null
    trigger                 gg_trg_Declare_War_1_Copier = null
    trigger                 gg_trg_Declare_War_1_Copier_2 = null
    trigger                 gg_trg_Declare_War_1_Copier_3 = null
    trigger                 gg_trg_Declare_War_1_Copier_4 = null
    trigger                 gg_trg_Declare_War_1_Copier_5 = null
    trigger                 gg_trg_Declare_War_1_Copier_6 = null
    trigger                 gg_trg_Declare_War_1_Copier_7 = null
    trigger                 gg_trg_Declare_War_1_Copier_8 = null
    trigger                 gg_trg_Declare_War_1_Copier_9 = null
    trigger                 gg_trg_Remove_Left_Players = null
    trigger                 gg_trg_Turn_On             = null
    trigger                 gg_trg_Turn_Off            = null
    trigger                 gg_trg_Survivants_gagnants = null
    trigger                 gg_trg_gagnes              = null
    trigger                 gg_trg_code                = null
    unit                    gg_unit_h000_0184          = null
    unit                    gg_unit_H002_0021          = null
    unit                    gg_unit_H002_0020          = null
    unit                    gg_unit_H002_0019          = null
    unit                    gg_unit_H002_0018          = null
    unit                    gg_unit_H002_0012          = null
    unit                    gg_unit_H002_0013          = null
    unit                    gg_unit_H002_0014          = null
    unit                    gg_unit_H002_0015          = null
    unit                    gg_unit_H002_0016          = null
    unit                    gg_unit_H002_0017          = null
    unit                    gg_unit_Eevi_0042          = null
endglobals

function InitGlobals takes nothing returns nothing
    local integer i = 0
    set udg_Survie = CreateTimer()
    set udg_Code = ""
    set udg_Players = CreateForce()
    set i = 0
    loop
        exitwhen (i > 1)
        set udg_Save[i] = 0
        set i = i + 1
    endloop

    set udg_SaveCount = 0
    set udg_SaveLoad_Abilities_LastIndex = 0
    set udg_SaveLoad_Alphabet = ""
    set udg_SaveLoad_CaseSensitive = false
    set i = 0
    loop
        exitwhen (i > 1)
        set udg_SaveLoad_Compress[i] = 0
        set i = i + 1
    endloop

    set udg_SaveLoad_Heroes_LastIndex = 0
    set udg_SaveLoad_Initialized = false
    set udg_SaveLoad_Items_LastIndex = 0
    set i = 0
    loop
        exitwhen (i > 1)
        set udg_SaveLoad_Uncompress[i] = 0
        set i = i + 1
    endloop

    set udg_SaveLoad_UsePlayername = false
    set udg_SaveLoadBlockSize = 0
    set i = 0
    loop
        exitwhen (i > 1)
        set udg_SaveLoadCharacterNumbers[i] = ""
        set i = i + 1
    endloop

    set udg_SaveLoadCharacterSet = ""
    set i = 0
    loop
        exitwhen (i > 1)
        set udg_SaveLoadEncryptionSet[i] = ""
        set i = i + 1
    endloop

    set i = 0
    loop
        exitwhen (i > 1)
        set udg_SaveLoadHasLoaded[i] = false
        set i = i + 1
    endloop

    set udg_SaveLoadMaxAbilitiesStored = 0
    set udg_SaveLoadMaxCharacters = 0
    set udg_SaveLoadMaxEncryptionSets = 0
    set udg_SaveLoadMaxHeroesStored = 0
    set udg_SaveLoadMaxItemsStored = 0
    set udg_SaveLoadSlotsAbilities = 0
    set udg_SaveLoadSlotsGold = 0
    set udg_SaveLoadSlotsHero = 0
    set udg_SaveLoadSlotsHeroLevel = 0
    set udg_SaveLoadSlotsItem = 0
    set udg_SaveLoadSlotsLumber = 0
    set udg_SaveLoadSlotsStats = 0
    set i = 0
    loop
        exitwhen (i > 1)
        set udg_SaveLoadVariablesStored[i] = 0
        set i = i + 1
    endloop

    set udg_UnitGroup = CreateGroup()
    set udg_Validate = false
    set udg_duelpeople = CreateGroup()
endfunction

function Trig_Load_Copy_Conditions takes nothing returns boolean
    if ( not ( udg_SaveLoadHasLoaded[GetConvertedPlayerId(GetTriggerPlayer())] == false ) ) then
        return false
    endif
    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_Load_Copy_Func004C takes nothing returns boolean
    if ( not ( udg_Validate == false ) ) then
        return false
    endif
    return true
endfunction

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

function Trig_Load_Copy_Actions takes nothing returns nothing
    set udg_Code = SubStringBJ(GetEventPlayerChatString(), 7, StringLength(GetEventPlayerChatString()))
    set udg_Validate = SaveLoad_Decode( udg_Code )
    if ( Trig_Load_Copy_Func004C() ) then
        call DisplayTextToForce( GetForceOfPlayer(GetTriggerPlayer()), "TRIGSTR_252" )
        return
    else
    endif
    call ForGroupBJ( GetUnitsOfPlayerAll(GetTriggerPlayer()), function Trig_Load_Copy_Func005A )
    set udg_SaveLoadHasLoaded[GetConvertedPlayerId(GetTriggerPlayer())] = true
    set udg_SaveCount = 1
    call SetPlayerStateBJ( GetTriggerPlayer(), PLAYER_STATE_RESOURCE_GOLD, udg_Save[udg_SaveCount] )
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set bj_forLoopBIndex = 1
    set bj_forLoopBIndexEnd = udg_Save[udg_SaveCount]
    loop
        exitwhen bj_forLoopBIndex > bj_forLoopBIndexEnd
        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 udg_SaveLoadPlayerHeroSingle[GetConvertedPlayerId(GetTriggerPlayer())] = GetLastCreatedUnit()
        call GroupAddUnitSimple( GetLastCreatedUnit(), udg_duelpeople )
        call ForceAddPlayerSimple( GetOwningPlayer(GetTriggerUnit()), udg_Players )
        call UnitAddAbilityBJ( udg_SaveLoadAbilitiesStored[udg_Save[udg_SaveCount]], GetLastCreatedUnit() )
        set udg_SaveCount = ( udg_SaveCount + 1 )
        call SetHeroXP( GetLastCreatedUnit(), udg_Save[udg_SaveCount], false )
        set udg_SaveCount = ( udg_SaveCount + 1 )
        call SetUnitPositionLoc( GetLastCreatedUnit(), GetRectCenter(gg_rct_Load_Heroes) )
        set udg_SaveCount = ( udg_SaveCount + 1 )
        set udg_SaveCount = ( udg_SaveCount + 1 )
        set bj_forLoopAIndex = 1
        set bj_forLoopAIndexEnd = udg_Save[udg_SaveCount]
        loop
            exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
            set udg_SaveCount = ( udg_SaveCount + 1 )
            set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
            call UnitAddItemByIdSwapped( udg_TempItemType, GetLastCreatedUnit() )
            set udg_SaveCount = ( udg_SaveCount + 1 )
            call SetItemCharges( GetLastCreatedItem(), udg_Save[udg_SaveCount] )
            set bj_forLoopAIndex = bj_forLoopAIndex + 1
        endloop
        set udg_SaveCount = ( udg_SaveCount + 1 )
        set bj_forLoopBIndex = bj_forLoopBIndex + 1
    endloop
endfunction

//===========================================================================
function InitTrig_Load_Copy takes nothing returns nothing
    set gg_trg_Load_Copy = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_Load_Copy, Player(0), "-load ", false )
    call TriggerRegisterPlayerChatEvent( gg_trg_Load_Copy, Player(1), "-load ", false )
    call TriggerRegisterPlayerChatEvent( gg_trg_Load_Copy, Player(2), "-load ", false )
    call TriggerRegisterPlayerChatEvent( gg_trg_Load_Copy, Player(3), "-load ", false )
    call TriggerRegisterPlayerChatEvent( gg_trg_Load_Copy, Player(4), "-load ", false )
    call TriggerRegisterPlayerChatEvent( gg_trg_Load_Copy, Player(5), "-load ", false )
    call TriggerRegisterPlayerChatEvent( gg_trg_Load_Copy, Player(6), "-load ", false )
    call TriggerRegisterPlayerChatEvent( gg_trg_Load_Copy, Player(7), "-load ", false )
    call TriggerRegisterPlayerChatEvent( gg_trg_Load_Copy, Player(8), "-load ", false )
    call TriggerRegisterPlayerChatEvent( gg_trg_Load_Copy, Player(9), "-load ", false )
    call TriggerRegisterPlayerChatEvent( gg_trg_Load_Copy, Player(10), "-load ", false )
    call TriggerAddCondition( gg_trg_Load_Copy, Condition( function Trig_Load_Copy_Conditions ) )
    call TriggerAddAction( gg_trg_Load_Copy, function Trig_Load_Copy_Actions )
endfunction

Problems :

HTML:
set udg_Validate = SaveLoad_Decode( udg_Code )
HTML:
set udg_TempUnitType = SaveLoad_Integer2Unit(udg_Save[udg_SaveCount])
HTML:
set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])

If someone can help me... :wink:
 
Level 4
Joined
Aug 5, 2011
Messages
99
im guessing thats acehart's saveload? try using
  • [ /trigger] tags next time ^^
  • the part that isnt working refers to functions that arent there in ur map
  • go to the map where you got the code from, double click the map name in trigger editor and copy all the code u see there to ur own map
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
im guessing thats acehart's saveload? try using
  • [ /trigger] tags next time ^^[/QUOTE]
  • No it's not, and don't you mean [code=jass][ /JASS] tags?
  • [quote="helekiller, post: 2134166"]
  • the part that isnt working refers to functions that arent there in ur map
  • go to the map where you got the code from, double click the map name in trigger editor and copy all the code u see there to ur own map[/QUOTE]
  • Actually, he pasted the map header code which is converted GUI triggers in Jass form. That's the reason you see all these Func004002002 etc...
  • That's basically converted GUI to Jass. Which will be shown when a GUI trigger is not working due to either syntax errors or calling non-existing functions etc...
  • (You're right here, I didn't read everything you said xD)
  • @Jack_Avenger:
  • Could you please post the actual GUI triggers in [trigger][ /trigger] tags, or at least paste the map header code in [code=jass][ /jass] tags.
  • Ow and erm, there are no syntax errors in these lines that you state as "problem". The functions being called simply do not exist.
  • Post the rest so that we can help you out?
  • If there is no rest, obviously you must've done something wrong when importing this system into your map.
  • Do as helekiller suggested.
  • p.s. buy a beard and grow a monocle
 
Last edited:
Sure looks like Acehart's to me
JASS:
    set udg_Save[udg_SaveCount] = SaveLoad_Unit2Integer(udg_TempUnit)
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_Save[udg_SaveCount] = GetHeroXP(GetEnumUnit())
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_Save[udg_SaveCount] = R2I(GetLocationX(GetUnitLoc(GetEnumUnit())))
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_Save[udg_SaveCount] = R2I(GetLocationY(GetUnitLoc(GetEnumUnit())))
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_Save[udg_SaveCount] = UnitInventoryCount(GetEnumUnit())
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
its aceharts, except the guy copy and pasted his error script rather than the triggers. anyway post the triggers not what you posted, cuz thats hell to read.

@hasijje > wtf is this

"p.s. buy a beard and grow a monocle"
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
@hasijje > wtf is this

"p.s. buy a beard and grow a monocle"

Sorry, I was in a strange mood yesterday :S
I kinda failed big time... I shouldn't have posted.

48016038001251871090510.jpg
 
Level 1
Joined
Apr 16, 2012
Messages
4
Hi everyone, thank you for helping me and yes it is a Save Load System of Aceharts!

  • Copy SaveLoadPreInizialization
    • Events
      • Time - Elapsed game time is 0.10 seconds
    • Conditions
    • Actions
      • Set SaveLoadCharacterSet 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ # = - @
      • Set SaveLoadMaxCharacters = 5
      • Set SaveLoadEncryptionSet [1] =-ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 # @
      • Set SaveLoadEncryptionSet [2] = @ GHIJKLM NOPQR # STUVWX-YZ0123456789ABCDEF
      • Set SaveLoadEncryptionSet [3] = # @ ABCDE-FPQRSTUVWXYZ012345GHIJKLMNO6789
      • Set SaveLoadEncryptionSet [4] = @ # ASTUVWX-YBCJKLMNOPQRZ01234DFEGHI56789
      • Set SaveLoadEncryptionSet [5] = # @-HIJKLABCDEV WXYZ0123FGM4567NOPQRSTU89
      • Set SaveLoadMaxEncryptionSets = 5
      • For each (Integer A) from 1 to SaveLoadMaxCharacters, do (Actions)
        • Loop - Actions
          • Set SaveLoadCharacterNumbers [((Integer A) - 1)] = (Substring (SaveLoadCharacterSet, (Integer A), (Integer A)))
          • Set SaveLoadSlotsHeroLevel = 2
      • Set SaveLoadHeroesStored [1] = Paladin
      • Set SaveLoadHeroesStored [2] = Archmage
      • Set SaveLoadHeroesStored [3] = King of the Mountain
      • Set SaveLoadHeroesStored [4] = Bloodmage
      • Set SaveLoadHeroesStored [5] = Master-Blade
      • Set SaveLoadHeroesStored [6] = Prophet
      • Set SaveLoadHeroesStored [7] = Tauren Chef
      • Set SaveLoadHeroesStored [8] = Shadow Hunter
      • Set SaveLoadHeroesStored [9] = Death Knight
      • Set SaveLoadHeroesStored [10] = Lich
      • Set SaveLoadHeroesStored [11] = Lord of terror
      • Set SaveLoadHeroesStored [12] = Lord of the crypts
      • Set SaveLoadHeroesStored [13] = Keeper of the Grove
      • Set SaveLoadHeroesStored [14] = Priestess of the Moon
      • Set SaveLoadHeroesStored [15] = Demon Hunter
      • Set SaveLoadHeroesStored [16] = Guardian
      • Set SaveLoadMaxHeroesStored = 16
      • Set SaveLoadSlotsHero = 2
      • Set SaveLoadItemsStored [1] = Meat
      • Set SaveLoadItemsStored [2] = Clip
      • Set SaveLoadItemsStored [3] = Prototype Gun
      • Set SaveLoadItemsStored [4] =
      • Set SaveLoadItemsStored [5] = Sentry gun
      • Set SaveLoadItemsStored [6] = (Item-type of (Last created item))
      • Set SaveLoadItemsStored [7] = (Item-type of (Last created item))
      • Set SaveLoadItemsStored [8] = (Item-type of (Last created item))
      • Set SaveLoadItemsStored [9] = Water
      • Set SaveLoadItemsStored [10] = Volume of force
      • Set SaveLoadItemsStored [11] = Tome of Agility
      • Set SaveLoadItemsStored [12] = Volume of intelligence
      • Set SaveLoadItemsStored [13] = Value
      • Set SaveLoadItemsStored [14] = Value
      • Set SaveLoadItemsStored [15] = Value
      • Set SaveLoadItemsStored [16] = Value
      • Set SaveLoadItemsStored [17] = Value
      • Set SaveLoadItemsStored [18] = Value
      • Set SaveLoadItemsStored [19] = Value
      • Set SaveLoadItemsStored [20] = Value
      • Set SaveLoadItemsStored [21] = Value
      • Set SaveLoadItemsStored [22] = Value
      • Set SaveLoadItemsStored [33] = Value
      • Set SaveLoadItemsStored [34] = Value
      • Set SaveLoadItemsStored [33] = Value
      • Set SaveLoadItemsStored [33] = Value
      • Set SaveLoadMaxItemsStored = 31
      • Set SaveLoadSlotsItem = 2
      • Set SaveLoadMaxAbilitiesStored = 17
      • Set SaveLoadSlotsAbilities = 2
      • Set SaveLoadSlotsGold = 4
      • Set SaveLoadSlotsStats = 2
      • Set SaveLoadSlotsLumber = 4
      • Set SaveLoadBlockSize = 4
      • Set SaveLoadVariablesStored [1] = SaveLoadSlotsHero
      • Set SaveLoadVariablesStored [2] = SaveLoadSlotsHeroLevel
      • Set SaveLoadVariablesStored [3] = SaveLoadSlotsItem
      • Set SaveLoadVariablesStored [4] = SaveLoadSlotsItem
      • Set SaveLoadVariablesStored [5] = SaveLoadSlotsItem
      • Set SaveLoadVariablesStored [6] = SaveLoadSlotsItem
      • Set SaveLoadVariablesStored [7] = SaveLoadSlotsItem
      • Set SaveLoadVariablesStored [8] = SaveLoadSlotsItem
      • Set SaveLoadVariablesStored [9] = SaveLoadSlotsGold
      • Set SaveLoadVariablesStored [10] = SaveLoadSlotsLumber
      • For each (Integer A) from 1 to 11, do (Actions)
        • Loop - Actions
          • Set SaveLoadHasLoaded [(Integer A)] = FALSE
  • Copy SaveLoadRealInizialization
    • Events
      • Time - Elapsed game time is 0.20 seconds
    • Conditions
    • Actions
      • For each (Integer A) from 1 to SaveLoadMaxHeroesStored, do (Actions)
        • Loop - Actions
          • Set SaveLoad_Heroes [(Integer A)] = SaveLoadHeroesStored [(Integer A)]
      • Set SaveLoad_Heroes_LastIndex = SaveLoadMaxHeroesStored
      • For each (Integer A) from 1 to SaveLoadMaxItemsStored, do (Actions)
        • Loop - Actions
          • Set SaveLoad_Items [(Integer A)] = SaveLoadItemsStored [(Integer A)]
      • Set SaveLoad_Items_LastIndex = SaveLoadMaxItemsStored
      • For each (Integer A) from 1 to SaveLoadMaxAbilitiesStored, do (Actions)
        • Loop - Actions
          • Set SaveLoad_Abilities [(Integer A)] = SaveLoadAbilitiesStored [(Integer A)]
      • Set SaveLoad_Abilities_LastIndex = SaveLoadMaxAbilitiesStored
      • Set SaveLoad_Alphabet ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 # = - @
      • Set SaveLoad_CaseSensitive = FALSE
      • Set SaveLoad_UsePlayername = TRUE
      • Set SaveLoad_Initialized = FALSE
      • Set Code = AceHart
      • Set Save [1] = 0
      • Set SaveCount = 1
      • Set Validate = FALSE
      • Set SaveLoad_Compress [1] = 0
      • Set SaveLoad_Uncompress [1] = 0
  • Save Copy
    • Events
      • Player - Player 1 (Red) types a chat message containing -save as result equivalent
      • Player - Player 2 (Blue) types a chat message containing -save as result equivalent
      • Player - Player 3 (Yellow) types a chat message containing -save as result equivalent
      • Player - Player 4 (Purple) types a chat message containing -save as result equivalent
      • Player - Player 5 (Yellow) types a chat message containing -save as a substring
      • Player - Player 6 (Orange) types a chat message containing -save as a substring
      • Player - Player 7 (Green) types a chat message containing -save as a substring
      • Player - Player 8 (Pink) types a chat message containing -save as a substring
      • Player - Player 9 (Gray) types a chat message-Containing save as a substring
      • Player - Player 10 (Light Blue) types a chat message containing -save as a substring
      • Player - Player 11 (Dark Green) types a chat message containing -save as a substring
    • Conditions
    • Actions
      • Set SaveCount = 0
      • Set SaveCount = (SaveCount + 1)
      • Set Save [SaveCount] = ((Triggering player) Current 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)
      • Group unit - Pick Every Unit in UnitGroup and do (Actions)
        • Loop - Actions
          • Set SaveCount = (SaveCount + 1)
          • Set TempUnit = (Picked unit)
          • Custom script: set udg_Save [udg_SaveCount] = SaveLoad_Unit2Integer (udg_TempUnit)
          • Set SaveCount = (SaveCount + 1)
          • Set Save [SaveCount] = (Hero experience of (Picked unit))
          • 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)))))
          • Set SaveCount = (SaveCount + 1)
          • Set Save [SaveCount] = (Number of items Carried by (Picked unit))
          • 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
                  • 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)
                  • Set SaveCount = (SaveCount + 1)
                  • Set Save [SaveCount] = (Remaining Charges in (Item Carried by (Picked unit) in slot (Integer A)))
                • Otherwise - Actions
          • Set SaveCount = (SaveCount + 1)
          • Set Save [SaveCount] = ((Triggering player) Current Wood)
      • Custom script: set udg_Code SaveLoad_Encode = ()
      • Quest - Display to (Player group ((Triggering player))) the Secret message: Your code:
      • Part - Display to (Player group ((Triggering player))) for 300.00 seconds the text: Code
  • Load Copy
    • 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 (Yellow) types a chat message containing -load as A substring
      • Player - Player 4 (Purple) types a chat message containing -load as A substring
      • Player - Player 5 (Yellow) types a chat message containing -load as A substring
      • Player - Player 6 (Orange) types a chat message containing -load as A substring
      • Player - Player 7 (Green) types a chat message containing -load as A substring
      • Player - Player 8 (Pink) types a chat message containing -load as A substring
      • Player - Player 9 (Gray) types a chat message containing -load as A substring
      • Player - Player 10 (Light Blue) types a chat message containing -load as A substring
      • Player - Player 11 (Dark Green) types a chat message containing -load as A substring
    • Conditions
      • SaveLoadHasLoaded [(Player number of (Triggering player))] Equal to FALSE
      • (Substring ((Entered chat string), 1, 6)) Equal to (Matched chat string)
      • (Length of (Entered chat string)) More than 6
    • Actions
      • 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
          • Part - Display to (Player group ((Triggering player))) the text: There are some err ...
          • Skip Remaining Actions
        • Otherwise - Actions
      • Group unit - Pick Every unit in (Units owned by (Triggering player)) and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
      • Set SaveLoadHasLoaded [(Player number of (Triggering player))] = TRUE
      • Set SaveCount = 1
      • Player - Set (Triggering player) Current gold to Save [SaveCount]
      • Set SaveCount = (SaveCount + 1)
      • For each (Integer B) from 1 to Save [SaveCount], do (Actions)
        • Loop - Actions
          • 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 orientation degrees
          • Set SaveLoadPlayerHeroSingle [(Player number of (Triggering player))] = (Last created unit)
          • Group unit - Add (Last created unit) to duelpeople
          • Player Group - Add (Owner of (Triggering unit)) to Players
          • Unit - Add SaveLoadAbilitiesStored [Save [SaveCount]] to (Last created unit)
          • Set SaveCount = (SaveCount + 1)
          • Hero - Set (Last created unit) experience to Save [SaveCount], Hide level-up graphics
          • Set SaveCount = (SaveCount + 1)
          • Unit - Move (Last created unit) Instantly to (Center of Load <gen> Heroes)
          • Set SaveCount = (SaveCount + 1)
          • 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)
              • Purpose - Set Remaining loads in (Last created item) to Save [SaveCount]
          • Set SaveCount = (SaveCount + 1)
I remind that the Save Copy and Load Copy are disabled :vw_sad:
 
Level 4
Joined
Aug 5, 2011
Messages
99
he cant enable them cuz he has errors for using function that he doesnt have... so as i said in the first post, copy and paste this code in ur own map (double click on ur map name in trigger editor)

JASS:
function SaveLoad_InitialSetup takes nothing returns nothing
    local integer i = 0
    local integer j = 0

    loop
        set udg_SaveLoad_Compress[i + 48] = j
        set udg_SaveLoad_Uncompress[i] = i + 48
        set j = j + 1
        set i = i + 1
        exitwhen i >= 10
    endloop
    set i = 0
    loop
        set udg_SaveLoad_Compress[i + 97] = j
        set udg_SaveLoad_Compress[i + 65] = j + 26
        set udg_SaveLoad_Uncompress[i + 10] = i + 97
        set udg_SaveLoad_Uncompress[i + 26 + 10] = i + 65
        set j = j + 1
        set i = i + 1
        exitwhen i >= 26
    endloop
endfunction

function SaveLoad_Id2CId takes integer n returns integer
    local integer i = n / (256 * 256 * 256)
    local integer r
    set n = n - i * (256 * 256 * 256)
    set r = udg_SaveLoad_Compress[i]
    set i = n / (256 * 256)
    set n = n - i * (256 * 256)
    set r = r * 64 + udg_SaveLoad_Compress[i]
    set i = n / 256
    set r = r * 64 + udg_SaveLoad_Compress[i]
    return r * 64 + udg_SaveLoad_Compress[n - i * 256]
endfunction

function SaveLoad_CId2Id takes integer n returns integer
    local integer i = n / (64 * 64 * 64)
    local integer r
    set n = n - i * (64 * 64 * 64)
    set r = udg_SaveLoad_Uncompress[i]
    set i = n / (64 * 64)
    set n = n - i * (64 * 64)
    set r = r * 256 + udg_SaveLoad_Uncompress[i]
    set i = n / 64
    set r = r * 256 + udg_SaveLoad_Uncompress[i]
    return r * 256 + udg_SaveLoad_Uncompress[n - i * 64]
endfunction

function SaveLoad_Unit2Integer takes unit u returns integer
    local integer i = 0
    local integer n = GetUnitTypeId(u)
    if udg_SaveLoad_Initialized == false then
        set udg_SaveLoad_Initialized = true
        call SaveLoad_InitialSetup()
    endif
    loop
        set i = i + 1
        exitwhen i > udg_SaveLoad_Heroes_LastIndex
        if udg_SaveLoad_Heroes[i] == n then
            return i
        endif
    endloop
    return SaveLoad_Id2CId(n)
endfunction
function SaveLoad_Integer2Unit takes integer i returns integer
    if udg_SaveLoad_Initialized == false then
        set udg_SaveLoad_Initialized = true
        call SaveLoad_InitialSetup()
    endif
    if i <= udg_SaveLoad_Heroes_LastIndex then
        return udg_SaveLoad_Heroes[i]
    endif
    return SaveLoad_CId2Id(i)
endfunction

function SaveLoad_Item2Integer takes item t returns integer
    local integer i = 0
    local integer n = GetItemTypeId(t)
    if udg_SaveLoad_Initialized == false then
        set udg_SaveLoad_Initialized = true
        call SaveLoad_InitialSetup()
    endif
    loop
        set i = i + 1
        exitwhen i > udg_SaveLoad_Items_LastIndex
        if udg_SaveLoad_Items[i] == n then
            return i
        endif
    endloop
    return SaveLoad_Id2CId(n)
endfunction
function SaveLoad_Integer2Item takes integer i returns integer
    if udg_SaveLoad_Initialized == false then
        set udg_SaveLoad_Initialized = true
        call SaveLoad_InitialSetup()
    endif
    if i <= udg_SaveLoad_Items_LastIndex then
        return udg_SaveLoad_Items[i]
    endif
    return SaveLoad_CId2Id(i)
endfunction

function SaveLoad_Ability2Integer takes integer a returns integer
    local integer i = 0
    if udg_SaveLoad_Initialized == false then
        set udg_SaveLoad_Initialized = true
        call SaveLoad_InitialSetup()
    endif
    loop
        set i = i + 1
        exitwhen i > udg_SaveLoad_Abilities_LastIndex
        if udg_SaveLoad_Abilities[i] == a then
            return i
        endif
    endloop
    return SaveLoad_Id2CId(a)
endfunction
function SaveLoad_Integer2Ability takes integer i returns integer
    if udg_SaveLoad_Initialized == false then
        set udg_SaveLoad_Initialized = true
        call SaveLoad_InitialSetup()
    endif
    if i <= udg_SaveLoad_Abilities_LastIndex then
        return udg_SaveLoad_Abilities[i]
    endif
    return SaveLoad_CId2Id(i)
endfunction

function SaveLoad_Color takes string s returns string
    local integer i = StringLength(s)
    local string c
    local string r = ""

    loop
        set i = i - 1
        set c = SubString(s,i,i + 1)
        if c == "0" or c == "1" or c == "2" or c == "3" or c == "4" or c == "5" or c == "6" or c == "7" or c == "8" or c == "9" then
            set r = "|cffffcc00" + c + "|r" + r
        elseif c == "-" then
            set r = "|cffdddddd-|r" + r
        else
            set r = c + r
        endif
        exitwhen i <= 0
    endloop
    return r
endfunction

function SaveLoad_EncodeChar takes string n returns integer
    local integer i = 0
    local string s1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    local string s2 = "abcdefghijklmnopqrstuvwxyz"
    local string s3 = "0123456789"

    loop
        if SubString(s1,i,i + 1) == n then
            return i
        endif
        if SubString(s2,i,i + 1) == n then
            return i
        endif
        set i = i + 1
        exitwhen i >= 26
    endloop
    set i = 0
    loop
        if SubString(s3,i,i + 1) == n then
            return i
        endif
        set i = i + 1
        exitwhen i >= 10
    endloop
    return 0
endfunction

function SaveLoad_EncodeVerify takes string buffer returns integer
    local integer i = 0
    local integer j = 0
    local string name = GetPlayerName(GetTriggerPlayer())
    if udg_SaveLoad_UsePlayername == true then
        loop
            set j = j + SaveLoad_EncodeChar(SubString(name,i,i + 1))
            set i = i + 1
            exitwhen i >= StringLength(name)
        endloop
    endif
    set i = 0
    loop
        set j = j + SaveLoad_EncodeChar(SubString(buffer,i,i + 1))
        set i = i + 1
        exitwhen i >= StringLength(buffer)
    endloop
    return j
endfunction

function SaveLoad_EncodeValues takes nothing returns string
    local integer i
    local integer j
    local integer k
    local integer l
    local integer m
    local integer CodeLength = StringLength(udg_SaveLoad_Alphabet)
    local integer array a
    local string buffer = ""
    local string c = ""
    local integer skip = 0
    local integer CONST = 1000000
    local string abc = "0123456789"

    set i = 0
    loop
        set i = i + 1
        exitwhen i > udg_SaveCount
        set buffer = buffer + I2S(udg_Save[i]) + "-"
    endloop
    set buffer = buffer + I2S(SaveLoad_EncodeVerify(buffer))
    if udg_Save[1] == 0 then
        set buffer = "-" + buffer
    endif

    set i = 0
    loop
        set a[i] = 0
        set i = i + 1
        exitwhen i >= 100
    endloop

    set m = 0
    set i = 0
    loop
        set j = 0
        loop
            set a[j] = a[j] * 11
            set j = j + 1
            exitwhen j > m
        endloop

        set l = 0
        set c = SubString(buffer,i,i + 1)
        loop
            exitwhen SubString(abc,l,l + 1) == c
            set l = l + 1
            exitwhen l > 9
        endloop
        set a[0] = a[0] + l

        set j = 0
        loop
            set k = a[j] / CONST
            set a[j] = a[j] - k * CONST
            set a[j + 1] = a[j + 1] + k
            set j = j + 1
            exitwhen j > m
        endloop
        if k > 0 then
            set m = m + 1
        endif
        set i = i + 1
        exitwhen i >= StringLength(buffer)
    endloop

    set buffer = ""
    loop
        exitwhen m < 0
        set j = m
        loop
            exitwhen j <= 0
            set k = a[j] / CodeLength
            set a[j - 1] = a[j - 1] + (a[j] - k * CodeLength) * CONST
            set a[j] = k
            set j = j - 1
        endloop
        set k = a[j] / CodeLength
        set i = a[j] - k * CodeLength
        set buffer = buffer + SubString(udg_SaveLoad_Alphabet,i,i + 1)
        set a[j] = k
        if a[m] == 0 then
            set m = m - 1
        endif
    endloop

    set i = StringLength(buffer)
    set skip = 0
    set c = ""
    loop
        set i = i - 1
        set c = c + SubString(buffer,i,i + 1)
        set skip = skip + 1
        if skip == 4 and i > 0 then
            set c = c + "-"
            set skip = 0
        endif
        exitwhen i <= 0
    endloop
    return c
endfunction

function SaveLoad_DecodeValues takes string s returns boolean
    local integer i
    local integer j
    local integer k
    local integer l
    local integer SaveCode = 0
    local integer m
    local integer array a
    local string buffer = ""
    local integer CodeLength = StringLength(udg_SaveLoad_Alphabet)
    local integer skip = -1
    local integer CONST = 1000000
    local string abc = "0123456789-"
    local string c

    set i = 0
    loop
        set a[i] = 0
        set i = i + 1
        exitwhen i >= 100
    endloop

    set m = 0

    set i = 0
    loop
        set j = 0
        loop
            set a[j] = a[j] * CodeLength
            set j = j + 1
            exitwhen j > m
        endloop

        set skip = skip + 1
        if skip == 4 then
            set skip = 0
            set i = i + 1
        endif

        set l = CodeLength
        set c = SubString(s,i,i + 1)
        loop
            set l = l - 1
            exitwhen l < 1
            exitwhen SubString(udg_SaveLoad_Alphabet,l,l + 1) == c
        endloop
        set a[0] = a[0] + l

        set j = 0
        loop
            set k = a[j] / CONST
            set a[j] = a[j] - k * CONST
            set a[j + 1] = a[j + 1] + k
            set j = j + 1
            exitwhen j > m
        endloop
        if k > 0 then
            set m = m + 1
        endif
        set i = i + 1
        exitwhen i >= StringLength(s)
    endloop

    loop
        exitwhen m < 0
        set j = m
        loop
            exitwhen j <= 0
            set k = a[j] / 11
            set a[j - 1] = a[j - 1] + (a[j] - k * 11) * CONST
            set a[j] = k
            set j = j - 1
        endloop
        set k = a[j] / 11
        set i = a[j] - k * 11
        set buffer = SubString(abc,i,i + 1) + buffer
        set a[j] = k
        if a[m] == 0 then
            set m = m - 1
        endif
    endloop

    set i = 0
    set j = 0
    loop
        loop
            exitwhen i >= StringLength(buffer)
            exitwhen i > 0 and SubString(buffer,i,i + 1) == "-" and SubString(buffer,i - 1,i) != "-"
            set i = i + 1
        endloop
        if i < StringLength(buffer) then
            set k = i
        endif
        set SaveCode = SaveCode + 1
        set udg_Save[SaveCode] = S2I(SubString(buffer,j,i))
        set j = i + 1
        set i = i + 1
        exitwhen i >= StringLength(buffer)
    endloop

    set j = SaveLoad_EncodeVerify(SubString(buffer,0,k))
    set udg_SaveCount = SaveCode - 1
    if j == udg_Save[SaveCode] then
        return true
    endif
    return false
endfunction

function SaveLoad_Encode takes nothing returns string
    if udg_SaveLoad_CaseSensitive == false then
        set udg_SaveLoad_Alphabet = StringCase(udg_SaveLoad_Alphabet,true)
    endif
    return SaveLoad_Color(SaveLoad_EncodeValues())
endfunction

function SaveLoad_Decode takes string s returns boolean
    if udg_SaveLoad_CaseSensitive == false then
        set udg_SaveLoad_Alphabet = StringCase(udg_SaveLoad_Alphabet,true)
        set s = StringCase(s,true)
    endif
    if SaveLoad_DecodeValues(s) then
        call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"Decoding sucessful")
        return true
    endif
    call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"Decoding failed")
    return false
endfunction
 
Status
Not open for further replies.
Top