Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- load_game_state
- Options: Function
- Return Type: Boolean
- Parameters
- save_slot = 0 <Integer>
- Grammar Text: load_game_state(save_slot)
- Hint Text: (None)
- Custom Script Code
- Local Variables
- force = 0 <Integer>
- upgrade = 0 <Integer>
- unit = No Unit <Unit>
- unit_slot = 0 <Integer>
- success = False <Boolean>
- Actions
- Debug - debug_s(("*** LOADING GAME STATE *** slot" = save_slot, ""), False, False)
- ------- INDICATE THE LEAVING OF NORMAL GAME STATE
- Variable - Set in_game = False
- ------- IF INVALID, DO NOTHING
- General - If (Conditions) then do (Actions) else do (Actions)
- If
- save_slots[save_slot].valid == False
- Then
- Debug - message_s("ERROR: save slot is invalid. Cannot load")
- General - Return False
- Else
- ------- TIMESTAMP
- set_clock((seconds_to_minutes(save_slots[save_slot].time_stamp)), (left_over_seconds(save_slots[save_slot].time_stamp)))
- ------- SET FORCE PROPERTIES
- General - For each integer force from 0 to LAST_FORCE with increment 1, do (Actions)
- Actions
- ------- LOAD UPGRADES
- load_upgrades(save_slot, force)
- ------- RESTORE FORCE_COLOURS
- Player - Set player (force_to_player(force)) color to save_slots[save_slot].force_colours[force] (Change the color of existing units)
- ------- REMOVING ALL UNITS
- remove_all_units()
- ------- CREATE REPLACEMENT UNITS
- replace_all_units(save_slot)
- ------- LOAD UNIT VALUES ONTO REPLACEMENTS
- Variable - Set success = (load_units(save_slot))
- ------- CLEAR REPLACEMENT UNITS FROM SAVE SLOT RECORDS
- General - For each integer unit_slot from 1 to save_slots[save_slot].last_unit with increment 1, do (Actions)
- Actions
- Variable - Set save_slots[save_slot].units[unit_slot].replacement_unit = No Unit
- General - For each integer force from 0 to LAST_FORCE with increment 1, do (Actions)
- Actions
- ------- LOAD RESOURCES
- Player - Modify player (force_to_player(force)) Minerals: Set To save_slots[save_slot].resources.budget[TREASURY_CONSTS.MINERALS]
- Player - Modify player (force_to_player(force)) Vespene: Set To save_slots[save_slot].resources.budget[TREASURY_CONSTS.VESPENE]
- ------- RESTORE CAMERA LOCATIONS
- Camera - Pan the camera for player (force_to_player(force)) to save_slots[save_slot].camera_locations[force] over 0.0 seconds with Existing Velocity% initial velocity, 10.0% deceleration, and Do Not use smart panning
- ------- LOAD BUILD ORDERS
- load_bos(save_slot)
- ------- UNPAUSE UNITS
- unpause()
- ------- RESUME NORMAL GAME STATE
- General - If (Conditions) then do (Actions) else do (Actions)
- If
- save_slot != 0
- Then
- Variable - Set in_game = True
- Else
- ------- DONE
- General - Return success
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement