Forum

Backpack Weight

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Backpack Weight

Postby redrum » Fri Sep 26, 2008 4:12 pm

Guys, I need a hand again.
Currently in my mod your backpack has a weight value (depending on how much ammo and how many weapons you are carrying).
Right now it will sprint the value when you pick up ammo 50% of the time.
I'd like that it was permanent up in the righthand corner instead of the FPS value.
Can someone point me in the right direction?
Thanks in advance.
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby MeTcHsteekle » Fri Sep 26, 2008 5:09 pm

i think that it would be needed in the engine to do that

or maybe csqc, but i dont know much about that atm
bah
MeTcHsteekle
 
Posts: 399
Joined: Thu May 15, 2008 10:46 pm
Location: its a secret

Postby r00k » Fri Sep 26, 2008 6:20 pm

You could put a centerprint in client.qc, PlayerPostThink
centerprint (self,"/n/n/n/n/n/n ",string);
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm

Postby redrum » Fri Sep 26, 2008 9:13 pm

Wouldn't that conflict with other centerprints?
I use centerprint a lot in my mod.
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Lardarse » Fri Sep 26, 2008 10:15 pm

Sounds like you may need to construct centerprints by hand.

If your centerprints are using less then about 4 the 7 strongs they can receive, then you can use probably the remaining 3 to print the weight at the bottom.

Otherwise, you may be constructing centerprints manually. See Frik's Tetris mod for an example. If you are targetting an enging with DP_SV_WRITEUNTERMINATEDSTRING then it will be a lot easier...
User avatar
Lardarse
 
Posts: 266
Joined: Sat Nov 05, 2005 1:58 pm
Location: Bristol, UK

Postby redrum » Sat Sep 27, 2008 9:26 pm

I'm trying this in PlayerPreThink:
Code: Select all
        z = ftos(self.weight);
        centerprint (self, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nyour backpack weighs" z "pounds");

It won't compile. How can I get the "z" to print the variable self.weight?
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby MeTcHsteekle » Sat Sep 27, 2008 10:34 pm

perhaps you could try somthing with gyro to get that to work,
somthing with mass and can....err... perhaps i should fully cook my ideas before i serve them, heh
bah
MeTcHsteekle
 
Posts: 399
Joined: Thu May 15, 2008 10:46 pm
Location: its a secret

Postby Error » Sun Sep 28, 2008 5:12 am

Code: Select all
z = ftos(self.weight);
        centerprint (self, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nYour Backpack Weighs", z, "pounds");


fixed, use that
User avatar
Error
InsideQC Staff
 
Posts: 865
Joined: Fri Nov 05, 2004 5:15 am
Location: VA, USA

Postby redrum » Sun Sep 28, 2008 11:46 pm

That didn't work, but I did figure it out:
Code: Select all
        x = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nbackpack weight: ";
        y = ftos(self.weight);
        z = " pounds";
        specialprint (self, x, y, z);
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Lardarse » Mon Sep 29, 2008 12:06 am

redrum wrote:That didn't work


It does if you change your definition of centerprint (I can't remember how exactly, search these forums for varargs) and use a compiler that supports that method (FrikQCC or FTEQCC).
User avatar
Lardarse
 
Posts: 266
Joined: Sat Nov 05, 2005 1:58 pm
Location: Bristol, UK

Postby Spike » Mon Sep 29, 2008 8:53 am

The alternate version doesn't work any differently.

void(...) centerprint = #whatever; works as expected with all qc compilers, though most people create multiple versions if they want support for more than just frikqcc/fteqcc due to the benefits of type checking.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby Lardarse » Tue Sep 30, 2008 9:08 pm

Spike wrote:void(...) centerprint = #whatever; works as expected with all qc compilers, though most people create multiple versions if they want support for more than just frikqcc/fteqcc due to the benefits of type checking.

Which is why it'smore usually void(entity client, string s, ...) centerprint = #73; to force the first two inputs to be correct.
User avatar
Lardarse
 
Posts: 266
Joined: Sat Nov 05, 2005 1:58 pm
Location: Bristol, UK


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest