Author Topic: Trouble coding monsters like Insane in BAND using Q2 Engine  (Read 1793 times)

Offline Ace

  • Full Member
  • ***
  • Posts: 143
  • Band, the MMORPGDM
    • View Profile
    • ACE Intergraphs
  • Rated:
Trouble coding monsters like Insane in BAND using Q2 Engine
« on: January 09, 2011, 12:02:48 PM »
I am trying to get this rat to work, but there is one small issue, using this command in the code: walkmonster_start (self);  :exqueezeme: CRASHES the game.  I have everythign setup right, only thing is there are only 2 animation modes, walk, and stand!  Is there something I am doing wrong with this code?

Quote
/*
Copyright (C) 1997-2001 Id Software, Inc.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 

See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/
/*
==============================================================================

BAND Rat

==============================================================================
*/

#include "g_local.h"
#include "m_rat.h"

//static int   sound_squeek;

void rat_stand (edict_t *self);
void rat_walk (edict_t *self);

mframe_t rat_frames_stand [] =
{
   ai_stand, 0,   NULL,   // idle 0
   ai_stand, 0,   NULL,   // idle 1
   ai_stand, 0,   NULL,   // idle 2
   ai_stand, 0,   NULL,   // idle 3
   ai_stand, 0,   NULL,   // idle 4
   ai_stand, 0,   NULL,   // idle 5
   ai_stand, 0,   NULL,   // idle 6
   ai_stand, 0,   NULL,   // idle 7
   ai_stand, 0,   NULL,   // idle 8
   ai_stand, 0,   NULL,   // idle 9
   ai_stand, 0,   NULL,   // idle 10
   ai_stand, 0,   NULL,   // idle 11
   ai_stand, 0,   NULL,   // idle 12
   ai_stand, 0,   NULL   // idle 13
};
mmove_t rat_move_stand = {FRAME_stand0, FRAME_stand14, rat_frames_stand, rat_stand};

void rat_stand (edict_t *self)
{
         self->monsterinfo.currentmove = &rat_move_stand;
}

mframe_t rat_frames_walk [] =
{
   ai_walk,   0,   NULL,   // walk 14
   ai_walk,   0,   NULL,   // walk 15
   ai_walk,   0,   NULL,   // walk 16
   ai_walk,   0,   NULL,   // walk 17
   ai_walk,   0,   NULL,   // walk 18
   ai_walk,   0,   NULL,   // walk 19
   ai_walk,   0,   NULL,   // walk 20
   ai_walk,   0,   NULL,   // walk 21
   ai_walk,   0,   NULL,   // walk 22
   ai_walk,   0,   NULL,   // walk 23
   ai_walk,   0,   NULL,   // walk 24
   ai_walk,   0,   NULL,   // walk 25
   ai_walk,   0,   NULL,   // walk 26
   ai_walk,   0,   NULL,   // walk 27
   ai_walk,   0,   NULL,   // walk 28
   ai_walk,   0,   NULL,   // walk 29
   ai_walk,   0,   NULL,   // walk 30
   ai_walk,   0,   NULL,   // walk 31
   ai_walk,   0,   NULL,   // walk 32
   ai_walk,   0,   NULL,   // walk 33
   ai_walk,   0,   NULL,   // walk 34
   ai_walk,   0,   NULL,   // walk 35
   ai_walk,   0,   NULL,   // walk 36
   ai_walk,   0,   NULL,   // walk 37
   ai_walk,   0,   NULL,   // walk 38
   ai_walk,   0,   NULL,   // walk 39
   ai_walk,   0,   NULL,   // walk 40
   ai_walk,   0,   NULL,   // walk 41
   ai_walk,   0,   NULL,   // walk 42
   ai_walk,   0,   NULL,   // walk 43
   ai_walk,   0,   NULL   // walk 44
};
mmove_t rat_move_walk = {FRAME_walk0, FRAME_walk44, rat_frames_walk, rat_walk};

void rat_walk (edict_t *self)
{
         self->monsterinfo.currentmove = &rat_move_walk;
}

/*BANDED misc_rat (1 .5 0) (-4 -14 -6) (4 14 6)
*/

