carrying variables over from one map to another...
carrying variables over from one map to another...
is it possible to, for example, carry the "total monsters" and the "monsters killed" variables from one map so that you can add them to the variables in another map?
i know quake can do that with ammo, but how do you make a 'permanent' variable like that?
i know quake can do that with ammo, but how do you make a 'permanent' variable like that?
You can use any and all of the parms as you please. There's no pre-defined order you have to store things in, and none of the stuff is really required. If your mod gives players 100 health each time they start a level, then you don't need to store health in a parm. If you don't need to store ammo, you can remove those. You might store all that information using FRIK_FILE in your mod, and not need any more than 1 parm (to store client ID to match players to their save files).
Likewise you can use the other, unused parms for whatever purpose you deem necessary.
Likewise you can use the other, unused parms for whatever purpose you deem necessary.
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
sorry to ressurect the thread,
but i have another question on this topic, specifically, how do you use the variables saved1-4 in qc? it's easy to do it via the console in the game, but how can one access these vars in qc?
i've tried delcaring a float 'saved1' but this is just treated as a normal float and not the actual saved1 i want.
any help?
i've tried delcaring a float 'saved1' but this is just treated as a normal float and not the actual saved1 i want.
any help?
Re: sorry to ressurect the thread,
You'd use savedX like any other cvar in Quake: use stuffcmd/localcmd (Preferrably stuffcmd for SP) to set it and use 'cvar' to read it.:
stuffcmd(player, "cl_foo 3\n");
(later)
self.bar = cvar("cl_foo");
stuffcmd(player, "cl_foo 3\n");
(later)
self.bar = cvar("cl_foo");
aut viam inveniam aut faciam
If you need a bit more than 10-16, I should note that parm9's use in Quake is kinda pointless. It stores the "armortype" variable, a variable with only 4 possible values all of which are already flagged in .items.
So all you need to do to free up parm9 is add this to the bottom of DecodeLevelParms:
if (self.items & IT_ARMOR1)
self.armortype = 0.3;
else if (self.items & IT_ARMOR2)
self.armortype = 0.6;
else if (self.items & IT_ARMOR3)
self.armortype = 0.8;
else
self.armortype = 0;
So all you need to do to free up parm9 is add this to the bottom of DecodeLevelParms:
if (self.items & IT_ARMOR1)
self.armortype = 0.3;
else if (self.items & IT_ARMOR2)
self.armortype = 0.6;
else if (self.items & IT_ARMOR3)
self.armortype = 0.8;
else
self.armortype = 0;
Yea, as FrikaC said, use cvar to read and cvar_set to modify.
There's also savedgamecfg, which I think is just like saved1 etc.
There's also gamecfg, temp1, and nomonsters. These aren't saved in the cfg files, which can make them more or less useful. You can change them without worrying about their settings carrying over to the next time the user starts quake. Set them just before the map changes and load them just after the level starts (in worldspawn()). If you store their values as floats during game and only set & load them for map changes, they should be saved in save games, right?
I'm sure there are others. And in DP you can make your own cvars...
There's also savedgamecfg, which I think is just like saved1 etc.
There's also gamecfg, temp1, and nomonsters. These aren't saved in the cfg files, which can make them more or less useful. You can change them without worrying about their settings carrying over to the next time the user starts quake. Set them just before the map changes and load them just after the level starts (in worldspawn()). If you store their values as floats during game and only set & load them for map changes, they should be saved in save games, right?
I'm sure there are others. And in DP you can make your own cvars...
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.