by Madfox » Sat Aug 22, 2009 1:53 am
I know it isn't a usual subject but I'm trying it out.
I made two models, one with the normal stand,walk, attack , pain and death functions.
And another one with the swim, atack, pain and death functions.
So they both behave as a land monster and the other one as a water monster.
I compared these two in one qc file, and made them go apart with an extra function.
This function is added as a "harpo_to_harpo" and a Harpo_to_harpi" function.
It took a while before I could make the qc running, but for sofar I have it made.
The both are running apart in Quake except for the fact I have to make a decision to make them glide into eachother.
Now I'm chewing on the last and hardest part as I realize I can make the monster get into the water and make it swim (I hope),
but I'm aware it will be really hard to get it out of it.
So Now I'm in the FIGHT.QC, added a new HarpCheckAttack and I lost my maths on the last part...
To keep it short I will only post the last part to make clear how this function is specified.
Code:
void() harpo_to_harpi =
{
self.th_stand = h_stand1;
self.th_walk = h_walk1;
self.th_run = h_run1;
self.th_die = harpi_die;
self.th_pain = harpi_pain;
self.th_missile = h_attack1;
self.th_melee = h_faint1;
self.flags = self.flags - (self.flags & FL_SWIM);
};
void() monster_harpi =
{
if (deathmatch)
{
remove(self);
return;
}
precache_model2 ("progs/harpi.mdl");
precache_model2 ("progs/pioen.mdl");
precache_model2 ("progs/h_model.mdl");
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
setmodel (self, "progs/harpi.mdl");
setsize (self, '-16 -16 -24', '16 16 24');
self.health = 25;
harpo_to_harpi ();
walkmonster_start ();
};
void() harpi_to_harpo =
{
self.th_stand = h_dwell1;
self.th_walk = h_swim1;
self.th_run = h_crawl1;
self.th_die = h_die1;
self.th_pain = harpo_pain;
self.th_melee = h_harp1;
self.flags = self.flags | FL_SWIM;
};
void() monster_harpo =
{
if (deathmatch)
{
remove(self);
return;
}
precache_model2 ("progs/harpo.mdl");
precache_model2 ("progs/pioen.mdl");
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
setmodel (self, "progs/harpo.mdl");
setsize (self, '-16 -16 -24', '16 16 24');
self.health = 25;
harpi_to_harpo ();
swimmonster_start();
};
I added the
self.flags = self.flags - (self.flags &|FL_ SWIM)]
for the land model and the
self.flags = self.flags | FL_SWIM;
for the water model.
To get a function for making the engine know when the model is on land and when it is in water I thought to make a CHeck_Attack function in the FIGHT.QC.
So I added a line in the AI.QC to the CheckAnyAttack and added
if(self.classname == "monster_harpio")
return HarpCheckAttack();
Now I am on the last part of the FIGHT.QC and I realize it might be possible to get the monster into the water and swim (I hope) but I might not get it out of it.
But it is this last part I can't get filled in.
I made a regular CheckAttack and started at the top with something like
float() HarpCheckAttack =
{
local vector spot1, spot2;
local entity targ;
local float chance;
targ = self.enemy;
// see if any entities are in the way of the shot
spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;
traceline (spot1, spot2, FALSE, self);
if(self.th_stand = harpo_stand1) //if not swimming
{
if (self.waterlevel == 3)
harpo_to_harpi();
return TRUE;
}
// else
// {
// if( /*insert decision making code for standing up here*/)
// harpi_to_harpo();
// }
if (trace_inopen && trace_inwater)
return FALSE; // sight line crossed contents
if (trace_ent != targ)
return FALSE; // don't have a clear shot
etc
The FIGHT.QC keeps giving the error "harpo_stand1 not defined"
and I can't find a way to get the right thread.
I know it is a rather long thread to post, but I'm wrenching myself so long with it I wondered if someone had a clue to it.
Maybe it just ain'rt possible and I'm looking for something that doesn't fit in the Quake engine, but I was curious.
Thanks.