.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > SDK Programming discussions > Half-Life 1 SDK
Half-Life 1 SDK For developments focused around Half-Life (and its mods) Half-Life

Reply
 
Thread Tools
monstermaker tweak
Old
  (#1)
desNotes
Member
 
Status: Offline
Posts: 12
Join Date: Jan 2004
Default monstermaker tweak - 07-04-2004


What I want to do is enhance monstermaker to be able to call out a specific model when it runs. I have modifed all the individual monster classnames and made it so a model other than default can be specified and it works.

I am able to get the model information from the monstermaker and set pev->model to the model I want. This seems to work as I added a few alerts and it verifies my model change.

However, when the classname is called (i.e. monster_barney) and runs through the following code:

if (pev->model)
SET_MODEL(ENT(pev), STRING(pev->model));


else
SET_MODEL(ENT(pev), "models/barney.mdl");

It always comes up as the default model. Apparently when it gets to the Precache(); for the classname the model is wiped out.

Any ideas of what I can do?

Thanks,

desNotes

Last edited by desNotes; 07-04-2004 at 05:14..
  
Reply With Quote
Re: monstermaker tweak
Old
  (#2)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: monstermaker tweak - 07-04-2004

*edit* stupid me, my reply was bullsh*t, please ignore this post. I need to get more sleep these days...



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."

Last edited by Pierre-Marie Baty; 07-04-2004 at 02:49..
  
Reply With Quote
Re: monstermaker tweak
Old
  (#3)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: monstermaker tweak - 07-04-2004

The model of the entity should be set in the Spawn() function for that entity.

Monstermaker is just a 'helper' entity that spawns other entities. It spawns the particular type of entity based on the Monstermaker 'monstertype' key...

http://collective.valve-erc.com/inde...t=monstermaker

What 'monstertype' are you using when you spawn your custom monster? Perhaps you should create a 'generic' monster that doesn't specify the model in the Spawn() function, let Monstermaker spawn the generic monster, then set that generic monster's model based on the new key you added to Monstermaker.

botman
  
Reply With Quote
Re: monstermaker tweak
Old
  (#4)
desNotes
Member
 
Status: Offline
Posts: 12
Join Date: Jan 2004
Default Re: monstermaker tweak - 07-04-2004

Quote:
Originally Posted by botman
The model of the entity should be set in the Spawn() function for that entity.

Monstermaker is just a 'helper' entity that spawns other entities. It spawns the particular type of entity based on the Monstermaker 'monstertype' key...

http://collective.valve-erc.com/inde...t=monstermaker

What 'monstertype' are you using when you spawn your custom monster? Perhaps you should create a 'generic' monster that doesn't specify the model in the Spawn() function, let Monstermaker spawn the generic monster, then set that generic monster's model based on the new key you added to Monstermaker.

botman
What I did was to incorporate a feature from Spirit of Half Life and make it so when the classname is called, a model other than the default can be called. For an example, I will use Barney. When monster_barney is called, there is an option to specify the model. I actually do this running Stripper2 and Metamod (after making some changes to Metamod).

So when CBarney :: Spawn() is called the model is checked in pev->model and if it is not there it gets the default. I did the same thing in monstermaker (I thought). I pull the model from the modified monstermaker format but when monstermaker calls CBarney :: Precache() I lose the pev->model. I am not up to speed on the namespaces and am wondering if I am just not calling the correct 'saved' variable in monstermaker while in monster_barney.

Thanks,

desNotes
  
Reply With Quote
Re: monstermaker tweak
Old
  (#5)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: monstermaker tweak - 07-04-2004

It's a little hard to understand what you are saying without seeing your code.

Precache() should only be precacheing resources needed by that monster. For example, in the SDK barney.cpp file, the CBarney::Precache() is...
Code:
void CBarney :: Precache()
{
PRECACHE_MODEL("models/barney.mdl");
PRECACHE_SOUND("barney/ba_attack1.wav" );
PRECACHE_SOUND("barney/ba_attack2.wav" );
PRECACHE_SOUND("barney/ba_pain1.wav");
PRECACHE_SOUND("barney/ba_pain2.wav");
PRECACHE_SOUND("barney/ba_pain3.wav");
PRECACHE_SOUND("barney/ba_die1.wav");
PRECACHE_SOUND("barney/ba_die2.wav");
PRECACHE_SOUND("barney/ba_die3.wav");
 
// every new barney must call this, otherwise
// when a level is loaded, nobody will talk (time is reset to 0)
TalkInit();
CTalkMonster::Precache();
}
...the Spawn() function calls Precache(), then it sets the model...
Code:
void CBarney :: Spawn()
{
Precache( );
SET_MODEL(ENT(pev), "models/barney.mdl");
UTIL_SetSize(pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX);
...what your code should be doing is CHANGING that model AFTER the Spawn() function returns back to the engine.

Is that what you are doing?

(edit: stupid smilies)

botman
  
Reply With Quote
Re: monstermaker tweak
Old
  (#6)
desNotes
Member
 
Status: Offline
Posts: 12
Join Date: Jan 2004
Default Re: monstermaker tweak - 07-04-2004

Quote:
Originally Posted by botman
It's a little hard to understand what you are saying without seeing your code.

Precache() should only be precacheing resources needed by that monster. For example, in the SDK barney.cpp file, the CBarney:recache() is...
Code:
void CBarney :: Precache()
{
PRECACHE_MODEL("models/barney.mdl");
PRECACHE_SOUND("barney/ba_attack1.wav" );
PRECACHE_SOUND("barney/ba_attack2.wav" );
PRECACHE_SOUND("barney/ba_pain1.wav");
PRECACHE_SOUND("barney/ba_pain2.wav");
PRECACHE_SOUND("barney/ba_pain3.wav");
PRECACHE_SOUND("barney/ba_die1.wav");
PRECACHE_SOUND("barney/ba_die2.wav");
PRECACHE_SOUND("barney/ba_die3.wav");
 
// every new barney must call this, otherwise
// when a level is loaded, nobody will talk (time is reset to 0)
TalkInit();
CTalkMonster::Precache();
}
...the Spawn() function calls Precache(), then it sets the model...
Code:
void CBarney :: Spawn()
{
Precache( );
SET_MODEL(ENT(pev), "models/barney.mdl");
UTIL_SetSize(pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX);
...what your code should be doing is CHANGING that model AFTER the Spawn() function returns back to the engine.

Is that what you are doing?

(edit: stupid smilies)

botman
I have tried to change the model after the Spawn() function and what I get is the regular Barney on the ground and the new model floating above. The new model is like monster_furniture (not killable) and if the default Barney is killed, he will come back with the default model.
  
Reply With Quote
Re: monstermaker tweak
Old
  (#7)
desNotes
Member
 
Status: Offline
Posts: 12
Join Date: Jan 2004
Default Re: monstermaker tweak - 07-04-2004

Here is some additional information that may explain my problem.


In monstermaker.cpp I added m_iszMonsterModel as part of the TYPEDESCRIPTION.

TYPEDESCRIPTION CMonsterMaker::m_SaveData[] =
{
DEFINE_FIELD( CMonsterMaker, m_iszMonsterClassname, FIELD_STRING ),
DEFINE_FIELD( CMonsterMaker, m_cNumMonsters, FIELD_INTEGER ),
DEFINE_FIELD( CMonsterMaker, m_cLiveChildren, FIELD_INTEGER ),
DEFINE_FIELD( CMonsterMaker, m_flGround, FIELD_FLOAT ),
DEFINE_FIELD( CMonsterMaker, m_iMaxLiveChildren, FIELD_INTEGER ),
DEFINE_FIELD( CMonsterMaker, m_fActive, FIELD_BOOLEAN ),
DEFINE_FIELD( CMonsterMaker, m_fFadeChildren, FIELD_BOOLEAN ),
DEFINE_FIELD( CMonsterMaker, m_iszMonsterModel, FIELD_STRING ),
};

When I attempt to call it up in barney.cpp

ALERT( at_console, "m_iszMonsterModel= (%s)\n",STRING( CMonsterMaker::m_iszMonsterModel)); //alert - desNotes

I receive the following errors:


C:\...\barney.cpp(453) : error C2653: 'CMonsterMaker' : is not a class or namespace name
C:\...\barney.cpp(453) : error C2065: 'm_iszMonsterModel' : undeclared identifier

How do I share the class monstermaker in barney.cpp?

Thanks,

desNotes
  
Reply With Quote
Re: monstermaker tweak
Old
  (#8)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: monstermaker tweak - 08-04-2004

"How do I share the class monstermaker in barney.cpp?"

Create a monstermaker.h file and put the CMonsterMaker class definition in it.

Include monstermaker.h at the top of monstermaker.cpp and include it at the top of barney.cpp. For both of these, include it AFTER all the other existing include files.

botman
  
Reply With Quote
Re: monstermaker tweak - Success
Old
  (#9)
desNotes
Member
 
Status: Offline
Posts: 12
Join Date: Jan 2004
Default Re: monstermaker tweak - Success - 19-04-2004

Just to follow-up I was able to add 'model' and 'body' to the monstermaker code. I thought I needed to do something in the classname of the monster being called but it was much too simple. By going into MakeMonster I just added model and body to pevCreate.

pevCreate->model = m_iszMonsterModel;
pevCreate->body = m_iszBody;


Thanks for all the help,

desNotes
  
Reply With Quote
Re: monstermaker tweak
Old
  (#10)
sfx1999
Member
 
sfx1999's Avatar
 
Status: Offline
Posts: 534
Join Date: Jan 2004
Location: Pittsburgh, PA, USA
Default Re: monstermaker tweak - 20-04-2004

Forgive me for not knowing much about programming, but maybe it is possible to set that in the Barney's constructor, have it change a private variable, and check it in the spawn function.

BTW, can't you have more than one constructor, too? Like with different types? That way you can still have other classes call it differently.

Make sure you put in some kind of protection against models that don't exist.
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com