![]() |
monstermaker tweak
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 |
Re: monstermaker tweak
*edit* stupid me, my reply was bullsh*t, please ignore this post. I need to get more sleep these days...
|
Re: monstermaker tweak
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 |
Re: monstermaker tweak
Quote:
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 |
Re: monstermaker tweak
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() Code:
void CBarney :: Spawn() Is that what you are doing? (edit: stupid smilies) botman |
Re: monstermaker tweak
Quote:
|
Re: monstermaker tweak
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 |
Re: monstermaker tweak
"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 |
Re: monstermaker tweak - Success
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 |
Re: monstermaker tweak
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. |
All times are GMT +2. The time now is 11:57. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.