- Joined
- Jun 11, 2018
- Messages
- 256
Im using TriggerHappy's save/load and I managed to add gold and lumber saving. I want to add research saving as well, how can this be done?
-
Save Init
-

Events
-


Map initialization
-
-

Conditions
-

Actions
-


Set VariableSet SaveLoadMaxLength = 64
-


Set VariableSet SaveUseGUI = True
-


-------- ------------------- --------
-


-------- This willl be the directory the save codes will be saved to. --------
-


-------- ------------------- --------
-


Set VariableSet MapName = Pokemon RPG
-


-------- ------------------- --------
-


-------- This message will display to players who don't have local files enabled --------
-


-------- ------------------- --------
-


Set VariableSet LocalFiles_WarningMessage = |cffe53b3bYou need to enable local files to load your character from disk on patches prior to 1.30!
-


Custom script: set udg_LocalFiles_WarningMessage = udg_LocalFiles_WarningMessage + "\n\n"
-


-------- ------------------- --------
-


-------- Show the save code --------
-


-------- ------------------- --------
-


Set VariableSet SaveShowCode = False
-


-------- ------------------- --------
-


-------- Save hero name (only works with the save slots, not raw save codes) --------
-


-------- Also make sure to set the object editor field "Text - Proper Names Used" to 999 for all of your heroes. --------
-


-------- ------------------- --------
-


Set VariableSet SaveHeroName = True
-


Set VariableSet SaveNameMax = 999
-


-------- ------------------- --------
-


-------- Set these to the values they are in the Advanced -> Gameplay constants --------
-


-------- Allows us to calculate how much XP a hero has --------
-


-------- Note: You can also save EXP the easy way but it will generate a longer code. --------
-


-------- ------------------- --------
-


Set VariableSet HeroXPConstant = 0
-


Set VariableSet HeroXPLevelFactor = 100
-


Set VariableSet HeroXPPrevLevelFactor = 1
-


Set VariableSet HeroXPRequired = 200
-


-------- ------------------- --------
-


-------- Max STR/AGI/INT --------
-


-------- ------------------- --------
-


Set VariableSet SaveUnitMaxStat = 999
-


-------- Note: Changing max values can cause a code wipe --------
-


-------- ------------------- --------
-


-------- Store unit types that can be saved here --------
-


-------- ------------------- --------
-


Set VariableSet SaveUnitType[0] = No unit-type
-


Set VariableSet SaveUnitType[1] = Bulbasaur
-


Set VariableSet SaveUnitType[2] = Charmander
-


Set VariableSet SaveUnitType[3] = Squirtle
-


Set VariableSet SaveUnitType[4] = Caterpie
-


Set VariableSet SaveUnitType[5] = Weedle
-


Set VariableSet SaveUnitType[6] = Pidgey
-


Set VariableSet SaveUnitType[7] = Rattata
-


Set VariableSet SaveUnitType[8] = Spearow
-


Set VariableSet SaveUnitType[9] = Ekans
-


Set VariableSet SaveUnitType[10] = Pikachu
-


Set VariableSet SaveUnitType[11] = Ivysaur
-


Set VariableSet SaveUnitType[12] = Venusaur
-


Set VariableSet SaveUnitType[13] = Charmeleon
-


Set VariableSet SaveUnitType[14] = Charizard
-


Set VariableSet SaveUnitType[15] = Wartortle
-


Set VariableSet SaveUnitType[16] = Blastoise
-


Set VariableSet SaveUnitType[17] = Sandslash
-


Set VariableSet SaveUnitType[18] = Metapod
-


Set VariableSet SaveUnitType[19] = Butterfree
-


Set VariableSet SaveUnitType[20] = Nidorino-
-


Set VariableSet SaveUnitType[21] = Kakuna
-


Set VariableSet SaveUnitType[22] = Beedrill
-


Set VariableSet SaveUnitType[23] = Pidgeotto
-


Set VariableSet SaveUnitType[24] = Pidgeot
-


Set VariableSet SaveUnitType[25] = Raticate
-


Set VariableSet SaveUnitType[26] = Fearow
-


Set VariableSet SaveUnitType[27] = Arbok
-


Set VariableSet SaveUnitType[28] = Raichu
-


Set VariableSet SaveUnitType[29] = Eevee
-


Set VariableSet SaveUnitType[30] = Jolteon
-


Set VariableSet SaveUnitType[31] = Flareon
-


Set VariableSet SaveUnitType[32] = Vaporeon
-


Set VariableSet SaveUnitType[33] = Sandshrew
-


Set VariableSet SaveUnitType[34] = Sandslash
-


Set VariableSet SaveUnitType[35] = Nidoran♀
-


Set VariableSet SaveUnitType[36] = Nidorana
-


Set VariableSet SaveUnitType[37] = Nidoqueen
-


Set VariableSet SaveUnitType[38] = Nidoran♂
-


Set VariableSet SaveUnitType[39] = Nidorino-
-


Set VariableSet SaveUnitType[40] = Nidoking
-


Set VariableSet SaveUnitType[41] = Mankey
-


Set VariableSet SaveUnitType[42] = Nidoking
-


Set VariableSet SaveUnitType[43] = Clefairy-
-


Set VariableSet SaveUnitType[44] = Clefable-
-


Set VariableSet SaveUnitTypeMax = 99
-


-------- Note: Changing max values can cause a code wipe --------
-


-------- ------------------- --------
-


-------- Store item types that can be saved here --------
-


-------- ------------------- --------
-


Set VariableSet SaveItemType[0] = (Item-type of No item)
-


Set VariableSet SaveItemType[1] = Thunderstone
-


Set VariableSet SaveItemType[2] = Firestone
-


Set VariableSet SaveItemType[3] = Leafstone
-


Set VariableSet SaveItemType[4] = Waterstone
-


Set VariableSet SaveItemType[5] = Moonstone
-


Set VariableSet SaveItemType[6] = Antidote
-


Set VariableSet SaveItemType[7] = Pokè Flute
-


Set VariableSet SaveItemType[8] = HM01
-


Set VariableSet SaveItemType[9] = |cff808080Broken |rCybernetic Implant
-


Set VariableSet SaveItemType[10] = |cff808080Broken |rEnergy Amplifier
-


Set VariableSet SaveItemType[11] = |cff808080Broken |rReflex Enhancer
-


Set VariableSet SaveItemType[12] = |cff808080Broken |rVitality Amplifier
-


Set VariableSet SaveItemType[13] = |cff808080Broken|r Dexterity Implant
-


Set VariableSet SaveItemType[14] = |cff808080Broken|r Inertial Dampener
-


Set VariableSet SaveItemType[15] = |cff808080Broken|r Focusing Implant
-


Set VariableSet SaveItemType[16] = |cff808080Broken|r Power Enhancer
-


Set VariableSet SaveItemType[17] = |cff808080Broken|r Running Shoes
-


Set VariableSet SaveItemType[18] = Scrap Metal
-


Set VariableSet SaveItemType[19] = |cff00ff00Enhanced |rTissue Generator
-


Set VariableSet SaveItemType[20] = Basic Tissue Generator
-


Set VariableSet SaveItemType[21] = |cffffff00Advanced|r Tissue Generator
-


Set VariableSet SaveItemType[22] = Basic Running Shoes
-


Set VariableSet SaveItemType[23] = |cff00ff00Enhanced|r Running Shoes
-


Set VariableSet SaveItemType[24] = Basic Cybernetic Implant
-


Set VariableSet SaveItemType[25] = |cff00ff00Enhanced |rCybernetic Implant
-


Set VariableSet SaveItemType[26] = |cffffff00Advanced|r Cybernetic Implant
-


Set VariableSet SaveItemType[27] = Basic Dexterity Implant
-


Set VariableSet SaveItemType[28] = |cff00ff00Enhanced |rDexterity Implant
-