void SP_misc_rat (edict_t *self)
{
   if (deathmatch->floatVal)
   {
      G_FreeEdict (self);
      return;
   }

   //sound_squeek = gi.soundindex ("squeek.wav");

   self->movetype = MOVETYPE_STEP;
   self->solid = SOLID_BBOX;
   self->s.modelIndex = gi.modelindex("models/monsters/rat/tris.md2");
   Vec3Set (self->mins, -4, -14, -6);
   Vec3Set (self->maxs, 4, 14, 6);

   self->health = 100;
   self->mass = 25;

   self->monsterinfo.stand = rat_stand;
   self->monsterinfo.walk = rat_walk;
   self->monsterinfo.run = NULL;
   self->monsterinfo.dodge = NULL;
   self->monsterinfo.attack = NULL;
   self->monsterinfo.melee = NULL;
   self->monsterinfo.sight = NULL;
   self->monsterinfo.idle = NULL;
   self->monsterinfo.aiflags |= AI_GOOD_GUY;

   gi.linkentity (self);

   if (self->spawnflags & 0)            // Stand Ground
      self->monsterinfo.aiflags |= AI_STAND_GROUND;

   self->monsterinfo.currentmove = &rat_move_stand;
   
   self->monsterinfo.scale = MODEL_SCALE;

   walkmonster_start (self);
}[/glow]

OH and there is an H file with the proper animation frame names!

Quote
// Generated by ModelEd

#define FRAME_stand0   0
#define FRAME_stand1   1
#define FRAME_stand2   2
#define FRAME_stand3   3
#define FRAME_stand4   4
#define FRAME_stand5   5
#define FRAME_stand6   6
#define FRAME_stand7   7
#define FRAME_stand8   8
#define FRAME_stand9   9
#define FRAME_stand10   10
#define FRAME_stand11   11
#define FRAME_stand12   12
#define FRAME_stand13   13
#define FRAME_stand14   14
#define FRAME_walk0      15
#define FRAME_walk1      16
#define FRAME_walk2      17
#define FRAME_walk3      18
#define FRAME_walk4      19
#define FRAME_walk5      20
#define FRAME_walk6      21
#define FRAME_walk7      22
#define FRAME_walk8      23
#define FRAME_walk9      24
#define FRAME_walk10   25
#define FRAME_walk11   26
#define FRAME_walk12   27
#define FRAME_walk13   28
#define FRAME_walk14   29
#define FRAME_walk15   30
#define FRAME_walk16   31
#define FRAME_walk17   32
#define FRAME_walk18   33
#define FRAME_walk19   34
#define FRAME_walk20   35
#define FRAME_walk21   36
#define FRAME_walk22   37
#define FRAME_walk23   38
#define FRAME_walk24   39
#define FRAME_walk25   40
#define FRAME_walk26   41
#define FRAME_walk27   42
#define FRAME_walk28   43
#define FRAME_walk29   44
#define FRAME_walk30   45
#define FRAME_walk31   46
#define FRAME_walk32   47
#define FRAME_walk33   48
#define FRAME_walk34   49
#define FRAME_walk35   50
#define FRAME_walk36   51
#define FRAME_walk37   52
#define FRAME_walk38   53
#define FRAME_walk39   54
#define FRAME_walk40   55
#define FRAME_walk41   56
#define FRAME_walk42   57
#define FRAME_walk43   58
#define FRAME_walk44   59

#define MODEL_SCALE   2.000000

and everythign else seems to be set right in the fgd using worldcraft, and its not teh game, becuase I tested Insane and he worked perfectly, besides missin ghte model, becuase our game don't have that model.  but it was acting and moveing like normal!

Can someone tell me whats wrong... and here is the identifiers as well in spawn.c

Quote
{"misc_rat", SP_misc_rat},

Quote
void SP_misc_rat (edict_t *self);

and in the fgd file for worldcraft it looks like this...

Quote
@PointClass base(Appearflags, Targetname, Target) size(-4 -14 -6, 4

14 6) = misc_rat : "rat1"
[
   spawnflags(Flags) =
   [
      1 : "Ambush" : 0
      2 : "Trigger Spawn" : 0
   ]
   deathtarget(string) : "Entity to trigger at death"
   killtarget(string) : "Entity to remove at death"
   item(string) : "Item to spawn at death"
]

Everything seems to look right, but it crashes the game always on map load...

any ideas without adding new frames, or animations to the rat??

Anyways thsi si driving me nuts!  :exqueezeme:  :biggungrin:  :evilgrin:  :rocketright:  :rocketleft:  :frustration:  :bigcry:  :raincloud:  :fight:  :dohdohdoh:

Thanks ahead of the time....
« Last Edit: January 09, 2011, 12:06:38 PM by Ace »
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
~~Ace~~

Offline peewee_RotA

  • Brobdingnagian Member
  • ***
  • Posts: 4152
  • Hi, I'm from the gov'ment and I'm here to help you
    • View Profile
  • Rated:
Re: Trouble coding monsters like Insane in BAND using Q2 Engine
« Reply #1 on: January 09, 2011, 12:15:00 PM »
Look in g_monster.c

The walkmonsterstart is what actually spawns that monster. What you are probably doing is either creating an infinite recursive loop or somehow deleting that entity and using it's null reference.


What you want to do is call the actual walking function rat_walk

Although this may also cause an issue. walkmonsterstart is supposed to place the monster into it's walking frames by default.
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
GOTO ROTAMODS (rocketgib)
GOTO ROTAMAPS (fireworks)
HappyFriar- q2server.fuzzylogicinc.com
 Tune in to the Tastycast!!!!  http://dna.zeliepa.net

Offline Ace

  • Full Member
  • ***
  • Posts: 143
  • Band, the MMORPGDM
    • View Profile
    • ACE Intergraphs
  • Rated:
Re: Trouble coding monsters like Insane in BAND using Q2 Engine
« Reply #2 on: January 09, 2011, 01:21:59 PM »
and how am I supposed to fix this loop?

Quote
The walkmonsterstart is what actually spawns that monster.

not really about this walkmonsterstart.... it does not start the spawn process its starts the ai process, becuase when I take it out, he is visable just not animating or moving....

it also drops the character/model to ground if in air, and also removes it from the map if its inside walls or floors, and not in the map itself...
« Last Edit: January 13, 2011, 10:20:53 AM by Ace »
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
~~Ace~~

Offline Ace

  • Full Member
  • ***
  • Posts: 143
  • Band, the MMORPGDM
    • View Profile
    • ACE Intergraphs
  • Rated:
Re: Trouble coding monsters like Insane in BAND using Q2 Engine
« Reply #3 on: January 13, 2011, 10:22:34 AM »
I guess there is not enough coders in the pool of questionary subjects.... so I take no one has a clue as to why this is happening?
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
~~Ace~~

 

El Box de Shoutamente

Last 10 Shouts:

 

Costigan_Q2

November 11, 2024, 06:41:06 AM
"Stay cozy folks.

Everything is gonna be fine."

There'll be no excuses for having TDS after January 20th, there'll be no excuses AT ALL!!!
 

|iR|Focalor

November 06, 2024, 03:28:50 AM
 

RailWolf

November 05, 2024, 03:13:44 PM
Nice :)

Tom Servo

November 04, 2024, 05:05:24 PM
The Joe Rogan Experience episode 223 that dropped a couple hours ago with Musk, they're talking about Quake lol.
 

Costigan_Q2

November 04, 2024, 03:37:55 PM
Stay cozy folks.

Everything is gonna be fine.
 

|iR|Focalor

October 31, 2024, 08:56:37 PM
 

Costigan_Q2

October 17, 2024, 06:31:53 PM
Not activated your account yet?

Activate it now! join in the fun!

Tom Servo

October 11, 2024, 03:35:36 PM
HAHAHAHAHAHA
 

|iR|Focalor

October 10, 2024, 12:19:41 PM
I don't worship the devil. Jesus is Lord, friend. He died for your sins. He will forgive you if you just ask.
 

rikwad

October 09, 2024, 07:57:21 PM
Sorry, I couldn't resist my inner asshole.

Show 50 latest
Welcome, Guest. Please login or register.
November 26, 2024, 01:59:58 PM

Login with username, password and session length