View Full Version : Clothes Mod - Scripting help

07-31-2009, 11:22 PM
I've been playing around with some scripting, and I have this idea that I'm trying to get to work.

Basically, what I'm trying to do is to make an item (actually, many items) that gives you the appearance of the row right above you.

Let's say you were PFHC06 (blonde with the bun) and you equipped my item: The Assasin's Robe (BaseItem: Jedi Robe). What it would do is change your appearance to a row with the same head, but with different body models. In this particular case, you would be wearing the sith assassin's robe.

Basically, just a way to expand the number of body models you can wear.

Right now, I'm having it fire with ExecuteScript from the k_ai_master.ncs, but it fires every 3-6 seconds. Before I put the local numbers/booleans in, it would keep changing the appearance in the specified direction.

With the booleans/numbers in, it seemed to work, but there was a delay with changing the appearance. Also, when the item was unequipped, it didn't seem to want to change back.

void main() {

int nappearance = GetAppearanceType(GetFirstPC());

//Checks to see if the item has the "Light" property. This was before I knew that it actually emanates a light. I'm sure I can find another unused property later

//I tried to set a local variable to stop it from repeatedly changing appearance. GetLocalNumber and GetLocalBoolean seemed to have the same effect: It would change, but it wouldn't change back

if(GetLocalNumber( OBJECT_SELF, 28) == 0){
SetLocalNumber(OBJECT_SELF, 28, 255);

ChangeObjectAppearance( OBJECT_SELF, nappearance-1 );

//This was my attempt to switch back the appearance once the item was unequipped.

if(GetLocalNumber( OBJECT_SELF, 28) == 255){
SetLocalNumber(OBJECT_SELF, 28, 0);
ChangeObjectAppearance(OBJECT_SELF, nappearance+1);


I don't claim to be a marvelous scripter... hell, I'm ecstatic if they even compile correctly. But, I have two questions:

1. How could I get this to do what I want, but only once? Once it's equipped, change the appearance to your "PCs appearance-1", and then back when unequipped?

2. Is there a script I could attach this to that fires more frequently than the k_ai_master? It's kind of annoying waiting 2-3 seconds to apply the correct body model.

Well, I hope I haven't completely lost all of you. I need some input here. Something... anything at all...