View previous topic :: View next topic |
Author |
Message |
FrikaC Site Admin

Joined: 08 Oct 2004 Posts: 947
|
Posted: Thu Sep 27, 2007 2:13 pm Post subject: |
|
|
It's returned as an error, not merely a warning in FrikQCC, because a prototype defines the variable as constant. Any constants not assigned a value at the end cause an error.
Last edited by FrikaC on Thu Sep 27, 2007 4:09 pm; edited 1 time in total |
|
Back to top |
|
 |
redrum

Joined: 28 Mar 2007 Posts: 367 Location: Long Island, New York
|
Posted: Thu Sep 27, 2007 2:17 pm Post subject: |
|
|
I'm confused. What should I do next? _________________ Welcome to the Overlook Hotel 69.113.123.178:27500 |
|
Back to top |
|
 |
FrikaC Site Admin

Joined: 08 Oct 2004 Posts: 947
|
Posted: Thu Sep 27, 2007 2:33 pm Post subject: |
|
|
Make sure visible() from the ai.qc in the original Quake exists in your code, not merely as a prototype. |
|
Back to top |
|
 |
Orion

Joined: 12 Jan 2007 Posts: 413 Location: Brazil
|
Posted: Thu Sep 27, 2007 2:52 pm Post subject: |
|
|
Oh, great.
Now I've seen my modified ai.qc at the PasteBin, and there's no visible() and infront() in there!
redrum: Paste visible() and infront() from your original ai.qc after range() from my modified ai.qc. _________________ There's no signature here. Stop looking for one. |
|
Back to top |
|
 |
redrum

Joined: 28 Mar 2007 Posts: 367 Location: Long Island, New York
|
Posted: Thu Sep 27, 2007 7:18 pm Post subject: |
|
|
Still crashing
Server error messages:
Client redrum connected
redrum entered Spisi's Fragfest!
walkmonster in wall at: '463.0 -543.0 185.0'
CALL1 13893(anglemod)()
ai.qc : FacingIdeal
ai.qc : ai_run_melee
ai.qc : ai_run
dog.qc : dog_run2
<NO FUNCTION>
NULL function
SV_Error: Program error
It seems once cujo senses me, it then crashes.
I have all those functions called in their respective files.
This is in ai.qc
Code: | /*
============
FacingIdeal
============
*/
float() FacingIdeal =
{
local float delta;
delta = anglemod(self.angles_y - self.ideal_yaw);
if (delta > 45 && delta < 315)
return FALSE;
return TRUE;
};
//=============================================================================
float() DogCheckAttack;
float() CheckAnyAttack =
{
if (!enemy_vis)
return FALSE;
if (self.classname == "monster_dog")
return DogCheckAttack ();
return CheckAttack ();
};
/*
=============
ai_run_melee
Turn and close until within an angle to launch a melee attack
=============
*/
void() ai_run_melee =
{
self.ideal_yaw = enemy_yaw;
ChangeYaw ();
if (FacingIdeal())
{
self.th_melee ();
self.attack_state = AS_STRAIGHT;
}
};
/*
=============
ai_run_missile
Turn in place until within an angle to launch a missile attack
=============
*/
void() ai_run_missile =
{
self.ideal_yaw = enemy_yaw;
ChangeYaw ();
if (FacingIdeal())
{
self.th_missile ();
self.attack_state = AS_STRAIGHT;
}
};
/*
=============
ai_run_slide
Strafe sideways, but stay at aproximately the same range
=============
*/
void() ai_run_slide =
{
local float ofs;
self.ideal_yaw = enemy_yaw;
ChangeYaw ();
if (self.lefty)
ofs = 90;
else
ofs = -90;
if (walkmove (self.ideal_yaw + ofs, movedist))
return;
self.lefty = 1 - self.lefty;
walkmove (self.ideal_yaw - ofs, movedist);
};
/*
=============
ai_run
The monster has an enemy it is trying to kill
=============
*/
void(float dist) ai_run =
{
local vector delta;
local float axis;
local float direct, ang_rint, ang_floor, ang_ceil;
movedist = dist;
// see if the enemy is dead
if (self.enemy.health <= 0)
{
self.enemy = world;
// FIXME: look all around for other targets
if (self.oldenemy.health > 0)
{
self.enemy = self.oldenemy;
HuntTarget ();
}
else
{
if (self.movetarget)
self.th_walk ();
else
self.th_stand ();
return;
}
}
self.show_hostile = time + 1; // wake up other monsters
// check knowledge of enemy
enemy_vis = visible(self.enemy);
if (enemy_vis)
self.search_time = time + 5;
// look for other coop players
if (coop && self.search_time < time)
{
if (FindTarget ())
return;
}
enemy_infront = infront(self.enemy);
enemy_range = range(self.enemy);
enemy_yaw = vectoyaw(self.enemy.origin - self.origin);
if (self.attack_state == AS_MISSILE)
{
//dprint ("ai_run_missile\n");
ai_run_missile ();
return;
}
if (self.attack_state == AS_MELEE)
{
//dprint ("ai_run_melee\n");
ai_run_melee ();
return;
}
if (CheckAnyAttack ())
return; // beginning an attack
if (self.attack_state == AS_SLIDING)
{
ai_run_slide ();
return;
}
// head straight in
movetogoal (dist); // done in C code...
}; |
and dog.qc...
Code: | void() dog_run1 =[ $run1 , dog_run2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "dog/idle.wav", 1, ATTN_IDLE);
ai_run(16);};
void() dog_run2 =[ $run2 , dog_run3 ] {ai_run(32);};
void() dog_run3 =[ $run3 , dog_run4 ] {ai_run(32);};
void() dog_run4 =[ $run4 , dog_run5 ] {ai_run(20);};
void() dog_run5 =[ $run5 , dog_run6 ] {ai_run(64);};
void() dog_run6 =[ $run6 , dog_run7 ] {ai_run(32);};
void() dog_run7 =[ $run7 , dog_run8 ] {ai_run(16);};
void() dog_run8 =[ $run8 , dog_run9 ] {ai_run(32);};
void() dog_run9 =[ $run9 , dog_run10 ] {ai_run(32);};
void() dog_run10 =[ $run10 , dog_run11 ] {ai_run(20);};
void() dog_run11 =[ $run11 , dog_run12 ] {ai_run(64);};
void() dog_run12 |
_________________ Welcome to the Overlook Hotel 69.113.123.178:27500
Last edited by redrum on Thu Sep 27, 2007 7:38 pm; edited 2 times in total |
|
Back to top |
|
 |
Orion

Joined: 12 Jan 2007 Posts: 413 Location: Brazil
|
Posted: Thu Sep 27, 2007 7:35 pm Post subject: |
|
|
Redrum, I'm sorry.. I've taken off anglemod(), visible() and infront from my modified ai.qc to use with my bots...
Just paste this at the very top of ai.qc:
Code: |
float(float v) anglemod =
{
while (v >= 360)
v = v - 360;
while (v < 0)
v = v + 360;
return v;
};
|
And to avoid the walkmonster in wall at 'origin', change the setsize() line at monster_dog to this:
Code: |
setsize (self, '-16 -16 -24', '16 16 40');
|
This will make the dog to don't get stuck in the wall. _________________ There's no signature here. Stop looking for one. |
|
Back to top |
|
 |
vegetous

Joined: 25 Oct 2006 Posts: 14
|
|
Back to top |
|
 |
redrum

Joined: 28 Mar 2007 Posts: 367 Location: Long Island, New York
|
Posted: Tue Oct 02, 2007 4:15 am Post subject: |
|
|
Cujo is working great! Killing people at will!
One small problem. When Cujo telefrags a player it just says "you were telefragged by". How can I add "Cujo" to the end.
I tried this in ClientObituary:
Code: | if (attacker.classname == "teledeath" && (attacker.classname == "monster_dog"))
{
bprint (PRINT_MEDIUM,targ.netname);
bprint (PRINT_MEDIUM," was telefragged by ");
bprint (PRINT_MEDIUM,attacker.owner.netname); ???
bprint (PRINT_MEDIUM,"\n");
return;
} |
Problem is Cujo doesn't have a .netname (I think this is the problem).
How can I get him one? _________________ Welcome to the Overlook Hotel 69.113.123.178:27500 |
|
Back to top |
|
 |
Orion

Joined: 12 Jan 2007 Posts: 413 Location: Brazil
|
Posted: Tue Oct 02, 2007 4:20 am Post subject: |
|
|
At monster_dog(), add this line at the very top:
Code: |
self.netname = "Cujo";
|
This will give it a name to be displayed on the obituary. _________________ There's no signature here. Stop looking for one. |
|
Back to top |
|
 |
redrum

Joined: 28 Mar 2007 Posts: 367 Location: Long Island, New York
|
Posted: Tue Oct 02, 2007 4:25 am Post subject: |
|
|
I actually figured that one out, got the same answer that you gave me!
Thanks. _________________ Welcome to the Overlook Hotel 69.113.123.178:27500 |
|
Back to top |
|
 |
Electro
Joined: 29 Dec 2004 Posts: 241 Location: Brisbane, Australia
|
|
Back to top |
|
 |
redrum

Joined: 28 Mar 2007 Posts: 367 Location: Long Island, New York
|
Posted: Tue Oct 02, 2007 2:30 pm Post subject: |
|
|
Is that a dingo!? Scary! _________________ Welcome to the Overlook Hotel 69.113.123.178:27500 |
|
Back to top |
|
 |
Sajt
Joined: 16 Oct 2004 Posts: 1026
|
Posted: Tue Oct 02, 2007 3:14 pm Post subject: |
|
|
It looks like a killer breed of warrior wolf _________________ F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe. |
|
Back to top |
|
 |
|