How do I reference data from the local folder in World Editor?
EDIT/UPDATE:
i'm really struggling to understand this and i think i'm not doing a great job at communicating here. trying to consolidate my thoughts/wishes:
1) is udg_SaveCount is the first data piece saved, so in my case the only data piece?
2) Is it possible to reference the actual integer saved in the local folder in a WE trigger? for this map it will always be 1,2,3,4, or 5 only
1) udg_difficulty_setting is selected by player at start.
2) i want difficulty_setting to be compared to saved data, probably saved using the max(a,b) function - so let's say they beat difficulty 3 once but then they just beat difficulty 2 again, i want difficulty 3 to be saved.
3) when loading at the start, if the saved integer is 3 or higher, i want to be able to reference that and run triggers based on the saved variable.
-
auto load red
-
Events
-
Time - Elapsed game time is 1.00 seconds
-
Conditions
-
Actions
-
Set VariableSet SaveLoadEvent_Player = Player 1 (Red)
-
Custom script: call LoadSaveSlot(udg_SaveLoadEvent_Player, 1)
-
auto save red
-
Events
-
Conditions
-
Actions
-
Set VariableSet SaveLoadEvent_Player = Player 1 (Red)
-
-------- ------------------- --------
-
Set VariableSet SaveCount = 0
-
-------- ------------------- --------
-
Custom script: call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "Saved " + User[udg_SaveLoadEvent_Player].nameColored)
-
-------- ------------------- --------
-
-------- ------------------- --------
-
-------- PUT YOUR SAVE ACTIONS HERE: --------
-
Set VariableSet SaveCount = (SaveCount + 1)
-
Set VariableSet SaveValue[SaveCount] = (Max(difficulty_setting, highest_difficulty_victory[(Player number of SaveLoadEvent_Player)]))
-
Set VariableSet SaveMaxValue[SaveCount] = 1000
-
Game - Display to (Player group(SaveLoadEvent_Player)) for 15.00 seconds the text: (Saved Loyalty: + (String(YourInteger[(Player number of SaveLoadEvent_Player)])))
-
-------- STOP --------
-
-------- ------------------- --------
-
-------- ------------------- --------
-
-------- ------------------- --------
-
-------- 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(udg_SaveLoadEvent_Player, 1)
-
Custom script: call SaveFile.create(udg_SaveLoadEvent_Player, "Save", 1, udg_SaveTempString)
-
Load Event
-
Events
-
Game - SaveLoadEvent becomes Equal to 1.00
-
Conditions
-
Actions
-
-------- ------------------- --------
-
-------- Validate --------
-
-------- ------------------- --------
-
Set VariableSet SaveCount = 0
-
Custom script: set udg_SaveTempInt = integer(Savecode.create())
-
Custom script: if not (Savecode(udg_SaveTempInt).Load(udg_SaveLoadEvent_Player, udg_SaveLoadEvent_Code, 1)) then
-
Game - Display to (Player group(SaveLoadEvent_Player)) the text: Invalid load code (...
-
Skip remaining actions
-
Custom script: endif
-
Custom script: call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Loaded " + User[udg_SaveLoadEvent_Player].nameColored)
-
-------- ------------------- --------
-
-------- ------------------- --------
-
-------- ------------------- --------
-
-------- PUT YOUR LOAD ACTIONS HERE: --------
-
Set VariableSet SaveCount = (SaveCount + 1)
-
Set VariableSet SaveMaxValue[SaveCount] = 1000
-
Custom script: call SaveHelper.GUILoadNext()
-
Set VariableSet highest_difficulty_victory[(Player number of SaveLoadEvent_Player)] = SaveValue[SaveCount]
-
Game - Display to (Player group(SaveLoadEvent_Player)) for 15.00 seconds the text: (Loaded Prestige: + (String(highest_difficulty_victory[(Player number of SaveLoadEvent_Player)])))
-
-------- STOP --------
-
-------- ------------------- --------
-
-------- ------------------- --------
-
-------- ------------------- --------
-
Custom script: call Savecode(udg_SaveTempInt).destroy()