Forum

Weapons using player model

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Weapons using player model

Postby ceriux » Fri Oct 30, 2015 4:15 am

I really have a few questions is it possible to not assign the player with a model in the usual way? For instance is it okay to set it using set attachment instead? And if so after doing so can i also make weapons show in a similar way? Or do i have to do all of that plus some hacky stuff like still assigning regular models in the regular way but making them invisible on top of doing set attchements?

Also would anyone mind telling me the exact functions needed to make a weapon work? I've looked through qc106 and I can edit it fine. But deciding what functions are exactly required and where to start when coding from scratch is a bit confusing for me.

Lastly do you have to use macros for for animation? Or can i set States and do like

Code: Select all
if (self.state == a )
{
If (time => 0.1)

Self.frame = self.frame + 1;
Else if (self.frame > 6)
Self.frame = 1;
}


I know that code is probably wrong to start with but I'm typing from my phone and honestly haven't done qc in a long time. Hopefully you get where I'm coming from.
User avatar
ceriux
 
Posts: 2220
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: Weapons using player model

Postby frag.machine » Fri Oct 30, 2015 9:13 am

What exactly are you trying to do ? Using what engine: FTE, Darkplaces, vanilla GlQuake, something else... ? What model format ?
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2029
Joined: Sat Nov 25, 2006 1:49 pm

Re: Weapons using player model

Postby ceriux » Fri Oct 30, 2015 6:27 pm

set attachments only available using dp and fte i believe. but i plan to use Darkplaces. havent fully decided. basically i want to make my game/mod using scratch code. firstly i want to draw the player model with something like setattachment rather than setting it normally. so that i can make weapons for both first and third person at the same time. ill obviously have to arrange the camera so that it looks as decent as possible. but ill do that using csqc. also i dont like macros... i feel like they're confusing and a waste of time. id rather just set the frame using the number rather than macros... like since i usually make my own models i already know which frames are what i dont need a macro to remind me "hey this is the walk frame" so id rather simplify my animation code if possible.

(yes id like my player to see their feet)

i hope thats a better explanation.
User avatar
ceriux
 
Posts: 2220
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: Weapons using player model

Postby Spike » Fri Oct 30, 2015 8:39 pm

if you're using csqc, you can put your camera whereever you want, and put the player whereever you want (regardless of where it is in the ssqc).
and yes, if you're using csqc, use only states in ssqc, and have the csqc figure out which frames+lerp factors to use so that the player's feet keep synced with the ground regardless of the actual speed of the player.
Spike
 
Posts: 2853
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Weapons using player model

Postby ceriux » Fri Oct 30, 2015 8:59 pm

I don't know if I'll be using csqc to display my players model. I was never able to get a model to actually follow the player when using csqc. It sorta just spawned and sat there. I'll probably just use csqc for hud,ui,and positioning my camera.
User avatar
ceriux
 
Posts: 2220
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: Weapons using player model

Postby frag.machine » Fri Oct 30, 2015 9:14 pm

About the first question (is it possible to just use setattachment instead assigning a model to the entity ?): my understanding(*) is that setattachment needs to know where you are attaching the model to your entity and usually this information is part of the main model metadata. IIRC one can define such tag data programatically, but unless we are talking about very simple models and animations I wouldn't bother trying this.

(*) Of course, I may be completely wrong :) - because my knowledge is based on how Quake 3 works; because all my attempts to use multipart models always involved 2 or more entities glued with MOVETYPE_FOLLOW and lots of ssqc (exactly the opposite Spike recommended to you); and specially if we are talking about FTE and/or csqc.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2029
Joined: Sat Nov 25, 2006 1:49 pm

Re: Weapons using player model

Postby frag.machine » Fri Oct 30, 2015 9:16 pm

About the first question (is it possible to just use setattachment instead assigning a model to the entity ?): my understanding(*) is that setattachment needs to know where you are attaching the model to your entity and usually this information is part of the main model metadata. IIRC one can define such tag data programatically, but unless we are talking about very simple models and animations I wouldn't bother trying this.

(*) Of course, I may be completely wrong :) - because my knowledge is based on how Quake 3 works; because all my attempts to use multipart models always involved 2 or more entities glued with MOVETYPE_FOLLOW and lots of ssqc (exactly the opposite Spike recommended to you); and specially if we are talking about FTE and/or csqc.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2029
Joined: Sat Nov 25, 2006 1:49 pm

Re: Weapons using player model

Postby frag.machine » Fri Oct 30, 2015 9:19 pm

(please ignore the double post, my phone hiccupped :P )
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2029
Joined: Sat Nov 25, 2006 1:49 pm

Re: Weapons using player model

Postby drm_wayne » Sun Nov 01, 2015 9:58 pm

i remember some mod called "super torso" which has exactly that what you want using MD3 models and setattachment.
The md3 models worked as both for 1st and 3rd person (the players view was glued to a md3 tag).
User avatar
drm_wayne
 
Posts: 232
Joined: Sat Feb 11, 2012 5:47 pm

Re: Weapons using player model

Postby ceriux » Sun Nov 01, 2015 10:31 pm

ill look into that wayne. i'm just assuming the player is always an enitity and i could just pull cords from the player and have a model follow it. arranging the camera in csqc shouldnt be hard. i'm sure theres a better way than what im thinking to do it and if its in that mod (and i can find the mod) ill do it that way, if im able to understand it anyways..
User avatar
ceriux
 
Posts: 2220
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: Weapons using player model

Postby silverjoel » Wed Nov 11, 2015 6:27 pm

I added a tag_eyes on the head model and than attached the camera to that. It works out quite nicely, but DP uses the offset of the normal view for height which means water gets a little tricky.

I have a fully functional segmented md3 player model with weapons.
silverjoel
 
Posts: 46
Joined: Thu Sep 30, 2010 6:46 am


Return to QuakeC Programming

Who is online

Users browsing this forum: Google [Bot] and 1 guest