Page 2 of 2

Re: Can't get this code to work

PostPosted: Sun Apr 28, 2013 6:30 pm
by TechieUK
I'm not too familiar with the debugger. How exactly can it reveal crash causes? Does it print it somewhere?

Re: Can't get this code to work

PostPosted: Sun Apr 28, 2013 6:37 pm
by Corewarp
TechieUK wrote:That does seem to have fixed something. They can spawn without a crash. However, then only assume the form of the regular manhack model. I'm assuming the crash could even have been a problem with the watermelon.mdl


The Source Engine doesn't like it when you try to give improper models to NPCs.
Are you absolutely sure it's meant to work with a watermelon?

Re: Can't get this code to work

PostPosted: Sun Apr 28, 2013 6:46 pm
by Sandern
TechieUK wrote:I'm not too familiar with the debugger. How exactly can it reveal crash causes? Does it print it somewhere?

Did you follow the instructions from VDC? You just run it from visual studio and when it crashes it will return to visual studio. You can then check the callstack.

You will be interested to see if crashes from the manhack code somewhere. For example, if it crashes on "PrecacheModel" or "SetModel", then the engine probably can't load the model (maybe it was compiled for a newer version of Source Engine?).

Re: Can't get this code to work

PostPosted: Sun Apr 28, 2013 7:20 pm
by TechieUK
OK then, I'll try the debugger.

About the prop, I'm going to try with the Valve one in props_junk instead of my own recompiled one. It should be OK with that one. I'm not sure if it's relevant, but in GMod I was able to model manipulate it onto a manhack so I was chased by watermelons.

Re: Can't get this code to work

PostPosted: Sun Apr 28, 2013 8:51 pm
by Stormy
I'm pretty sure that with NPC's the engine searches for certain animation sequences for events, like how the manhack opens its blades when it gets close to you. If you don't have these sequences present in the .mdl it will cause problems. I think Garrrrrrrys mod gets around this by discarding animations when you change the model or something.

Re: Can't get this code to work

PostPosted: Mon Apr 29, 2013 12:11 pm
by Corewarp
Black_Stormy wrote:I'm pretty sure that with NPC's the engine searches for certain animation sequences for events, like how the manhack opens its blades when it gets close to you. If you don't have these sequences present in the .mdl it will cause problems. I think Garrrrrrrys mod gets around this by discarding animations when you change the model or something.


Stormy is right. GMod deals with NPCs and animations very differently(with a lot more lenience towards derpy model setups).

Regular Source shuts down more or less completely if you feed it a bogus model.

Re: Can't get this code to work

PostPosted: Mon Apr 29, 2013 2:10 pm
by TechieUK
I think I'd be better off duplicating the Manhack NPC and having spawn codes for each different type. I was able to make one assume the form of G-Man before, so they can use other models.

However, I'm assuming npc_template_maker will randomly choose templates if you specify multiple with the same name?

Re: Can't get this code to work

PostPosted: Tue Apr 30, 2013 11:59 am
by ScarT
G-Man and all other humanoid models use the same skeleton thus can use the same animations (and do).
The watermelon is a physics prop with one bone (I haven't checked, I'm guessing) and the manhack is a relatively complicated model for its size. I wouldn't be surprised if the model is the problem.

Re: Can't get this code to work

PostPosted: Tue Apr 30, 2013 3:19 pm
by kraid
You should rig the model to the manhack skeleton and compile it.
That way all the animations and bones are there, but they won't have any geometry connected to them.
The Melon will be rigged to the same bone as the main body of the manhack was.
Don't forget to change the physic model the same way and include the manhack animations into the .qc

Re: Can't get this code to work

PostPosted: Tue Apr 30, 2013 7:24 pm
by Stormy
studiomdl discards any bones that don't have at least one face rigged to them, so if you want to do it that way you'll have to create a few tiny floating triangles and rig one to each bone I think.

Re: Can't get this code to work

PostPosted: Wed May 01, 2013 5:19 am
by kraid
I never had issues with that, i guess the important thing is that the model is set up as animated model, has the right animations applied that are called by code and is rigged to the same skeleton (or parts of it) used for the animations.

As for the tiny floating triangles thing, i don't think that would be necessary.

Re: Can't get this code to work

PostPosted: Thu May 02, 2013 2:59 pm
by TechieUK
I think I've finally got around it by making a new NPC.

Re: Can't get this code to work

PostPosted: Tue Feb 11, 2014 11:41 pm
by AniCator
In what scope is your 'modelnames' variable defined?

EDIT: Crap, I see I'm late to the party. ;)