Forum

making player info and items carry over to the next level?

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

making player info and items carry over to the next level?

Postby ceriux » Mon Nov 30, 2009 9:47 pm

Ok guys i know this is possible, but i have no idea where to start im assuming it has to do with setnewparms? but id also like to carry over other things not included in the parms. can anyone help out or point me in the right direction? thanks again!
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby Spirit » Mon Nov 30, 2009 9:52 pm

Searching for "carry over" gives you viewtopic.php?t=80 and viewtopic.php?t=851
Improve Quaddicted, send me a pull request: https://github.com/SpiritQuaddicted/Quaddicted-reviews
Spirit
 
Posts: 1031
Joined: Sat Nov 20, 2004 9:00 pm

Postby Wazat » Mon Nov 30, 2009 10:06 pm

Basically, items and stats such as health are only carried over if they are set in one of the parm variables. There are only 16 of these, so you're limited in the information you can transfer. SetNewParms wipes the player's stats clean (i.e. just connected/respawned). SetChangeParms copies the player's info into the parmX variables. Finally, DecodeLevelParms copies the player's info back from the parms into the player.

Each parm is a float, so it can hold bitwise information (i.e. self.items) or standard numbers like health. No strings etc can be transferred in this manner, and a vector would require 3 of your 16 parms. Thus, any information that you can avoid transferring this way and simply rebuild from nothing in the next level is best left out of parms.

parm1-16 are actually global variables tied to the engine. I forget how exactly it works though... FrikaC and other gurus could probably fill you in.

If you want to transfer another float, simply change the 3 functions to include it. If you run out of parms or need to transfer significantly higher volumes of information, as Conquest did, you may need access to FRIK_FILE, an engine extension that lets you do file I/O. In Conquest, every weapon and shield has a host of stats, and the player can have up to 5 weapons and 3 shields. There was no way I'd fit all that into the parm# variables. :)

FRIK_FILE is more complex than the parms, and ties you to the engines that support it. When possible, try to use the parm variables.

I hope that helps!
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.
Wazat
 
Posts: 771
Joined: Fri Oct 15, 2004 9:50 pm
Location: Middle 'o the desert, USA

Postby ceriux » Mon Nov 30, 2009 10:17 pm

looks like ill have to stick to FRIK_FILE, is there any documentation on it, or is prydon gate and conquest the only kind ill find on it?
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest