Inside3D!
     

Backpack Weight

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
redrum



Joined: 28 Mar 2007
Posts: 367
Location: Long Island, New York

PostPosted: Fri Sep 26, 2008 4:12 pm    Post subject: Backpack Weight Reply with quote

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 69.113.123.178:27500
Back to top
View user's profile Send private message Send e-mail
MeTcHsteekle



Joined: 15 May 2008
Posts: 397
Location: its a secret

PostPosted: Fri Sep 26, 2008 5:09 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message AIM Address
r00k



Joined: 13 Nov 2004
Posts: 483

PostPosted: Fri Sep 26, 2008 6:20 pm    Post subject: Reply with quote

You could put a centerprint in client.qc, PlayerPostThink
centerprint (self,"/n/n/n/n/n/n ",string);
Back to top
View user's profile Send private message
redrum



Joined: 28 Mar 2007
Posts: 367
Location: Long Island, New York

PostPosted: Fri Sep 26, 2008 9:13 pm    Post subject: Reply with quote

Wouldn't that conflict with other centerprints?
I use centerprint a lot in my mod.
_________________
Welcome to the Overlook Hotel 69.113.123.178:27500
Back to top
View user's profile Send private message Send e-mail
Lardarse



Joined: 05 Nov 2005
Posts: 243
Location: Bristol, UK

PostPosted: Fri Sep 26, 2008 10:15 pm    Post subject: Reply with quote

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...
Back to top
View user's profile Send private message
redrum



Joined: 28 Mar 2007
Posts: 367
Location: Long Island, New York

PostPosted: Sat Sep 27, 2008 9:26 pm    Post subject: Reply with quote

I'm trying this in PlayerPreThink:
Code:
        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 69.113.123.178:27500
Back to top
View user's profile Send private message Send e-mail
MeTcHsteekle



Joined: 15 May 2008
Posts: 397
Location: its a secret

PostPosted: Sat Sep 27, 2008 10:34 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message AIM Address
Error
Inside3D Staff


Joined: 05 Nov 2004
Posts: 558
Location: VA, USA

PostPosted: Sun Sep 28, 2008 5:12 am    Post subject: Reply with quote

Code:

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
_________________
Inside3D : Knowledge Is Power
Darkplaces Documentation Wiki
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
redrum



Joined: 28 Mar 2007
Posts: 367
Location: Long Island, New York

PostPosted: Sun Sep 28, 2008 11:46 pm    Post subject: Reply with quote

That didn't work, but I did figure it out:
Code:
        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 69.113.123.178:27500
Back to top
View user's profile Send private message Send e-mail
Lardarse



Joined: 05 Nov 2005
Posts: 243
Location: Bristol, UK

PostPosted: Mon Sep 29, 2008 12:06 am    Post subject: Reply with quote

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).
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Mon Sep 29, 2008 8:53 am    Post subject: Reply with quote

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.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Lardarse



Joined: 05 Nov 2005
Posts: 243
Location: Bristol, UK

PostPosted: Tue Sep 30, 2008 9:08 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    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