Set VariableSet SaveItemType[29] = |cffffff00Advanced|r Dexterity Implant
-


Set VariableSet SaveItemType[30] = Basic Focusing Implant
-


Set VariableSet SaveItemType[31] = |cff00ff00Enhanced |rFocusing Implant
-


Set VariableSet SaveItemType[32] = |cffffff00Advanced|r Focusing Implant
-


Set VariableSet SaveItemType[33] = Basic Power Enhancer
-


Set VariableSet SaveItemType[34] = |cff00ff00Enhanced |rPower Enhancer
-


Set VariableSet SaveItemType[35] = |cffffff00Advanced|r Power Enhancer
-


Set VariableSet SaveItemType[36] = |cffff0000Superior |rPower Enhancer
-


Set VariableSet SaveItemType[37] = Basic Muscle Accelerator
-


Set VariableSet SaveItemType[38] = |cff00ff00Enhanced |rMuscle Accelerator
-


Set VariableSet SaveItemType[39] = |cffffff00Advanced|r Muscle Accelerator
-


Set VariableSet SaveItemType[40] = Basic Reflex Enhancer
-


Set VariableSet SaveItemType[41] = |cff00ff00Enhanced|r Reflex Enhancer
-


Set VariableSet SaveItemType[42] = |cffffff00Advanced|r Reflex Enhancer
-


Set VariableSet SaveItemType[43] = Basic Inertial Dampener
-


Set VariableSet SaveItemType[44] = |cff00ff00Enhanced |rInertial Dampener
-


Set VariableSet SaveItemType[45] = |cffff0000Superior|r Inertial Dampener
-


Set VariableSet SaveItemType[46] = |cffffff00Advanced|r Vitality Amplifier
-


Set VariableSet SaveItemType[47] = Basic Vitality Amplifier
-


Set VariableSet SaveItemType[48] = |cff00ff00Enhanced|r Vitality Amplifier
-


Set VariableSet SaveItemType[49] = |cffffff00Advanced|r Energy Amplifier
-


Set VariableSet SaveItemType[50] = Basic Energy Amplifier
-


Set VariableSet SaveItemType[51] = |cff00ff00Enhanced|r Energy Amplifier
-


Set VariableSet SaveItemType[52] = Potion
-


Set VariableSet SaveItemType[53] = Super Potion
-


Set VariableSet SaveItemType[54] = Hyper Potion
-


Set VariableSet SaveItemType[55] = Ether
-


Set VariableSet SaveItemType[56] = Max Ether
-


Set VariableSet SaveItemType[57] = Elixir
-


Set VariableSet SaveItemType[58] = Max Elixir
-


Set VariableSet SaveItemType[59] = Berry
-


Set VariableSet SaveItemType[60] = Green Mushroom
-


Set VariableSet SaveItemTypeMax = 999
-


-------- Note: Changing max values can cause a code wipe --------
-


-------- ------------------- --------
-


-------- Store ability types that can be saved here --------
-


-------- ------------------- --------
-


Set VariableSet SaveAbilityType[1] = Ember E
-


Set VariableSet SaveAbilityType[2] = Ember Q
-


Set VariableSet SaveAbilityType[3] = Ember R
-


Set VariableSet SaveAbilityType[4] = Ember W
-


Set VariableSet SaveAbilityType[5] = Cut E
-


Set VariableSet SaveAbilityType[6] = Cut Q
-


Set VariableSet SaveAbilityType[7] = Cut R
-


Set VariableSet SaveAbilityType[8] = Cut W
-


Set VariableSet SaveAbilityType[9] = Metal Claw E
-


Set VariableSet SaveAbilityType[10] = Metal Claw Q
-


Set VariableSet SaveAbilityType[11] = Metal Claw R
-


Set VariableSet SaveAbilityType[12] = Metal Claw W
-


Set VariableSet SaveAbilityType[13] = Smokescreen E
-


Set VariableSet SaveAbilityType[14] = Smokescreen Q
-


Set VariableSet SaveAbilityType[15] = Smokescreen R
-


Set VariableSet SaveAbilityType[16] = Smokescreen W
-


Set VariableSet SaveAbilityType[17] = Scary Face E
-


Set VariableSet SaveAbilityType[18] = Scary Face Q
-


Set VariableSet SaveAbilityType[19] = Scary Face R
-


Set VariableSet SaveAbilityType[20] = Scary Face W
-


Set VariableSet SaveAbilityType[21] = Vine Whip E
-


Set VariableSet SaveAbilityType[22] = Vine Whip Q
-


Set VariableSet SaveAbilityType[23] = Vine Whip R
-


Set VariableSet SaveAbilityType[24] = Vine Whip W
-


Set VariableSet SaveAbilityType[25] = Bite E
-


Set VariableSet SaveAbilityType[26] = Bite Q
-


Set VariableSet SaveAbilityType[27] = Bite R
-


Set VariableSet SaveAbilityType[28] = Bite W
-


Set VariableSet SaveAbilityType[29] = Bubble E
-


Set VariableSet SaveAbilityType[30] = Bubble Q
-


Set VariableSet SaveAbilityType[31] = Bubble R
-


Set VariableSet SaveAbilityType[32] = Bubble W
-


Set VariableSet SaveAbilityType[33] = Confusion E
-


Set VariableSet SaveAbilityType[34] = Confusion Q
-


Set VariableSet SaveAbilityType[35] = Confusion E
-


Set VariableSet SaveAbilityType[36] = Confusion R
-


Set VariableSet SaveAbilityType[37] = Double Team E
-


Set VariableSet SaveAbilityType[38] = Double Team Q
-


Set VariableSet SaveAbilityType[39] = Double Team R
-


Set VariableSet SaveAbilityType[40] = Double Team W
-


Set VariableSet SaveAbilityType[41] = Focus Energy E
-


Set VariableSet SaveAbilityType[42] = Focus Energy Q
-


Set VariableSet SaveAbilityType[43] = Focus Energy R
-


Set VariableSet SaveAbilityType[44] = Focus Energy W
-


Set VariableSet SaveAbilityType[45] = Hyper Fang E
-


Set VariableSet SaveAbilityType[46] = Hyper Fang Q
-


Set VariableSet SaveAbilityType[47] = Hyper Fang W
-


Set VariableSet SaveAbilityType[48] = Hyper Fang R
-


Set VariableSet SaveAbilityTypeMax = 199
-


-------- Note: Changing max values can cause a code wipe --------
-


-------- ------------------- --------
-


-------- Automatically copy variables --------
-


-------- ------------------- --------
-


Set VariableSet SavePlayerLoading[0] = False
-


Set VariableSet SaveLoadEvent = -1.00
-


Set VariableSet SaveCount = 0
-


Set VariableSet SaveValue[0] = 0
-


Set VariableSet SaveMaxValue[0] = 0
-


Set VariableSet SaveTempInt = 0
-


Set VariableSet SavePlayerHero[0] = No unit
-


Set VariableSet SaveCurrentSlot[0] = 0
-


Set VariableSet SaveLoadEvent_Code = <Empty String>
-


Set VariableSet SaveLoadEvent_Player = Player 1 (Red)
-


Set VariableSet SaveNameList[0] = <Empty String>
-


Set VariableSet SaveCodeColored = <Empty String>
-


Trigger - Run HeroNames <gen> (ignoring conditions)
-


Custom script: call SaveHelper.Init()
-
-
-
Save GUI
-

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
-


Player - Player 5 (Yellow) types a chat message containing -save as An exact match
-


Player - Player 6 (Orange) types a chat message containing -save as An exact match
-


Player - Player 7 (Green) types a chat message containing -save as An exact match
-


Player - Player 8 (Pink) types a chat message containing -save as An exact match
-


Player - Player 9 (Gray) types a chat message containing -save as An exact match
-


Player - Player 10 (Light Blue) types a chat message containing -save as An exact match
-


Player - Player 11 (Dark Green) types a chat message containing -save as An exact match
-
-

Conditions
-


SaveUseGUI Equal to True
-


(SavePlayerHero[((Player number of (Triggering player)) - 1)] is A Hero) Equal to True
-
-

Actions
-


-------- ------------------- --------
-


-------- NOTE: You must load values in the reverse order you saved them in. This is why we save the unit type last. --------
-


-------- ------------------- --------
-


Set VariableSet SaveTempUnit = SavePlayerHero[((Player number of (Triggering player)) - 1)]
-


Set VariableSet SaveCount = -1
-


-------- Save Abilities --------
-


-------- ------------------- --------
-


For each (Integer SaveTempInt) from 0 to SaveAbilityTypeMax, do (Actions)
-



Loop - Actions
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






(Level of SaveAbilityType[SaveTempInt] for SaveTempUnit) Greater than 0
-
-





Then - Actions
-






-------- Save level of ability --------
-






Set VariableSet SaveCount = (SaveCount + 1)
-






Set VariableSet SaveValue[SaveCount] = (Level of SaveAbilityType[SaveTempInt] for SaveTempUnit)
-






Set VariableSet SaveMaxValue[SaveCount] = 10
-






-------- Save the array index --------
-






Set VariableSet SaveCount = (SaveCount + 1)
-






Set VariableSet SaveValue[SaveCount] = SaveTempInt
-






Set VariableSet SaveMaxValue[SaveCount] = SaveAbilityTypeMax
-
-





Else - Actions
-
-
-
-


-------- Save the number of abilities the unit has --------
-


Set VariableSet SaveCount = (SaveCount + 1)
-


Set VariableSet SaveValue[SaveCount] = (SaveCount / 2)
-


Set VariableSet SaveMaxValue[SaveCount] = SaveAbilityTypeMax
-


-------- ------------------- --------
-


-------- Save Skill Points --------
-


-------- ------------------- --------
-


Set VariableSet SaveCount = (SaveCount + 1)
-


Set VariableSet SaveValue[SaveCount] = (Unspent skill points of SaveTempUnit)
-


Set VariableSet SaveMaxValue[SaveCount] = 999
-


-------- ------------------- --------
-


-------- Save Trainer Item Charges --------
-


-------- ------------------- --------
-


Set VariableSet ItemCount = (Number of items carried by Player_Trainer[(Player number of SaveLoadEvent_Player)])
-


For each (Integer A) from 1 to ItemCount, do (Actions)
-



Loop - Actions
-




-------- Set Integer = The value that you want to save --------
-




Set VariableSet Integer = (Charges remaining in (Item carried by Player_Trainer[(Player number of SaveLoadEvent_Player)] in slot (Integer A)))
-




Set VariableSet SaveCount = (SaveCount + 1)
-




Set VariableSet SaveValue[SaveCount] = Integer
-




Set VariableSet SaveMaxValue[SaveCount] = 999
-
-
-


-------- ------------------- --------
-


-------- Save Items --------
-


-------- ------------------- --------
-


For each (Integer SaveTempInt) from 0 to 5, do (Actions)
-



Loop - Actions
-




Set VariableSet SaveCount = (SaveCount + 1)
-




Custom script: set udg_SaveValue[udg_SaveCount] = SaveHelper.ConvertItemId(GetItemTypeId(UnitItemInSlot(udg_SaveTempUnit, udg_SaveTempInt)))
-




Set VariableSet SaveMaxValue[SaveCount] = SaveItemTypeMax
-
-
-


-------- ------------------- --------
-


-------- ------------------- --------
-


-------- Save Attributes --------
-


-------- ------------------- --------
-


Set VariableSet SaveCount = (SaveCount + 1)
-


Set VariableSet SaveValue[SaveCount] = (Strength of SaveTempUnit (Exclude bonuses))
-


Set VariableSet SaveMaxValue[SaveCount] = 999
-


-------- ------------------- --------
-


Set VariableSet SaveCount = (SaveCount + 1)
-


Set VariableSet SaveValue[SaveCount] = (Agility of SaveTempUnit (Exclude bonuses))
-


Set VariableSet SaveMaxValue[SaveCount] = 999
-


-------- ------------------- --------
-


Set VariableSet SaveCount = (SaveCount + 1)
-


Set VariableSet SaveValue[SaveCount] = (Intelligence of SaveTempUnit (Exclude bonuses))
-


Set VariableSet SaveMaxValue[SaveCount] = 999
-


-------- ------------------- --------
-


-------- Save Gold --------
-


Set VariableSet Integer = (SaveLoadEvent_Player Current gold)
-


Set VariableSet SaveCount = (SaveCount + 1)
-


Set VariableSet SaveValue[SaveCount] = Integer
-


Set VariableSet SaveMaxValue[SaveCount] = 9999
-


-------- --------
-


-------- Save Lumber --------
-


Set VariableSet Integer = (SaveLoadEvent_Player Current lumber)
-


Set VariableSet SaveCount = (SaveCount + 1)
-


Set VariableSet SaveValue[SaveCount] = Integer
-


Set VariableSet SaveMaxValue[SaveCount] = 9999
-


-------- ------------------- --------
-


-------- Save Experience (%) and Level --------
-


-------- ------------------- --------
-


Set VariableSet SaveCount = (SaveCount + 1)
-


Custom script: set udg_SaveValue[udg_SaveCount] = R2I( (GetHeroXP(udg_SaveTempUnit)) / SaveHelper.GetLevelXP(GetHeroLevel(udg_SaveTempUnit)) * 100) // percentage
-


Set VariableSet SaveMaxValue[SaveCount] = 100
-


-------- ------------------- --------
-


Set VariableSet SaveCount = (SaveCount + 1)
-


Set VariableSet SaveValue[SaveCount] = (Hero level of SaveTempUnit)
-


Set VariableSet SaveMaxValue[SaveCount] = 100
-


-------- ------------------- --------
-


-------- Save Hero Name --------
-


-------- ------------------- --------
-


Set VariableSet SaveCount = (SaveCount + 1)
-


Custom script: set udg_SaveValue[udg_SaveCount] = SaveHelper.GetHeroNameID(GetHeroProperName(udg_SaveTempUnit))
-


Set VariableSet SaveMaxValue[SaveCount] = SaveNameMax
-


-------- ------------------- --------
-


-------- Save Unit Type --------
-


-------- ------------------- --------
-


Set VariableSet SaveCount = (SaveCount + 1)
-


Custom script: set udg_SaveValue[udg_SaveCount] = SaveHelper.ConvertUnitId(GetUnitTypeId(udg_SaveTempUnit))
-


Set VariableSet SaveMaxValue[SaveCount] = SaveUnitTypeMax
-


-------- ------------------- --------
-


-------- Save to disk --------
-


-------- ------------------- --------
-


Custom script: set udg_SaveTempInt = Savecode.create()
-


For each (Integer A) from 0 to SaveCount, do (Actions)
-



Loop - Actions
-




Custom script: call Savecode(udg_SaveTempInt).Encode(udg_SaveValue[bj_forLoopAIndex], udg_SaveMaxValue[bj_forLoopAIndex])
-
-
-


Set VariableSet SaveTempString = <Empty String>
-


Custom script: set udg_SaveTempString = Savecode(udg_SaveTempInt).Save(GetTriggerPlayer(), 1)
-


Custom script: call SaveFile.create(GetTriggerPlayer(), SaveHelper.GetUnitTitle(udg_SaveTempUnit), -1, 0, udg_SaveTempString)
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




SaveShowCode Equal to True
-
-



Then - Actions
-




Custom script: set udg_SaveCodeColored = Savecode_colorize(udg_SaveTempString)
-




Game - Display to (All players) the text: SaveCodeColored
-
-



Else - Actions
-
-
-
