View unanswered posts | View active topics * FAQ    * Search
* Login 




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 14 posts ] 
Alkor
 
PostPosted: Mon, Feb 27 2012, 6:38 AM 

User avatar

Player

Joined: 25 Feb 2010
Location: Somewhere on a tiny speck of a planet, in a tiny speck of a universe.

Hi, I'm script-tarded and my generator has failed me, but, bare the pain and try to see what I'm attempting to do...

On use of object, get pc, get pc body part head

-and then Add '1' to the current head number retrieved. So I can apply this to an on-use function of an object in the test module, and each time I click it, it changes the head appearance to the next model.

*brace for shock and horror*

void main()
{

object oPC = GetLastUsedBy();

if (!GetIsPC(oPC)) return;

int GetCreatureBodyPart(int nHEAD, object oCreature=OBJECT_SELF)
//I don't even know if the line above this one even works...
// This is the line where it would add '1' to the current number retrieved

//Then this is the line where it would set the appearance
}

I don't want to use:

SetCreatureBodyPart(int nPart, int nModelNumber, object oCreature=OBJECT_SELF)

-cause that seems to require a specific number. I just want it to get it, add +1up Mario style, and set it.

Any alley cats out there know their stuff?

_________________
When good wins the day, and evil is destroyed, then the movie is over ...and you do something else.

Let's make it, not over.


 
      
Glim
 
PostPosted: Mon, Feb 27 2012, 6:43 AM 

User avatar

Player

Joined: 13 Jul 2010
Location: British Columbia

*edit* Eigh.... teach me to post before reading fully...

Will look when I can get to the toolset.


 
      
HellScourge
 
PostPosted: Mon, Feb 27 2012, 6:53 AM 

User avatar

Player

Joined: 17 Jan 2007
Location: GMT+1

Glim wrote:
*edit* Eigh.... teach me to post before reading fully...

Will look when I can get to the toolset.


Selective reading at its finest.

I also read "Script kiddie alert! Scary stuff, really."

Eitherway, carry on! Nothing bad to see here.

_________________
"Most assume that all the followers of Lathander are great morning people. They're very wrong."
"I think we are the only group where AD&D stands for Attention Deficit Disorder."
TeroSNS wrote:
Hello Everyone [...] I like tentacles [...] :)


 
      
Glim
 
PostPosted: Mon, Feb 27 2012, 7:17 AM 

User avatar

Player

Joined: 13 Jul 2010
Location: British Columbia

Try this:
Code:
void main()
{

object oPC = GetLastUsedBy();

if (!GetIsPC(oPC)) return;

//Get the Head Model Number
int nPartNum = GetCreatureBodyPart(CREATURE_PART_HEAD, oPC);

//Add 1 to the Head Model Number
nPartNum = (nPartNum + 1);

//Set the new head based on the new Head Model Number
SetCreatureBodyPart(CREATURE_PART_HEAD, nPartNum, oPC);

}

You may also need something in there to check whether the value returned once it adds a 1, is true or not. Not sure how the model numbers work at the back end, whether they're just a straight number or not.

*edit*

Looks like they return as true numbers, there's just no models to go with the number, so it shows just an empty neck stump for a few clicks once you get into the higher numbers. Could be annoying to reach the "outlandish" head models that way... will tinker a bit.


 
      
Glim
 
PostPosted: Mon, Feb 27 2012, 7:28 AM 

User avatar

Player

Joined: 13 Jul 2010
Location: British Columbia

(sorry for the double post)

Doesn't appear possible to "skip" blank head model numbers, as they are still valid entries. What I'd suggest would be to maybe look at doing this as a custom conversation that offers all the actual head model entries that are "populated" to be selected, and then a simple script to change the talking PC's head model to that chosen number.

Assuming you're after a way to easily look through all available models.

That being said the conversation would take more time and effort to set up, as you'd have to make an entry for each model, for each race. You'd also have to add in a check in the conversation, so that it would show only the appropriate models for the appropriate races, since each race has a different number of available heads and such.


 
      
Selvec Darkon
 
PostPosted: Mon, Feb 27 2012, 8:24 AM 

User avatar

Player

Joined: 12 Oct 2005
Location: On a Disk, carried by four elephants, which stand on a gigantic turtle.

I take it your trying to script up a head changer. I had one I scripted up a few months back, but I lost it. Was part of a proposal to Disco for adding a headchanger to Amia. We tried it and it failed due to some issues with crashing the server, etc. He did his disco magic to my ghastly scripting and it still didn't work. So if you plan on using this with a server, be aware that issues can exist.

If you want to skip the blanks, make the head changer not actually just +1, make it reference the actual head number, and change to that head. The downside to this method is you have to script in new head enteries everytime you add a head. This method can drive you insane if you have 100+ heads btw.

