How do you 'run' an animated .mdl?
Moderator: InsideQC Admins
5 posts
• Page 1 of 1
How do you 'run' an animated .mdl?
Dear Gurus,
I have a .mdl which has 6 frames, and am trying to install it in the code. It's a pool of goo on the ground which spreads - once. Currently it appears, but doesn't animate. I've been rtfming like mad about .mdls, frame macros, syntax etc, but there's some essential piece missing from my understanding:
The syntax above is well documented, BUT how do we then run these animations in quakec? When the entity is spawned I tried:
It didn't animate. Then I tried:
Nothing. I tried to make the animation loop over and over by making foo_6 'point' to foo_1 as the next function (just to see it
working) via:
But it didn't animate. I checked that the right mdl exists in fortress/progs. I tried slowing down the animation via:
but there was no difference..
I'm sure there's a link somewhere but all I've found is either basic syntax, or advanced stuff w new animation systems.
[EDIT] I tried a good ol' dprint:
and it DIDN'T print! So it's possible the frame stuff is set up correctly, but the prob is the way they are (not) being called. Something's missing...
Any ideas?
Thanks,
OneManClan
I have a .mdl which has 6 frames, and am trying to install it in the code. It's a pool of goo on the ground which spreads - once. Currently it appears, but doesn't animate. I've been rtfming like mad about .mdls, frame macros, syntax etc, but there's some essential piece missing from my understanding:
- Code: Select all
// so we first do this:
$cd /quake/fortress/progs/foo.mdl
// when the .mdl spawns it already gets told where to 'materialize' (via setorigin), so I'm not sure why we need this:
$origin 0 0 8
$base base
$skin skin
// I assume the bit below names the frames of the foo.mdl
// (Btw: what 'connects' it to 'foo.mdl' (above)?
// shouldn't all the animation code for one 'mdl' be all in one {} ?
// many qc files have multiple 'mdl definitons', yet they don't conflict )
$frame foo1 foo2 foo3 foo4 foo5 foo6
void() foo_1 = [$foo1, foo_2 ] {};
void() foo_2 = [$foo2, foo_3 ] {};
void() foo_3 = [$foo3, foo_4 ] {};
void() foo_4 = [$foo4, foo_5 ] {};
void() foo_5 = [$foo5, foo_6 ] {};
void() foo_6 = [$foo6, foo_6 ] {}; // since it runs once I made foo_6 play itself over and over
The syntax above is well documented, BUT how do we then run these animations in quakec? When the entity is spawned I tried:
- Code: Select all
foo = spawn();
foo.mdl = "progs/foo.mdl"
foo_1();
It didn't animate. Then I tried:
- Code: Select all
foo = spawn();
foo.think = foo_1; //??
Nothing. I tried to make the animation loop over and over by making foo_6 'point' to foo_1 as the next function (just to see it
working) via:
- Code: Select all
void() foo_6 = [$foo6, foo_1 ] {};
But it didn't animate. I checked that the right mdl exists in fortress/progs. I tried slowing down the animation via:
- Code: Select all
void() foo_1 = [$foo1, foo_2 ] {self.nextthink = time + 1.0;};
but there was no difference..
I'm sure there's a link somewhere but all I've found is either basic syntax, or advanced stuff w new animation systems.
[EDIT] I tried a good ol' dprint:
- Code: Select all
void() foo_1 = [$foo1, foo_2 ] {dprint("we are animating\n"};
and it DIDN'T print! So it's possible the frame stuff is set up correctly, but the prob is the way they are (not) being called. Something's missing...
Any ideas?
Thanks,
OneManClan
- OneManClan
- Posts: 243
- Joined: Sat Feb 28, 2009 2:38 pm
qc only cares about the $frame line. the other $base $skin $origin stuff are not used by qc.
try to insert the line '$flush' bfore the '$frame' line, so any preceeding $frame macros in your code do not affect your blob (not sure if it exists in frikqcc, but does in fteqcc).
set developer 1. with that set, it should start warning when invalid frames are requested.
try to insert the line '$flush' bfore the '$frame' line, so any preceeding $frame macros in your code do not affect your blob (not sure if it exists in frikqcc, but does in fteqcc).
set developer 1. with that set, it should start warning when invalid frames are requested.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
Spike wrote:qc only cares about the $frame line. the other $base $skin $origin stuff are not used by qc.
I see.
Spike wrote: try to insert the line '$flush' bfore the '$frame' line, so any preceeding $frame macros in your code do not affect your blob (not sure if it exists in frikqcc, but does in fteqcc).
I was gonna say that "there aren't any preceding $frame macros in this QuakeC file" but then realised that that might not be the case post compilation, so ok.
Spike wrote:set developer 1. with that set, it should start warning when invalid frames are requested.
Thanks Spike, will do.
I'm still not sure I'm 'calling' the animation the right way.. I tried yet another approach (wild newbie stab in the dark):
- Code: Select all
void (entity blob) blobFrame =
{
local entity e;
if (blob.frame > 6)
return;
e = spawn();
e.classname = "timer";
e.netname = "blobframeincrementer";
e.owner = blob;
e.think = blobFrame; // not sure this line is needed
e.nextthink = time + 1.0;
blob.frame = blob.frame + 1; // I'm sure this is wrong
};
No difference.
What system/code/technique should I be using to make this animate?
- OneManClan
- Posts: 243
- Joined: Sat Feb 28, 2009 2:38 pm
- Code: Select all
void () blob_anim =
{
if (self.frame > $foo6 )
{
remove (self); // skip this line if you want the puddle to stay
return;
}
self.frame = self.frame + 1;
self.think = blob_anim ();
self.nextthink = time + 0.1;
};
void (vector org) spawn_goo_puddle =
{
local entity puddle;
puddle = spawn ();
setmodel (puddle, "progs/foo.mdl");
setorigin (puddle, org);
puddle.frame = $foo1;
puddle.angles = '0 0 0';
puddle.solid = SOLID_NOT;
puddle.movetype = MOVETYPE_NONE;
puddle.think = blob_anim ();
puddle.nextthink = time + 0.1;
};
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
frag.machine wrote:
- Code: Select all
void () blob_anim =
{
if (self.frame > $foo6 )
{
remove (self); // skip this line if you want the puddle to stay
return;
}
self.frame = self.frame + 1;
self.think = blob_anim ();
self.nextthink = time + 0.1;
};
void (vector org) spawn_goo_puddle =
{
local entity puddle;
puddle = spawn ();
setmodel (puddle, "progs/foo.mdl");
setorigin (puddle, org);
puddle.frame = $foo1;
puddle.angles = '0 0 0';
puddle.solid = SOLID_NOT;
puddle.movetype = MOVETYPE_NONE;
puddle.think = blob_anim ();
puddle.nextthink = time + 0.1;
};
Thanks frag.machine, this worked beautifully
- OneManClan
- Posts: 243
- Joined: Sat Feb 28, 2009 2:38 pm
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest