Variable controls
by Wesley Brown · in General Discussion · 06/07/2010 (6:49 am) · 1 replies
so, yeah, i'm still hacking away at the manuals and tutorials but i was wondering since it doesn't seem to be very clear in the docs...
if i declare a global variable, that will carry over through different maps/levels? can i make these sorts of variable be stored so that they will persist when the player shuts down and then loads it back up later?
just so i can be sure, it's so that i can manage a player inventory and also set up trigger points to change the camera angle (if possible) so that when the character steps into an area, the camera changes to better frame that spot for visibility (and i guess composition.) if i'm reading this all correctly, those features are do-able. maybe a global variable set to be a matrix for things like keeping tabs on how much ammo one has.. or a single value to handle all key-items (think "binary" and you'll probably get it.)
if i declare a global variable, that will carry over through different maps/levels? can i make these sorts of variable be stored so that they will persist when the player shuts down and then loads it back up later?
just so i can be sure, it's so that i can manage a player inventory and also set up trigger points to change the camera angle (if possible) so that when the character steps into an area, the camera changes to better frame that spot for visibility (and i guess composition.) if i'm reading this all correctly, those features are do-able. maybe a global variable set to be a matrix for things like keeping tabs on how much ammo one has.. or a single value to handle all key-items (think "binary" and you'll probably get it.)
Torque 3D Owner Daniel Balmert
Default Studio Name
Handling the player's info (ammmo, location etc.) by global variable is fine if you only plan to make your game single player and non-networked. However, gobal variables get reset or re0initialized every time the game is executed, so you need to save out and read in the info from external files.
Also, you'll need to do some tricky stuff to make your save files encrypted so that players can't simply edit the text file for infinite ammo.