_________________
I keels u with my axe!

"Do ye know where the Holy-Flamin' Frost-brand Gronk-slayin' Vorpal Hammer o' woundin' an' returnin' an' Shootin'-Lightnin'-out-yer-bum is?"


 
      
Moth
 
PostPosted: Mon, Feb 27 2012, 8:46 AM 

User avatar

Player

Joined: 14 Sep 2011

Lexicon says: "Returns CREATURE_PART_INVALID if used on a non-creature object, or if the creature does not use a part based model."

So I'm guessing because it checks the creature's model type rather than the validity of individual parts that means you can't just check that the head is valid (i.e. not missing) and nPartNum++ in a loop until a valid part is found or you reach 202, which I believe is the highest numbered head for any race and gender.

Quite the predicament '_' A variant on Selvec's idea would be to tell it to skip over heads you know don't exist, but he's right - it's time-consuming and subject to change. I wonder if there's a way to make it check for the head .mdl file and skip it if the file doesn't exist?


edit: Okay so I've got an idea about how you might go about this task a little easier. You create a set of 2da files, two for each race and separated by gender, then you populate a list of valid heads using a DOS batch program which checks the files and notes whether the file does or doesn't exist in the 2da. Then you can use Get2daString in nwscript to check that the file exists and skip to the next nPartNum and the next line in the 2da, check whether that exists, etcetera. It's still a lot of work, but it'd be much easier to update.

_________________
Image Image Image
Zeskija Inalka - Catkin Meadowleaf - Xyme Thanas'ka


 
      
Selmak
 
PostPosted: Mon, Feb 27 2012, 13:48 PM 

User avatar

Player

Joined: 17 Dec 2004

Looping through a 2DA table just to note that a particular value does not have a valid head associated with it is a bit inefficient though. If you have the know-how, much better to write a program that can print just the valid head numbers to the 2DA table. And since it's a 2DA table, you can probably fit all the races and genders into the columns.

Oh crap, I just volunteered myself for this job, didn't I?


 
      
Moth
 
PostPosted: Mon, Feb 27 2012, 18:29 PM 

User avatar

Player

Joined: 14 Sep 2011

XD I had the same feeling. The idea's sound and the effort to code it isn't unreasonable, but effort is definitely the word.

And yea, listing the valid files and asking for the next one down is a better idea :3

In any case, here's the facts:
head files come in twos, .mdl files and .plt files.
They are split into gender, race and phenotype in the following format:

pm/fa/d/e/g/h/o0/2_head000

So there are: (Amia custom head lowest and highest numbers)

pfa0 female, halfling, normal (012 - 020)
pfa2 female, halfling, large (013 - 018)
pfd0 female, dwarf, normal (013 - 021)
pfd2 female, dwarf, large (011 - 021)
pfe0 female, elf, normal (001 - 191)
pfe2 female, elf, large
pfg0 female, gnome, normal (013 - 016)
pfg2 female, gnome, large
pfh0 female, human, normal (029 - 199)
pfh2 female, human, large (028 - 048)
pfo0 female, orc, normal (150)
pfo2 female, orc, large (150)
pma0 male, halfling, normal (011 - 193)
pma2 male, halfling, large (009 - 023)
pmd0 male, dwarf, normal (014 - 138)
pmd2 male, dwarf, large (014 - 025)
pme0 male, elf, normal (001 - 202)
pme2 male, elf, large
pmg0 male, gnome, normal (014 - 120)
pmg2 male, gnome, large (012 - 120)
pmh0 male, human, normal (001 - 202)
pmh2 male, human, large (022 - 162)
pmo0 male, orc, normal (014 - 199)
pmo2 male, orc, large (014 - 150)

Other strange head files in my override folder are:
pms0_head184
pms0_head187
pfao_head011 (likely a misspelled file, using an 'o' instead of a '0')

There are in total 1210 relevant files (ignoring the three strange / erroneous files search everything found in my override folder '-') I believe this means the 2da file would be a minimum of 1212 lines long. I believe you'd need three columns if you wanted to put it into one .2da file: Label, head number and the gender / race / phenotype format. If you put it into separate files you'd only need 2 and you'd save yourself some scripting to check and loop through to the group in the 2da that's suitable for your gender/race/pheno. So I still think separate 2da files are better :P

Anyway, the above is based on files dated 09/12/2011. Hope that date is after the latest file update :3 Also hope this helps for anyone who wants to take on this task.

_________________
Image Image Image
Zeskija Inalka - Catkin Meadowleaf - Xyme Thanas'ka


 
      
Alkor
 
PostPosted: Tue, Feb 28 2012, 8:59 AM 

User avatar

Player

