|
Re: str_for_entfile using last model name?
[Re: SH6811]
#179547
01/24/08 00:23
01/24/08 00:23
|
Joined: Sep 2003
Posts: 281 Arkansas\USA
raiden
Member
|
Member
Joined: Sep 2003
Posts: 281
Arkansas\USA
|
... and you have MODELS like this: Code:
define max_models, 100; var MODELS[max_models];
... and offset like this: Code:
define offset, skill1;
Just wanted to make sure those things were setup correct. -raiden
"It doesn't matter if we win or lose, it's how we make the game."-------------------- Links: 3DGS for Dummies
|
|
|
Re: str_for_entfile using last model name?
[Re: raiden]
#179548
01/24/08 00:26
01/24/08 00:26
|
Joined: Jan 2004
Posts: 59
SH6811
OP
Junior Member
|
OP
Junior Member
Joined: Jan 2004
Posts: 59
|
|
|
|
Re: str_for_entfile using last model name?
[Re: SH6811]
#179549
01/24/08 01:03
01/24/08 01:03
|
Joined: Sep 2003
Posts: 281 Arkansas\USA
raiden
Member
|
Member
Joined: Sep 2003
Posts: 281
Arkansas\USA
|
Some things to try: 1. str_cpy(entname," "); before initializing entname to the character name file.
2. wait(1); before str_for_entfile(entname,me);.
3. Create a text object displaying entname, and put a breakpoint in the action to see if the name does change(hold ctrl+space to continue breakpoint stops). This isn't a fix, but it may help spot the problem.
-raiden
"It doesn't matter if we win or lose, it's how we make the game."-------------------- Links: 3DGS for Dummies
|
|
|
Re: str_for_entfile using last model name?
[Re: raiden]
#179550
01/24/08 03:03
01/24/08 03:03
|
Joined: Jan 2004
Posts: 59
SH6811
OP
Junior Member
|
OP
Junior Member
Joined: Jan 2004
Posts: 59
|
|
|
|
Re: str_for_entfile using last model name?
[Re: SH6811]
#179553
01/25/08 07:35
01/25/08 07:35
|
Joined: Sep 2003
Posts: 281 Arkansas\USA
raiden
Member
|
Member
Joined: Sep 2003
Posts: 281
Arkansas\USA
|
I believe your losing it because SAMPLE_ENT is not being intialized properly in the "second()" function. I had a much better explanation a couple of hours ago before I started scripting out your problem, but its 1:30am, and my brain is fried, so I can't remember what it was, . Anyway, I hope you like this piece I did for you. Code:
define maxModels, 100; // maximum models define maxModelTypes, 10; // maximum model types //-- define typeMONSTERS, 0; //define up 9 more types here, must initialize to 1,2,3,4... //-- define offset, skill1; //-- var MODELS[maxModelTypes]; //-- // multiarray - supports 10 types of different models, up to 10 each // i.e. typeMONSTERS with skill1 offset from 0-9 // typeTREES with skill1 offset from 0-9 // etc. var MORPHMDLS[1000]; // 10x100 multiarray //-- var fncMorphCheck; //-- entity* tempPtr; //-- string entname; //-- function setEntName(mdlType,index) { if(mdlType == typeMONSTERS && index < maxModelTypes) { my = ptr_for_handle(MODELS[index]); // get me } //-- str_for_entfile(entname,my); // copy the entity into the string //-- if(mdlType == typeMONSTERS && str_len(entname) > 0) { MORPHMDLS[typeMONSTERS*maxModels+index] = handle(entname); // save a handle to the string } // more types //-- if(str_len(entname) == 0) { error("entname not initialized!"); } if(index >= maxModelTypes || mdlType >= maxModelTypes){ error("Invalid type or index"); } } //-- function morphEntName(mdlType,index) { if(mdlType == typeMONSTERS && index < maxModelTypes) { my = ptr_for_handle(MODELS[index]); // get me tempPtr = ptr_for_handle(MORPHMDLS[typeMONSTERS*maxModels+index]); // get ptr from name if(tempPtr == NULL) { breakpoint; } ent_morph(my,tempPtr); // morph me to ptr from name } // more types //-- if(index >= maxModelTypes || mdlType >= maxModelTypes){ error("Invalid type or index"); } } //-- action entityMonster { if(my.offset < maxModelTypes) { MODELS[my.skill1] = handle(my); } if(my.offset >= maxModelTypes) { error("Invalid offset!"); return; } //-- setEntName(typeMONSTERS,my.skill1); // set the entity name //-- //..testing ent_morph(me,"ball.mdl"); //.. wait(-5); morphEntName(typeMonsters,my.skill1); // get the entity name, and morph back //-- }
Hope thats what your after, I tested it and it works great. Let em know if you have any questions. -raiden
"It doesn't matter if we win or lose, it's how we make the game."-------------------- Links: 3DGS for Dummies
|
|
|
|