Appearance changing script
#1
Posté 28 avril 2013 - 12:43
Here's how it works; let's say I want so dye "leather1" layer of my armor:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(change color/armor)
void main()
{
object oPC = GetPCSpeaker();
SetLocalInt(oPC, "ItemToDye", INVENTORY_SLOT_CHEST);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(change color/armor/leather1)
void main()
{
object oPC = GetPCSpeaker();
SetLocalInt(oPC, "MaterialToDye", ITEM_APPR_ARMOR_COLOR_LEATHER1);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(change color/armor/leather1/next)
#include "nekr_lu_include"
void main()
{
object oPC = GetPCSpeaker();
Color(oPC,0);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(change color/armor/leather1/previous)
#include "nekr_lu_include"
void main()
{
object oPC = GetPCSpeaker();
Color(oPC,1);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "nekr_lu_include"
void Color(object oPC, int nMode)
{
int nSlot = GetLocalInt(oPC, "ItemToDye");
object oItem = GetItemInSlot(nSlot, oPC);
int nMatDye = GetLocalInt(oPC, "MaterialToDye");
int nCurrColor = GetItemAppearance(oItem, ITEM_APPR_TYPE_ARMOR_COLOR, nMatDye);
object oNew;
int nBaseType = GetBaseItemType(oItem);
int nMin = 0;
int nMax = 175;
do
{
if(nMode == 0) nCurrColor++;
else nCurrColor--;
if(nCurrColor > nMax) nCurrColor = nMin;
if(nCurrColor < nMin) nCurrColor = nMax;
oNew = CopyItemAndModify(oItem, ITEM_APPR_TYPE_ARMOR_COLOR, nMatDye, nCurrColor, TRUE);
}
while(!GetIsObjectValid(oNew));
if(GetIsObjectValid(oNew))
{
SetCommandable(TRUE, oPC);
DestroyObject(oItem);
AssignCommand(oPC, ClearAllActions(TRUE));
AssignCommand(oPC, ActionEquipItem(oNew, nSlot));
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Now the problem is: while it works for "leather1", "leather2", "metal1", "metal2", for some reason it doesn't work for "cloth1" and "cloth 2".
#2
Posté 28 avril 2013 - 03:35
First possibility is that cloth works perfectly well, but does not visibly show on the given armor (so adjusting the appearance does nothing as far as you can see).
Second possibility is that you have a scripted confirmation that is out of synchronization with the implementation (e.g. you change cloth 1 but check cloth 2 to see if a change is made).
Third possibility is that the function does not support cloth changes. Though I am pretty sure that this is not the case as I have used standard cloth dyes effectively.
#3
Posté 28 avril 2013 - 04:07
These are some changes I've made using the script: http://i.imgur.com/lUPk8Lk.jpgWhiZard wrote...
First possibility is that cloth works perfectly well, but does not visibly show on the given armor (so adjusting the appearance does nothing as far as you can see).
The pitch black layers are "cloth1"/cloth2" .
I'm sure it does as I've seen in practive a very similar script to the one I'm trying to make.WhiZard wrote...
Third possibility is that the function does not support cloth changes.
I've checked everything several dozen of times with pen and paper and I'm clueless.WhiZard wrote...
Second possibility is that you have a scripted confirmation that is out
of synchronization with the implementation (e.g. you change cloth 1 but
check cloth 2 to see if a change is made).
But now something totally FUBAR; I deleted the whole "void Color" leaving it blank:
void ColorItem
{
}
And the exact same thing happens - leather and metal layers do work, cloth layers do not.
#4
Posté 28 avril 2013 - 05:01
Necroscope wrote...
But now something totally FUBAR; I deleted the whole "void Color" leaving it blank:
void ColorItem
{
}
And the exact same thing happens - leather and metal layers do work, cloth layers do not.
Add
void main(){}
to the include, compile it then remove the void main(){} and recompile it and all scripts that include it. Includes do not report all compilation problems, and it is likely the script being executed is different from the one you are modifying even though the name is the same.
Modifié par WhiZard, 28 avril 2013 - 05:03 .
#5
Posté 28 avril 2013 - 05:46
Anyway, thx man!
Btw, how to get a cloak appearance (I know it's possible since 1.68)? For armor parts it's:
iType: ITEM_APPR_TYPE_ARMOR_MODEL
iIndex: ITEM_APPR_ARMOR_MODEL_*
#6
Posté 29 avril 2013 - 02:19
void RemakeShield(object oPC, int nMode)
{
int nSlot = INVENTORY_SLOT_LEFTHAND;
object oItem = GetItemInSlot(nSlot, oPC);
int nCurrApp = GetItemAppearance(oItem, ITEM_APPR_TYPE_SIMPLE_MODEL, 0);
object oNew;
int nBaseType = GetBaseItemType(oItem);
int nMin = StringToInt(Get2DAString("baseitems", "MinRange", nBaseType));
int nMax = StringToInt(Get2DAString("baseitems", "MaxRange", nBaseType));
do
{
if(nMode == 0) nCurrApp++;
else nCurrApp--;
if(nCurrApp > nMax) nCurrApp = nMin;
if(nCurrApp < nMin) nCurrApp = nMax;
oNew = CopyItemAndModify(oItem, ITEM_APPR_TYPE_SIMPLE_MODEL, 0, nCurrApp, TRUE);
}
The script cycles through all the "_SIMPLE_MODEL" appearances:
http://i.imgur.com/W2GAsKC.jpg
How to restrict it to the base item type appearances?
#7
Posté 29 avril 2013 - 06:39
Necroscope wrote...
Ok, the last problem (got everything else working):
How to restrict it to the base item type appearances?
There is no specific resource devoted to this. What BioWare did for the armor torso (so as to keep the armor from changing to one of a different base AC) was to construct des_crft_appear.2da so as to loop through the torsos by index. Depending on how much out of order the shield models are, you may wish to create such a 2da for shields.
Modifié par WhiZard, 29 avril 2013 - 06:41 .
#8
Posté 29 avril 2013 - 10:45
Here are the appearance numbers for shields
Small Shields
11-13, 21-23, 31-33, 41-43
Tower Shields
11-13, 21-23, 31-33, 41-43
51-54 (WCoC tower)
Large shields
11-13, 21-23, 31-33, 41-43
51-56, 61-65 (round large shields)
66-75 (other WCoC shields)





Retour en haut






