Index | FAQ | Search | Memberlist | Usergroups | Profile | Log in to check your private messages | Log in | Register

carrying variables over from one map to another...

| Inside3d Forums Forum Index -> QuakeC Programming

View previous topic :: View next topic
Author | Message
--- | ---
necros Joined: 16 Dec 2004 Posts: 22 |

Posted: Thu Dec 16, 2004 11:20 pm Post subject: 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?

Back to top |

Urre Joined: 05 Nov 2004 Posts: 1073 Location: Sweden |

Posted: Fri Dec 17, 2004 12:54 am Post subject: |

Parms are pretty darn permanent... Then there's always FRIK_FILE, assuming you're using an engine that supports it. _________________ Look out for Twigboy

Back to top |

necros Joined: 16 Dec 2004 Posts: 22 |

Posted: Fri Dec 17, 2004 12:55 am Post subject: |

if possible, i'd like to keep everything compatible with original quake... :\

Back to top |

Wazat Joined: 15 Oct 2004 Posts: 732 Location: Middle 'o the desert, USA |

Posted: Fri Dec 17, 2004 2:54 am Post subject: |

Parms, then. You'll find them near the top of client.qc. _________________ 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.

Back to top |

Wazat Joined: 15 Oct 2004 Posts: 732 Location: Middle 'o the desert, USA |

Posted: Fri Dec 17, 2004 2:56 am Post subject: |

...btw, there's also temp1, gamecfg, nomonsters, savedgamecfg, saved1-5, etc. Those cvars can be fairly useful, and they stay the same across maps. _________________ 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.

Back to top |

necros Joined: 16 Dec 2004 Posts: 22 |

Posted: Fri Dec 17, 2004 4:26 am Post subject: |

thanks! i didn't know there were so many of those. about parm, there are up to parm16 declared in defs.qc... when (if at all) are parm10-16 used? i only see 1 to 9 used for SP ammo/items.

Back to top |

Wazat Joined: 15 Oct 2004 Posts: 732 Location: Middle 'o the desert, USA |

Posted: Fri Dec 17, 2004 5:20 am Post subject: |

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.
_________________
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.

Back to top |

necros Joined: 16 Dec 2004 Posts: 22 |

Posted: Fri Dec 17, 2004 6:02 am Post subject: |

ah, so they are unused, then? thanks! this is great, i didn't know quake had hidden gems like this.

Back to top |

necros Joined: 16 Dec 2004 Posts: 22 |

Posted: Tue Jan 11, 2005 8:12 am Post subject: 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?

Back to top |

Supa Joined: 26 Oct 2004 Posts: 122 |

Posted: Tue Jan 11, 2005 8:55 am Post subject: 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");

Back to top |

FrikaC Site Admin Joined: 08 Oct 2004 Posts: 947 |

Posted: Tue Jan 11, 2005 9:29 am Post subject: |

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;

Back to top |

FrikaC Site Admin Joined: 08 Oct 2004 Posts: 947 |

Posted: Tue Jan 11, 2005 9:33 am Post subject: |

Oh, and you really should use cvar_set for setting cvars, not stuffcmd or localcmd.

Back to top |

Wazat Joined: 15 Oct 2004 Posts: 732 Location: Middle 'o the desert, USA |

Posted: Tue Jan 11, 2005 4:20 pm Post subject: |

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...
_________________
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.

Back to top |

necros Joined: 16 Dec 2004 Posts: 22 |

Posted: Tue Jan 11, 2005 7:31 pm Post subject: thanks! |

wow, thanks for all the help, guys! there's still so much for me to learn about qc.

Back to top |

Display posts from previous:

| Inside3d Forums Forum Index -> QuakeC Programming | All times are GMT
Page 1 of 1

Jump to:

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2004 phpBB Group