Quote: "could you give an example? How do you know what to set the variables to in the next level?"
Certainly. Now bare in mind I am still using FPSC v117 in my example. On one of our developments, we use the globalvar command and assign a numeric value for specific items. For example, if the player picks up a flashlight for their inventory, the flashlight variable (globalvar=15) will have a value of 21 (this removes the lock on the flashlight icon in the inventory hud and allows the player to remove from their inventory to use). Another item collected is a key (globalvar=16) and when collected has a value set to 21 (this removes the lock from the key in the inventory hud, same as the flashlight). When the player exits the level and ges to level 2, I have a trigger that sets the globalvar=15 and globalvar=16 to the values they would be if the player had those items in their inventory.
So at the end of our first level in our development, the player has completed certain objectives, collected a few items in their inventory, and the global variables I've assigned for items in the game have a value at level end. In the start of level 2, I place a trigger right where the player starts and use the following script that initializes the variables, giving the "illusion" that they carried over from the previous level.
;Artificial Intelligence Script
;Header
desc = Init Level 02 Vars
;Triggers
:state=0:hudreset,hudx=12.5,hudy=10,hudimagefine=languagebank\english\gamecore\NorthernFox\WW2_GU\Huds\ww2_gu_l02_help_hud_updated_001.png,hudname=l02_help_hud_updated_001,hudhide=1,hudmake=display
:state=0,plrwithinzone=1:state=1
;Global Variables- OBJECTIVES
:state=1:globalvar=1,setvar=0
:state=1:state=2
;Global Variables- INVENTORY
:state=2:globalvar=2,setvar=4
:state=2:state=3
;Global Variables- INITKEYS TOGGLE
:state=3:globalvar=3,setvar=1
:state=3:state=4
;Global Variables- HELP
:state=4:globalvar=4,setvar=1
:state=4:state=5
;Global Variable- CLUES
:state=5:globalvar=5,setvar=0
:state=5:state=6
;Global Variable- MISSION LIST
:state=6:globalvar=6,setvar=1
:state=6:state=7
;Global Variable- PRIMARY LEVEL OBJECTIVES
:state=7:globalvar=7,setvar=0
:state=7:state=8
;Global Variable- SECONDARY LEVEL OBJECTIVES
:state=8:globalvar=8,setvar=0
:state=8:state=9
;Global Variable- PRIMARY OBJECTIVES TOTAL
:state=9:globalvar=9,setvar=3
:state=9:state=10
;Global Variable- SECONDARY OBJECTIVES TOTAL
:state=10:globalvar=10,setvar=0
:state=10:state=11
;Global Variable- BATTERY
:state=11:globalvar=12,setvar=22
:state=11:state=12
;Global Variable- FLASHLIGHT
:state=12:globalvar=15,setvar=21
:state=12:state=13
;Global Variable- KEYS
:state=13:globalvar=17,setvar=21
:state=13:state=14
;global Variable- RADIO
:state=14:globalvar=20,setvar=21
:state=14:state=20
;Global Variable- INVENTORY TOGGLE
:state=20:globalvar=25,setvar=1
:state=20:state=25
:state=25:activateifused=1,state=30
:state=30:hudshow=l02_help_hud_updated_001,hudfadeout=l02_help_hud_updated_001,state=31
:state=31:none
;End of Script
From my script, you will see what variables are being set to the values they were at before. Global variable 9 is used for our Primary Objectives Total (this is a running total for the entire game of how many primary objectives were done). At the end of level 1, that value was at 3, and at the start of level 2, I set that variable to 3 and continue on. At the end of level 2, that value will be at 10, since level 2 has 7 primary objectives to complete. At the start of level 3, I will set that global variable to 10 and continue on.
Hopefully you get the idea of what I am doing as my "work-around". It may seem like a lot of work, but once the first level or two are done, the rest get easier.
Twitter: @NFoxMedia