Tutorial Requests
Moderator: InsideQC Admins
66 posts
• Page 5 of 5 • 1, 2, 3, 4, 5
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. :)
-

Supa - Posts: 164
- Joined: Tue Oct 26, 2004 8:10 am
Centerprint Tutorial kind of thing!
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);
};
-

Error - InsideQC Staff
- Posts: 865
- Joined: Fri Nov 05, 2004 5:15 am
- Location: VA, USA
-

Error - InsideQC Staff
- Posts: 865
- Joined: Fri Nov 05, 2004 5:15 am
- Location: VA, USA
66 posts
• Page 5 of 5 • 1, 2, 3, 4, 5
Who is online
Users browsing this forum: No registered users and 1 guest
