Forum

Tutorial Requests

Discuss anything not covered by any of the other categories.

Moderator: InsideQC Admins

Postby Supa » Sat Feb 13, 2010 10:13 pm

So... I'm dusting this discussion off and am requesting for a generic tutorial that shows how to stick something to a player.

There really isn't that much to it. You just need to create your flag/arrow/etc as a helper entity with the stuck-to player as its' owner and depending on what engine you're targetting you could attach it in one of two ways.

If it *has* to work on every NQ engine, you'll need to have the helper entity think every server frame, updating its' origin and angles to match the .owner's angles every time. Keep in mind that this will produce choppier updates in MP as the server framerate will be running at sys_ticrate (usually 20fps by default in most NQ servers), SP runs a physics frame with every rendered frame iirc. Related to that, you'd probably want to cap origin/angles updates to 10~20/second and make sure you don't have _too_ many attached entities at any one time, this method has a capability of producing waaay too much network traffic.

If you're using DP, all you need to do just read up on DP_GFX_QUAKE3MODELTAGS here. You don't actually need the attachee to have any tags in order to attach something, calling setattachment without providing a tag name will just attach the entity to the attachee's origin.

I think QW is supposed to have an entity field for this, but since I don't have much gamecode experience in QW I'll leave it to someone who does. :)
User avatar
Supa
 
Posts: 164
Joined: Tue Oct 26, 2004 8:10 am

Postby ceriux » Sat Feb 13, 2010 10:35 pm

how about a reload with animations? im sure iv seen a thread for it multiple times. a step by step im sure would be helpful.
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Centerprint Tutorial kind of thing!

Postby Error » Sat Feb 13, 2010 11:31 pm

This will make a onscreen centerprint for important events that is always there:

Code: Select all
/*
 Centerprint Messenger
 By: Error
 
 In Defs.qc you  need to add this following at
 the bottom of the file:
 
 void(entity client, string s, string s, string s, string s, string s, string s, string s) centerprint7 = #73;
 .string message1, message2, message3, message4, message5, message6, message7;
*/

/*
 messenger_init ();
 sets all messages to blank with a few spaces
 to make the messages not move down when there
 are too many messages
 
 Put the Following Code in PutClientInServer ();
 located in client.qc:
 
    messenger_init ();
*/
void() messenger_init =
{
   self.message1 = "  \n";
   self.message2 = "  \n";
   self.message3 = "  \n";
   self.message4 = "  \n";
   self.message5 = "  \n";
   self.message6 = "  \n";
   self.message7 = "  \n";
};

/*
 add_message (entity slf, string new_mess);
 Moves all the messages up one when a new message
 is added to the queue.
 
 Anytime you want to add a message to the queue
 just call something like so:
 
   add_message (self, "You gained 15 health\n");
*/
void(entity slf, string new_mess) add_message =
{
   slf.message1 = slf.message2;
   slf.message2 = slf.message3;
   slf.message3 = slf.message4;
   slf.message4 = slf.message5;
   slf.message5 = slf.message6;
   slf.message6 = slf.message7;
   slf.message7 = new_mess;
};

/*
 messenger_main ();
 This is what makes your messages appear.  Special
 Note... since this will be called every frame, it
 will overwrite all other centerprints.
 
 Call this from PlayerPostThink in client.qc:
 
   messenger_main ();
*/
void() messenger_main =
{
   centerprint7 (self, self.message1, self.message2, self.message3, self.message4, self.message5, self.message6, self.message7);
};
User avatar
Error
InsideQC Staff
 
Posts: 865
Joined: Fri Nov 05, 2004 5:15 am
Location: VA, USA

Postby ceriux » Sat Feb 13, 2010 11:50 pm

i could see that code being used for a lot of things =)
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby Error » Sun Feb 14, 2010 12:24 am

indeed, I made one that used timers to get rid of messages too. maybe I'll upgrade it soon.
User avatar
Error
InsideQC Staff
 
Posts: 865
Joined: Fri Nov 05, 2004 5:15 am
Location: VA, USA

Postby lahore123 » Sun Feb 14, 2010 9:48 am

Have you upgraded it. please share with us. Thanks
________
Dc medical marijuana
lahore123
 
Posts: 1
Joined: Sun Feb 14, 2010 9:14 am

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest