visual equipment / setattachment / parent/child ents
Moderator: InsideQC Admins
18 posts
• Page 1 of 2 • 1, 2
visual equipment / setattachment / parent/child ents
Visual Equipment mod release:
download
readme
mods mainly for coop and ffa use because the armor makes it to where you cannot see your custom colors.
-------------------------------------------------
okay so iv been attempting to get visual gear/weapons into quake. essentially what i did was edit the original player model i split the head from the body and weapons. the only part of the players model that it is still tied to the original player ent is the head model.
i spawn a new ent (pbody) and give it , it's own model. i then give the ent a think and next think which points to my body_think function. the body_think function tells pbody, that its frames are the same as its parents frames. the parent being the player/owner of pbody.
here's the thing i join the game with chase_active on i see the body set its frames to the idle frames then it crashes DP.
iv been trying to get help on IRC with this for the past 3 days. but no one there seems to know whats wrong. id really appreciate it if anyone could please point out what iv done/doing wrong. ill post the code here and a link to a pastebin.
--- body(); is only called once in client connect. i don't spam it in playerprethink or playerpostthink.
http://pastebin.com/zjU7kC4E
EDIT : Right after i made this thread figured it out! im sorry, thread can be deleted. but ill post the fix and maybe the thread can be useful to someone else later on!
THE FIX:
download
readme
mods mainly for coop and ffa use because the armor makes it to where you cannot see your custom colors.
-------------------------------------------------
okay so iv been attempting to get visual gear/weapons into quake. essentially what i did was edit the original player model i split the head from the body and weapons. the only part of the players model that it is still tied to the original player ent is the head model.
i spawn a new ent (pbody) and give it , it's own model. i then give the ent a think and next think which points to my body_think function. the body_think function tells pbody, that its frames are the same as its parents frames. the parent being the player/owner of pbody.
here's the thing i join the game with chase_active on i see the body set its frames to the idle frames then it crashes DP.
iv been trying to get help on IRC with this for the past 3 days. but no one there seems to know whats wrong. id really appreciate it if anyone could please point out what iv done/doing wrong. ill post the code here and a link to a pastebin.
--- body(); is only called once in client connect. i don't spam it in playerprethink or playerpostthink.
http://pastebin.com/zjU7kC4E
- Code: Select all
// visual attachment stuff (currently crashes)
void() body_think =
{
self.think = self.frame = self.parent.frame; // bodies frame is "parents" frame
self.nextthink = time + 0.1; // think every 0.1 ticks
};
void() body =
{
self.pbody = spawn (); // spawn the body
self.pbody.parent = self ; // the bodies owner is the player
setmodel (self.pbody, "progs/body.mdl"); // he will get the player body model
setattachment (self.pbody, self.pbody.parent, ""); // attach the body model to "parent"
self.pbody.think = body_think; // make the body think
self.pbody.nextthink = time + 0.1; // it thinks every 0.1 ticks
};
EDIT : Right after i made this thread figured it out! im sorry, thread can be deleted. but ill post the fix and maybe the thread can be useful to someone else later on!
THE FIX:
- Code: Select all
void() body_think =
{
self.frame = self.parent.frame; // bodies frame is "parents" frame
self.think = body_think;
self.nextthink = time + 0.01; // think every 0.01 ticks
};
Last edited by ceriux on Sun Nov 03, 2013 5:51 am, edited 3 times in total.
-

ceriux - Posts: 2223
- Joined: Sat Sep 06, 2008 3:30 pm
- Location: Indiana, USA
Re: visual equipment / setattachment / parent/child ents
I've made a multi part player model using MOVETYPE_FOLLOW instead of setattachment (see earlier version). It's tricky to make the body react in a synchronous way, but feasible.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
-

frag.machine - Posts: 2090
- Joined: Sat Nov 25, 2006 1:49 pm
Re: visual equipment / setattachment / parent/child ents
i started using movetype_follow. i was told by LH that its not as good as setattachment, so i changed my code to use it.
it syncs pretty well as far as i can tell.
it syncs pretty well as far as i can tell.
-

ceriux - Posts: 2223
- Joined: Sat Sep 06, 2008 3:30 pm
- Location: Indiana, USA
Re: visual equipment / setattachment / parent/child ents
hrmm, I think it's about time to me to learn more about setattachment then. 
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
-

frag.machine - Posts: 2090
- Joined: Sat Nov 25, 2006 1:49 pm
Re: visual equipment / setattachment / parent/child ents
the code above could be used for weapons as well as a body =) right now im still using the quake guy. =) also works in multipalyer =)
-

ceriux - Posts: 2223
- Joined: Sat Sep 06, 2008 3:30 pm
- Location: Indiana, USA
Re: visual equipment / setattachment / parent/child ents
Sounds interesting , post a vid sample if u can.
-

Cobalt - Posts: 445
- Joined: Wed Jun 10, 2009 2:58 am
- Location: New England, USA
Re: visual equipment / setattachment / parent/child ents
sure as soon as i can. the current code posted above only draws the original body. but its easy enough to add in support for showing armors with a few lines (already added green armor.) id like to get some weapons added in before i make a video.
once i get all this added in, i might release the visual parts of my mod as a standalone so others can use it.
once i get all this added in, i might release the visual parts of my mod as a standalone so others can use it.
-

ceriux - Posts: 2223
- Joined: Sat Sep 06, 2008 3:30 pm
- Location: Indiana, USA
Re: visual equipment / setattachment / parent/child ents
This is what i use to attach stuff to the player (weapons, legs etc...), works great in DQuake, Darkplaces but in FTEQW the legs are not really
synced xD
I use custom scratch qc so some stuff might look weird...
Legs ingame:

Legs QC:
synced xD
I use custom scratch qc so some stuff might look weird...
Legs ingame:

Legs QC:
- Code: Select all
void() legs_update =
{
float chasecam;
chasecam = cvar("chase_active");
if (chasecam == 1)
setmodel (self, string_null);
else
setmodel (self, "progs/players/p_legs.md2");
if (self.owner.deadflag != DEAD_NO)
SUB_Remove();
if (self.owner.incam == TRUE) // Intermission, we dont need to see our legs here
SUB_Remove();
makevectors(self.owner.v_angle);
self.think = legs_update;
self.nextthink = time + 0.01;
self.angles_y = self.owner.angles_y;
self.origin = self.owner.origin + v_up*-20;
self.frame = self.owner.frame;
}
void() player_legs = //Called at PutClientInServer
{
local entity legs
makevectors(self.v_angle);
legs = spawn();
setmodel (legs, "progs/players/p_legs.md2");
legs.solid = #SOLID_NOT;
legs.movetype = #MOVETYPE_NOCLIP;
legs.owner = self;
legs.angles_y = self.angles_y;
legs.origin = self.origin;
legs.velocity = self.velocity;
legs.drawonlytoclient = self;
legs.frame = self.frame;
legs.think = legs_update;
legs.nextthink = time + 0.01;
}
-

drm_wayne - Posts: 232
- Joined: Sat Feb 11, 2012 5:47 pm
Re: visual equipment / setattachment / parent/child ents
float chasecam;
chasecam = cvar("chase_active");
if (chasecam == 1)
setmodel (self, string_null);
else
setmodel (self, "progs/players/p_legs.md2");
In DP there's a extension exactly to deal with this situation: IIRC is DP_VISIBLETOCLIENT. I'm using this and makes the code much simpler and elegant.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
-

frag.machine - Posts: 2090
- Joined: Sat Nov 25, 2006 1:49 pm
Re: visual equipment / setattachment / parent/child ents
fte defaults to prediction enabled.
cl_nopred to turn it off, or sv_nqplayerphysics to force it off for all clients (yay! authentic nq physics!).
you would see the same thing with DP and its cl_movement 1 setting.
setattachment works clientside so is meant to function properly regardless of prediction, instead of only when its disabled.
cl_nopred to turn it off, or sv_nqplayerphysics to force it off for all clients (yay! authentic nq physics!).
you would see the same thing with DP and its cl_movement 1 setting.
setattachment works clientside so is meant to function properly regardless of prediction, instead of only when its disabled.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
Re: visual equipment / setattachment / parent/child ents
frag.machine wrote:float chasecam;
chasecam = cvar("chase_active");
if (chasecam == 1)
setmodel (self, string_null);
else
setmodel (self, "progs/players/p_legs.md2");
In DP there's a extension exactly to deal with this situation: IIRC is DP_VISIBLETOCLIENT. I'm using this and makes the code much simpler and elegant.
I know, the qc i posted above is mainly designed for my customized PSP Engine, i already added some DP features like drawonlytoclient and nodrawtoclient.
-

drm_wayne - Posts: 232
- Joined: Sat Feb 11, 2012 5:47 pm
Re: visual equipment / setattachment / parent/child ents
Just a correction: the DP extension I was referring actually is DP_ENT_EXTERIORMODELTOCLIENT.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
-

frag.machine - Posts: 2090
- Joined: Sat Nov 25, 2006 1:49 pm
Re: visual equipment / setattachment / parent/child ents
update, im still working on this. got all the armor coded in, but the weapons are crashing the game so i have to figure that out first.
edit: so there wasnt any problem with my code, some how one of the models became corrupt and thats fixed. which essentially means there are 2 things left to do. there's a bug with the exit level cam where you see the body still, and theres a bug with ring of invisibility where you have a body walking around with a floating pair of eyes (kinda funny looking). after that all is finished! then i can release.
edit: so there wasnt any problem with my code, some how one of the models became corrupt and thats fixed. which essentially means there are 2 things left to do. there's a bug with the exit level cam where you see the body still, and theres a bug with ring of invisibility where you have a body walking around with a floating pair of eyes (kinda funny looking). after that all is finished! then i can release.
-

ceriux - Posts: 2223
- Joined: Sat Sep 06, 2008 3:30 pm
- Location: Indiana, USA
Re: visual equipment / setattachment / parent/child ents
sorry for double post, mod has been finished, ill add information to the top of post.
-

ceriux - Posts: 2223
- Joined: Sat Sep 06, 2008 3:30 pm
- Location: Indiana, USA
Re: visual equipment / setattachment / parent/child ents
Hey, it would be great if you could add a readme to the archive. Check out some readmes from idgames2 as good examples: https://www.quaddicted.com/files/idgame ... nversions/
For Quake file hosting there is http://quaketastic.com/ : quaketastic - ZigguratVertigoBlewTronynsSocksOff
For Quake file hosting there is http://quaketastic.com/ : quaketastic - ZigguratVertigoBlewTronynsSocksOff
Improve Quaddicted, send me a pull request: https://github.com/SpiritQuaddicted/Quaddicted-reviews
- Spirit
- Posts: 1031
- Joined: Sat Nov 20, 2004 9:00 pm
18 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 1 guest