Joined: 25 Feb 2010
Location: Somewhere on a tiny speck of a planet, in a tiny speck of a universe.

Wow...this got a lot more complicated than I imagined it would be.

First off thanks for all the input, and keep 'er commin'.

I'm wanting the script so that I can design characters in my own custom module and see how they actually look In Game instead of that mini-ridiculous image at character creation that doesn't take into account wind effects on hair, lighting issues, hard to see eye colors or the face close-up at all, and sometimes in game even has noticeable lines through the face.

Basically to pretest overall -actual- look, before I make a character that gets saved into a player-unchangeable server-vault. I can edit my local-vault all day long with glee.

So far, according to my most likely limited understanding...

A. Set the script +1, and click over 200 times every-time I'm browsing head models. Write an identical script with -1 to an object in-case I pass it, so that 200 doesn't instantly become 400. It might be workable? -given looooots of clicking... (oh wait Moth says there's over 1,210 options..yay...*SIGHH*)

B. Learn how to script in every single valid head line, individually. -basically, "Learn how to actually script you silly kiddie! ...oh btw, it will take you hours...which for a noobie like you likely translates into days or weeks." btw just how are you going to know which is valid and which is not? Test every single one? *FacepalmAlertActivated*.

C. Beg Selmak til he has the extra time/patience. Either to teach me how to (Write a Program!?!??) or just do it him/her-self, the former is longer than the latter and likely requires buckets of headache medication, however there is the ole 'Teach a man to fish, or give him a fish' concept. For the record, I have not written a program from scratch...ever. I wish I was that cool. I can cheat at minesweeper using a memory scanner program...sooo (not)l33t.

D. ..and an idea I thought of.... Use Leto to set the appearance, over and over, and over, and over, and- Oooor make new characters over, and over and over with various headsets I 'might' like. Very inefficient imo.

----

The results are in (pretty quick counting with one voter). :wink:

Selmak for most effective idea thus far. 8)

Meow? *cute kitty-eye-rays of begging* :twisted:


...now to figure out how I even get a script to check the values in a new custom 2da table. *ear scratch*

...oh ya, and then apply those values... *furball-cough*

_________________
When good wins the day, and evil is destroyed, then the movie is over ...and you do something else.

Let's make it, not over.


 
      
Moth
 
PostPosted: Tue, Feb 28 2012, 10:50 AM 

User avatar

Player

Joined: 14 Sep 2011

Alkor wrote:
Set the script +1, and click over 200 times every-time I'm browsing head models. Write an identical script with -1 to an object in-case I pass it, so that 200 doesn't instantly become 400. It might be workable? -given looooots of clicking... (oh wait Moth says there's over 1,210 options..yay...*SIGHH*)


Erm...

The pseudocode would be like this:

Ask for the valid part number noted on line 1 of the .2da file appropriate for my gender, race and phenotype. We'll call it headmh0.2da
Apply that head to the character
If 'next' is selected, ask for the valid part number noted on line 2 of headmh0.2da

The alternative would be to pile all the heads into one .2da file and ask for the first nPartNum on line 1 if line 1's gender/race/phenotype column matches your gender, race and phenotype, otherwise skip to the next line until you have the first match.

_________________
Image Image Image
Zeskija Inalka - Catkin Meadowleaf - Xyme Thanas'ka


 
      
Selmak
 
PostPosted: Wed, Feb 29 2012, 3:48 AM 

User avatar

Player

Joined: 17 Dec 2004

Well I can tell you that if you were writing it in VB.net, there are new file system methods there which would make it much easier than in VB6, where all you had for checking if a file existed was the Dir command!


 
      
Moth
 
PostPosted: Wed, Feb 29 2012, 10:29 AM 

User avatar

Player

Joined: 14 Sep 2011

Man, I haven't used Visual Basic in... 8 years I think? 'S 'cause it sucks. If I wanna' manipulate files I go straight to Batch because it exists specifically to deal with files.

_________________
Image Image Image
Zeskija Inalka - Catkin Meadowleaf - Xyme Thanas'ka


 
      
Alkor
 
PostPosted: Fri, Mar 02 2012, 4:05 AM 

User avatar

Player

Joined: 25 Feb 2010
Location: Somewhere on a tiny speck of a planet, in a tiny speck of a universe.

*the nwn script kiddie cheers from the side-lines*

..you guys are on a level, that I am currently ..not on. I wish I could comment more to help beyond this point, but I admit I simply don't know enough about it.

I just wanted to post to say that, I'm not ignoring the topic or anything, I'm just at a loss of helpful things to say.

So,

Cheers!

_________________
When good wins the day, and evil is destroyed, then the movie is over ...and you do something else.

Let's make it, not over.


 
      
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 14 posts ] 


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group