Aller au contenu

Photo

Tailoring Models, new Weapon Visuals


  • Veuillez vous connecter pour répondre
32 réponses à ce sujet

#1
Evelath

Evelath
  • Members
  • 56 messages
Hello Everyone =)

I am in the process of creating a PW; and am attempting to finalize the clothing/weapon crafting scripts in the game.  I have fiddled with:

http://nwvault.ign.c...&comment_page=1

(The standard Mil_Tailor function); and have not had any success bringing in the new items to the craftable visuals.  I have a larger amount of weapon visuals that will not show up when using the tailor models; what do I need to edit to bring these up?

Thank You :)

#2
Thayan

Thayan
  • Members
  • 244 messages
That is what we use in Thay (albeit a heavily modified version). The process to get it updated to 1.69 was not at all fun or easy, if I recall correctly. First off, it was written even before 1.68 so it doesn't do a thing with the visual cloaks if you have them enabled. If you want to be able to modify them you'll need to add new conversation nodes and functions to handle it.



As far as the 1.69 stuff, because they added new stuff to leave room for all the community-hak stuff to go in the 2da files, you can't use the built-in functions of that tailor system to loop through the 2da files anymore because there are gaps between the old valid appearance IDs and the new 1.69 ones.



Anyway with those words of encouragement ;) I'd suggest starting with the tlr_items_inc library/script and modifying the functions in that to allow for them to skip over invalid rows in the 2da files and search for others until you truly are at the end of the 2da file. If you're stuck though I can try providing the updated one later if you need it (unable to open our module at the moment)

#3
Evelath

Evelath
  • Members
  • 56 messages
I appreciate the response =)

In any case; I admittedly am pretty new to scripting (and very determined!); yet have found that it is more efficient to simply learn/master the scripting language instead of searching endlessly for a dedicated individual to do the scripting.  So; pulling from tlr_items_inc:

void RemakeWeapon(object oNPC, object oItem, int nPart, int nMode)
{
    object oNew;
    int nCurrApp = GetItemAppearance(oItem, ITEM_APPR_TYPE_WEAPON_MODEL, nPart);
    int nBaseType = GetBaseItemType(oItem);
[b]    int nMin = StringToInt(Get2DAString("baseitems", "MinRange", nBaseType)) /10;
    int nMax = StringToInt(Get2DAString("baseitems", "MaxRange", nBaseType)) /10;[/b]
    do
    {
        if (nMode == PART_NEXT)
        {
            if (++nCurrApp>nMax)
                nCurrApp = nMin;
        }
        else
        {
            if (--nCurrApp<nMin)
                nCurrApp = nMax;
        }
        while(GetIsWeaponInvalid(nCurrApp, nBaseType, nPart))
        {
            if (nMode == PART_NEXT)
                nCurrApp++;
            else
                nCurrApp--;
        }
        oNew = CopyItemAndModify(oItem, ITEM_APPR_TYPE_WEAPON_MODEL, nPart, nCurrApp, TRUE);
     }
     while (!GetIsObjectValid(oNew));
        int nSlot = INVENTORY_SLOT_RIGHTHAND;


    if (GetIsObjectValid(oNew))
    {
        DestroyObject(oItem);
        AssignCommand(oNPC, ClearAllActions(TRUE));
        AssignCommand(oNPC, ActionEquipItem(oNew, nSlot));
    }
        object oPC = GetPCSpeaker();
        SendMessageToPC(oPC, "New Appearance: " + IntToString(nCurrApp));
}

I am looking primarily at the bolded sections and expect that the instructions are aimed at those two lines.  I am hoping you could provide a bit more information regarding on how/where to edit to allow the new weapon visuals to be shown.  I understand your time is important and greatly appreciate any help you can offer.

Thanks

#4
Greyfort

Greyfort
  • Members
  • 234 messages
the scripting seems sound, the 2da file seems to be the bigest issue since the script calls...

int nMin = StringToInt(Get2DAString("baseitems", "MinRange", nBaseType)) /10;
int nMax = StringToInt(Get2DAString("baseitems", "MaxRange", nBaseType)) /10;
your asking it to read the 2da file name "baseitems"
"MinRange", of BaseType, which was gotten from wepon ...

dagger base type=22(from lexicon list thats what the function will return)
then the 2da function will return min 10 max 100 from 2da file

when you use a hak like cep they have changed the 2da file you have to go through the 2da file with the nwn functions to insure proper 2da valuse

once again the lexicon shows you this but the function they use GetBaseType is not a valid function using the 2da can help you, but it will require some work

the best trick is to create a function that will read your baseitem 2da so its always upto date.

IE fuction scans your 2da , then when you use crafting system item appearance will work.
I use no haks, all though I can look into it. I will try to be back with a post of working script.

God willing...

EDIT ADD: upon reading what the writer of the script left us they did tell us to go into toolset and note the numbers then adjust the file "tlr_items_inc" accordingly

since the only hak file i work with is the D20Modern my cep is not up to date so i would only be able to add those numbers in, it will take some time on your/my part perhaps as the other person suggested you PM them and ask for a fixed version, or if they are willing they could post on the vaults.  I will do the work if you would like, or at least can help to a point until my cep numbers run out...

Modifié par Greyfort, 30 janvier 2011 - 09:33 .


#5
Greyfort

Greyfort
  • Members
  • 234 messages
I have found some errors in the "tlr_items_inc" file had a issue with tower shields now fixed. It looks like we have to add robes and adjust the conversation file. so far i have only fixed the shield issue and working on the 169 issues robes,cloaks, extra helms, weapons. I will keep working on it this wont be a fast post :(

#6
Tyndrel

Tyndrel
  • Members
  • 185 messages
It may be worth you having a look at the version in the latest CEP as it works well with 1.69 and plenty of other extra goodies.

#7
Greyfort

Greyfort
  • Members
  • 234 messages
working with d20modern i have cep2.0 not 2.3 i have dial up so getting new haks I have to find a broadband connection so if some one could supply me with info from 2.3 I can write the script for 169 and then just change var to use cep 2.0 or cep 2.3 any other/custom haks some one will have to do the script work

#8
Evelath

Evelath
  • Members
  • 56 messages
If you identify the particular areas you need; I will gladly post them. (I GREATLY appreciate your assistance, and look forward to going through everything for learning purposes.)

#9
Thayan

Thayan
  • Members
  • 244 messages
Well, I don't know if this will help you much, but here's the tlr_item_inc from the modified version we have in Thay. It looks like the RemakeWeapon function is the same, and since I'm at work (again) I can't really dig into everything that I changed as I don't remember everything that I had to modify to get this to work anymore. Anyway though, you can try compiling your mod with this one and see if it makes any difference. It also includes the function that was added for the additional cloak functional that I added - feel free to use it if you get ambitious and add cloak modifications to your system.

Edit for disclaimer: This social site *sucks* for posting code...

//::///////////////////////////////////////////////
//:: Tailoring - Items Include File
//:: tlr_items_inc.nss
//::
//:://////////////////////////////////////////////
/*
    Includes functions for scrolling through and
    recoloring equipped items
*/
//:://////////////////////////////////////////////
//:: Created By: Stacy L. Ropella
//:: Created On: January 28, 2006
//:://////////////////////////////////////////////
const int    PART_NEXT  = 0;
const int    PART_PREV  = 1;
const int    COLOR_NEXT = 3;
const int    COLOR_PREV = 4;
const int    HELMET = 8888;
const int    SHIELD = 8889;
int GetIsShieldInvalid(int nCurrApp, int nBaseType);
int GetIsWeaponInvalid(int nCurrApp, int nBaseType, int nPart);
void RemakeShield(object oNPC, object oItem, int nMode)
{
///////////////////////////////////////////////////////////////////
/*
   Change the following values to the highest shield model
   numbers used in your module.  The default NWN values (no haks)
   are already listed.
*/
///////////////////////////////////////////////////////////////////
    int MaxSmallShield = 43;  //was 43 for each
    int MaxLargeShield = 75;
    int MaxTowerShield = 54;
///////////////////////////////////////////////////////////////////
    int nSlot;
    object oNew;
    int nCurrApp = GetItemAppearance(oItem, ITEM_APPR_TYPE_SIMPLE_MODEL, 0);
    int nBaseType = GetBaseItemType(oItem);
    int nMin = 11;
    int nMax;
    if(nBaseType == BASE_ITEM_SMALLSHIELD)
        nMax = MaxSmallShield;
    if(nBaseType == BASE_ITEM_LARGESHIELD)
        nMax = MaxLargeShield;
    if(nBaseType == BASE_ITEM_TOWERSHIELD)
        nMax = MaxTowerShield;
    do
    {
        if (nMode == PART_NEXT)
        {
            if (++nCurrApp > nMax)
                nCurrApp = nMin;
        }
        else
        {
            if (--nCurrApp < nMin)
                nCurrApp = nMax;
        }
        while(GetIsShieldInvalid(nCurrApp, nBaseType))
        {
            if (nMode == PART_NEXT)
                nCurrApp++;
            else
                nCurrApp--;
        }
        oNew = CopyItemAndModify(oItem, ITEM_APPR_TYPE_SIMPLE_MODEL, 0, nCurrApp, TRUE);
    }
    while (!GetIsObjectValid(oNew));
        nSlot = INVENTORY_SLOT_LEFTHAND;
    if (GetIsObjectValid(oNew))
    {
        DestroyObject(oItem);
        AssignCommand(oNPC, ClearAllActions(TRUE));
        AssignCommand(oNPC, ActionEquipItem(oNew, nSlot));
    }
        object oPC = GetPCSpeaker();
        SendMessageToPC(oPC, "New Appearance: " + IntToString(nCurrApp));
}
void RemakeHelm(object oModel, object oItem, int nMode)
{
    int nCurrApp, nSlot;
    object oNew;
        nCurrApp = GetItemAppearance(oItem, ITEM_APPR_TYPE_ARMOR_MODEL, 0);
        int nMin = 1;
        int nMax = StringToInt(Get2DAString("baseitems", "MaxRange", BASE_ITEM_HELMET));
        do
        {
            if (nMode == PART_NEXT)
            {
                if (++nCurrApp>nMax) nCurrApp = nMin;
            }
            else
            {
                if (--nCurrApp<nMin) nCurrApp = nMax;
            }
            oNew = CopyItemAndModify(oItem, ITEM_APPR_TYPE_ARMOR_MODEL, 0, nCurrApp, TRUE);
         }
         while (!GetIsObjectValid(oNew));
            nSlot = INVENTORY_SLOT_HEAD;

    if (GetIsObjectValid(oNew))
    {
        DestroyObject(oItem);
        AssignCommand(oModel, ClearAllActions(TRUE));
        AssignCommand(oModel, ActionEquipItem(oNew, nSlot));
    }
        object oPC = GetPCSpeaker();
        SendMessageToPC(oPC, "New Appearance: " + IntToString(nCurrApp));
}
void RemakeCloak(object oModel, object oItem, int nMode)
{
    int nCurrApp, nSlot;
    object oNew;
        nCurrApp = GetItemAppearance(oItem, ITEM_APPR_TYPE_SIMPLE_MODEL, 0);
        int nMin = 1;
        int nMax = 16; //Thayan - in cloakmodel.2da, there are 16 available NWN cloak models
        do
        {
            if (nMode == PART_NEXT)
            {
                if (++nCurrApp>nMax) nCurrApp = nMin;
            }
            else
            {
                if (--nCurrApp<nMin) nCurrApp = nMax;
            }
            oNew = CopyItemAndModify(oItem, ITEM_APPR_TYPE_SIMPLE_MODEL, 0, nCurrApp, TRUE);
         }
         while (!GetIsObjectValid(oNew));
            nSlot = INVENTORY_SLOT_CLOAK;

    if (GetIsObjectValid(oNew))
    {
        DestroyObject(oItem);
        AssignCommand(oModel, ClearAllActions(TRUE));
        AssignCommand(oModel, ActionEquipItem(oNew, nSlot));
    }
        object oPC = GetPCSpeaker();
        SendMessageToPC(oPC, "New Appearance: " + IntToString(nCurrApp));
}
void RemakeWeapon(object oNPC, object oItem, int nPart, int nMode)
{
    object oNew;
    int nCurrApp = GetItemAppearance(oItem, ITEM_APPR_TYPE_WEAPON_MODEL, nPart);
    int nBaseType = GetBaseItemType(oItem);
    int nMin = StringToInt(Get2DAString("baseitems", "MinRange", nBaseType)) /10;
    int nMax = StringToInt(Get2DAString("baseitems", "MaxRange", nBaseType)) /10;
    do
    {
        if (nMode == PART_NEXT)
        {
            if (++nCurrApp>nMax)
                nCurrApp = nMin;
        }
        else
        {
            if (--nCurrApp<nMin)
                nCurrApp = nMax;
        }
        while(GetIsWeaponInvalid(nCurrApp, nBaseType, nPart))
        {
            if (nMode == PART_NEXT)
                nCurrApp++;
            else
                nCurrApp--;
        }
        oNew = CopyItemAndModify(oItem, ITEM_APPR_TYPE_WEAPON_MODEL, nPart, nCurrApp, TRUE);
     }
     while (!GetIsObjectValid(oNew));
        int nSlot = INVENTORY_SLOT_RIGHTHAND;

    if (GetIsObjectValid(oNew))
    {
        DestroyObject(oItem);
        AssignCommand(oNPC, ClearAllActions(TRUE));
        AssignCommand(oNPC, ActionEquipItem(oNew, nSlot));
    }
        object oPC = GetPCSpeaker();
        SendMessageToPC(oPC, "New Appearance: " + IntToString(nCurrApp));
}
void ColorItem(object oNPC, object oItem, int nPart, int nMode)
{
    int nCurrApp, nSlot;
    object oNew;
    nCurrApp = GetItemAppearance(oItem, ITEM_APPR_TYPE_WEAPON_COLOR, nPart);
    int nMin = 1;
    int nMax = 4;
    do
    {
        if (nMode == COLOR_NEXT)
        {
            if (++nCurrApp>nMax) nCurrApp = nMin;
        }
        else
        {
            if (--nCurrApp<nMin) nCurrApp = nMax;
        }
        oNew = CopyItemAndModify(oItem, ITEM_APPR_TYPE_WEAPON_COLOR, nPart, nCurrApp, TRUE);
        nSlot = INVENTORY_SLOT_RIGHTHAND;
    } while (!GetIsObjectValid(oNew));
    if (GetIsObjectValid(oNew))
    {
        DestroyObject(oItem);
        oItem = oNew;
        AssignCommand(oNPC, ClearAllActions(TRUE));
        AssignCommand(oNPC, ActionEquipItem(oItem, nSlot));
        object oPC = GetPCSpeaker();
        SendMessageToPC(oPC, "New Color: " + IntToString(nCurrApp));
    }
}
/*
///////////////////////////////////////////////////////
   Invalid Model Numbers and Restriction List
///////////////////////////////////////////////////////
   To Restrict Individual Numbers:
   Place a list of case statements above the return TRUE; line.
   ie:
        case 1:
        case 53:
        case 42:
            return TRUE;
  To Restrict Number Ranges:
  Replace the [low#] and [high#] with your starting and ending numbers
  (inclusive), in the if statement.  Copy the base if statment for more
  ranges.
  ie, to exclude 1, 2, 3, 4, and 5:
       if( nBaseType >= 1 && nBaseType <= 5)
           return TRUE;
  To Find the Numbers to Restrict:
      Shields:
      Edit a small, large, and tower shield in the toolset and mark
      which shield model numbers are missing for each shield type.  Also note
      down any shield model number you do not want players to be able
      to use, and put the unwanted numbers into the above format in the
      GetIsShieldInvalid function.
      Weapons:
      Follow the above method for weapons to determine which model numbers
      you don't want to allow.
*/
int GetIsShieldInvalid(int nCurrApp, int nBaseType)
{
////////////////////////////////////////////////////////////////
//                       Small Shields
////////////////////////////////////////////////////////////////
    if(nBaseType == BASE_ITEM_SMALLSHIELD)
    {
/*      Place restricted numbers here and uncomment as neccessary
        switch(nCurrApp)
        {
            case 1:
            case 53:
            case 42:
                return TRUE;
        }
        if( nCurrApp >= 1 && nCurrApp <= 5)
            return TRUE;
*/
        if(nCurrApp >= 14 && nCurrApp <= 20)
            return TRUE;
        if(nCurrApp >= 24 && nCurrApp <= 30)
            return TRUE;
        if(nCurrApp >= 34 && nCurrApp <= 40)
            return TRUE;
    }
////////////////////////////////////////////////////////////////
//                       Large Shields
////////////////////////////////////////////////////////////////
    else if(nBaseType == BASE_ITEM_LARGESHIELD)
    {
/*      Place restricted numbers here and uncomment as neccessary
        switch(nCurrApp)
        {
            case 1:
            case 53:
            case 42:
                return TRUE;
        }
        if( nCurrApp >= 1 && nCurrApp <= 5)
            return TRUE;
*/
        if(nCurrApp >= 14 && nCurrApp <= 20)
            return TRUE;
        if(nCurrApp >= 24 && nCurrApp <= 30)
            return TRUE;
        if(nCurrApp >= 34 && nCurrApp <= 40)
            return TRUE;
        if(nCurrApp >= 44 && nCurrApp <= 50)
            return TRUE;
        if(nCurrApp >= 57 && nCurrApp <= 60)
            return TRUE;
    }
////////////////////////////////////////////////////////////////
//                       Tower Shields
////////////////////////////////////////////////////////////////
    else if(nBaseType == BASE_ITEM_TOWERSHIELD)
    {
/*      Place restricted numbers here and uncomment as neccessary
        //To restrict individual numbers, replace #
        //with the number to restrict
        switch(nCurrApp)
        {
            case #:
            case #:
            case #:
                return TRUE;
        }
        //To restrict individual numbers, replace #
        //with the lowest and highest number to restrict (inclusive)
        if(nCurrApp >= # && nCurrApp <= #)
            return TRUE;
*/
        if(nCurrApp >= 14 && nCurrApp <= 20)
            return TRUE;
        if(nCurrApp >= 24 && nCurrApp <= 30)
            return TRUE;
        if(nCurrApp >= 34 && nCurrApp <= 40)
            return TRUE;
        if(nCurrApp >= 44 && nCurrApp <= 50)
            return TRUE;
    }
    return FALSE;
}
int GetIsWeaponInvalid(int nCurrApp, int nBaseType, int nPart)
{
/*
//    Uncomment and fill out as neccessary.  Change **** to the base item
//    type you are wanting to disallow models from.  You can type
//    "BASE_ITEM_" in the filter to the right, and click the Constants button
//    to see a list.  For example: BASE_ITEM_DAGGER, BASE_ITEM_CLUB, etc.
//    Copy and paste the below template if you are wanting to restrict models
//    from more than one item type.
      //Weapon Top Restrictions
      if(nPart == ITEM_APPR_WEAPON_MODEL_TOP)
      {
          if(nBaseType == BASE_ITEM_****)
          {
              //To restrict individual numbers, replace #
              //with the number to restrict
              switch(nCurrApp)
              {
                  case #:
                  case #:
                  case #:
                      return TRUE;
              }
              //To restrict individual numbers, replace #
              //with the lowest and highest number to restrict (inclusive)
              if(nCurrApp >= # && nCurrApp <= #)
                  return TRUE;
          }
      }
      //Weapon Middle Restrictions
      if(nPart == ITEM_APPR_WEAPON_MODEL_MIDDLE)
      {
          if(nBaseType == BASE_ITEM_****)
          {
              //To restrict individual numbers, replace #
              //with the number to restrict
              switch(nCurrApp)
              {
                  case #:
                  case #:
                  case #:
                      return TRUE;
              }
              //To restrict individual numbers, replace #
              //with the lowest and highest number to restrict (inclusive)
              if(nCurrApp >= # && nCurrApp <= #)
                  return TRUE;
          }
      }
      //Weapon Bottom Restrictions
      if(nPart == ITEM_APPR_WEAPON_MODEL_BOTTOM)
      {
          if(nBaseType == BASE_ITEM_****)
          {
              //To restrict individual numbers, replace #
              //with the number to restrict
              switch(nCurrApp)
              {
                  case #:
                  case #:
                  case #:
                      return TRUE;
              }
              //To restrict individual numbers, replace #
              //with the lowest and highest number to restrict (inclusive)
              if(nCurrApp >= # && nCurrApp <= #)
                  return TRUE;
          }
      }
*/
      return FALSE;
}

Modifié par Thayan, 31 janvier 2011 - 05:50 .


#10
A Darker Shade of Soul

A Darker Shade of Soul
  • Members
  • 85 messages
@ Thayan...to get this to work all you have to do is overwrite the tlr_items_inc.nss? Or is there more modifications that need to be made to conversations etc. I made the mistake of trying this on my server according to the directions that were given thinking that it was already 1.69 and cep compatible. The OP has a leg up on me though. I am not a scripter by any means. Sometimes I can get lucky and modify a code though lol...

#11
Thayan

Thayan
  • Members
  • 244 messages
Yes, you can just replace the .nss file with that is here. I peronsally like opening up the script (tlr_items_inc) in the toolset, making a copy/backup of it, and then copying and pasting code from here over the top of (and replacing everything within) that script.



Don't forget that because this is an include file, you'll need to Build your module and compile all the scripts in it for this to even have a remote chance of working. Good luck.

#12
Evelath

Evelath
  • Members
  • 56 messages
I really appreciate your script; a few things:



1) This opened up the additional CEP visuals; however it appears that the .hak armory that I am using utilizes colors to access additional weapon visuals. Is there a way to get to those colors? (I attempted to increase the number to 10; however it doesn't go past 5.)



2) The script opened up pretty much every other options in terms of armor. Thanks a bunch!



Also, a noobie question: Why is it required to recompile an include file? I am certain to do it; just unsure of the precise reason.

#13
A Darker Shade of Soul

A Darker Shade of Soul
  • Members
  • 85 messages

Thayan wrote...

Yes, you can just replace the .nss file with that is here. I peronsally like opening up the script (tlr_items_inc) in the toolset, making a copy/backup of it, and then copying and pasting code from here over the top of (and replacing everything within) that script.

Don't forget that because this is an include file, you'll need to Build your module and compile all the scripts in it for this to even have a remote chance of working. Good luck.


Yep, I always do that anyways. Just in case though I always keep the original code in place just in case something doesn't work out I can at least return to the original format that did work.

Edit: So hmmm...I opened up my script editor only to find that I do not even have a tlr_item_inc.nss file? I do have a tlr_inc but that's it. Any ideas?

Modifié par A Darker Shade of Soul, 01 février 2011 - 11:38 .


#14
Thayan

Thayan
  • Members
  • 244 messages
@Evelath - Nice. Very nice. Glad that worked out for you.

Since we don't use haks in Thay the issue with the colors isn't one I've had to mess with. When you increased the number to 10, are you talking about the nMax int in the ColorItem function? That *should* work...



And compiling is necessary with include files because the scripts that rely on include files continue to use the previous version of the include until they are all recompiled. There are many other smarter scripters here than me though that can probably explain exactly *why* NWN scripts retain a type of cached version of the include until recompiled though.



@ Darker -

It sounds like you might have an old version of the tailor model. Take a look for the Bloodsong addition to it (or something like that) because there were some nice additions that were made to the original system.

#15
Greyfort

Greyfort
  • Members
  • 234 messages
If you dont have the file copy the script, and i think it has the file name at top "tlr_item_inc". then file save as paste the tittle, then build your mod. Also sometimes if its buggy closing toolset and opening again can fix that. you need to down load the newest version of the tailor its one file called



"Mil_Tailor_Update_1.67b" a rar file with all you need

#16
A Darker Shade of Soul

A Darker Shade of Soul
  • Members
  • 85 messages
N/M....

Modifié par A Darker Shade of Soul, 03 février 2011 - 11:48 .


#17
A Darker Shade of Soul

A Darker Shade of Soul
  • Members
  • 85 messages
Alright, everything seemed to go in just fine except for one thing. After I built and compiled everything I received a compiling error as follows..tlr_removeihelm.nss{34}: ERROR: NO RIGHT BRACKET ON EXPRESSION ...Also line 34 in the script is highlighted in blue and is flashing while the #34 is in red I am guessing to indicate where the missing bracket is...here is the code.

[nwscript]//::///////////////////////////////////////////////
//:: Tailoring - Remove Helm
//:: tlr_removehelm.nss
//:://////////////////////////////////////////////
/*

*/
//:://////////////////////////////////////////////
//:: Created By: stacy_19201325
//:: from Mandragon's mil_tailor
//:://////////////////////////////////////////////
#include "tlr_include"

// Get a Cached 2DA string, and if its not cached read it from the 2DA file and cache it.
string GetCachedACBonus(string sFile, int iRow);



void main()
{
object oPC = GetPCSpeaker();
object oItem = GetItemInSlot(INVENTORY_SLOT_CHEST, OBJECT_SELF);
int iToModify = GetLocalInt(OBJECT_SELF, "ToModify");
int iNewApp = 0;

//-- valid pieces check zone vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

int nGender = GetGender(OBJECT_SELF);
string s2DAFile = GetLocalString(OBJECT_SELF, "2DAFile");
string s2DA_ACBonus;

if(iToModify == ITEM_APPR_ARMOR_MODEL_NECK)
{//-- check for valid part while(NeckIsInvalid(iNewApp, nGender))
{//-- increase
iNewApp++;
//-- check we didnt hit the end
s2DA_ACBonus = GetCachedACBonus(s2DAFile, iNewApp);
if (s2DA_ACBonus == "FAIL")
{//-- if so, loop back to 1
iNewApp = 1;
}
}
}

if(iToModify == ITEM_APPR_ARMOR_MODEL_TORSO)
{//-- check for valid part
while(TorsoIsInvalid(iNewApp, nGender))
{//-- increase
iNewApp++;
//-- check we didnt hit the end
s2DA_ACBonus = GetCachedACBonus(s2DAFile, iNewApp);
if (s2DA_ACBonus == "FAIL")
{//-- if so, loop back to 1
iNewApp = 1;
}
}
[/nwscript]

Thanks and an explanation on where the bracket should have went would be appreciated as well because I tried a couple of things that didn't work...lol go figure!

Modifié par A Darker Shade of Soul, 04 février 2011 - 10:33 .


#18
A Darker Shade of Soul

A Darker Shade of Soul
  • Members
  • 85 messages
Bump for help

#19
Greyfort

Greyfort
  • Members
  • 234 messages
//::///////////////////////////////////////////////
//:: Tailoring - Remove Helm
//:: tlr_removehelm.nss
//:://////////////////////////////////////////////
/*

*/
//:://////////////////////////////////////////////
//:: Created By: Stacy L. Ropella
//:: from Mandragon's mil_tailor
//:://////////////////////////////////////////////

void main()
{
object oHelm = GetItemInSlot(INVENTORY_SLOT_HEAD, OBJECT_SELF);
DelayCommand(0.5f, AssignCommand(OBJECT_SELF, ActionUnequipItem(oHelm)));
}

this is all i have for "tlr_removehelm"...

//::///////////////////////////////////////////////
//:: Tailoring - Remove Helm
//:: tlr_removeihelm.nss
//:://////////////////////////////////////////////
/*

*/
//:://////////////////////////////////////////////
//:: Created By: stacy_19201325
//:: from Mandragon's mil_tailor
//:://////////////////////////////////////////////
#include "tlr_include"

// Get a Cached 2DA string, and if its not cached read it from the 2DA file and cache it.
string GetCachedACBonus(string sFile, int iRow);



void main()
{
    object oPC = GetPCSpeaker();
    object oItem = GetItemInSlot(INVENTORY_SLOT_CHEST, OBJECT_SELF);
    int iToModify = GetLocalInt(OBJECT_SELF, "ToModify");
    int iNewApp = 0;

//-- valid pieces check zone vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

    int nGender = GetGender(OBJECT_SELF);
    string s2DAFile = GetLocalString(OBJECT_SELF, "2DAFile");
    string s2DA_ACBonus;

  if(iToModify == ITEM_APPR_ARMOR_MODEL_NECK)
  {//-- check for valid part
     while(NeckIsInvalid(iNewApp, nGender))
     {//-- increase
       iNewApp++;
       //-- check we didnt hit the end
       s2DA_ACBonus = GetCachedACBonus(s2DAFile, iNewApp);
       if (s2DA_ACBonus == "FAIL")
       {//-- if so, loop back to 1
          iNewApp = 1;
       }
     }
  }

  if(iToModify == ITEM_APPR_ARMOR_MODEL_TORSO)
  {//-- check for valid part
     while(TorsoIsInvalid(iNewApp, nGender))
     {//-- increase
       iNewApp++;
       //-- check we didnt hit the end
       s2DA_ACBonus = GetCachedACBonus(s2DAFile, iNewApp);
       if (s2DA_ACBonus == "FAIL")
       {//-- if so, loop back to 1
          iNewApp = 1;
       }
     }
  }


  if(iToModify == ITEM_APPR_ARMOR_MODEL_BELT)
  {//-- check for valid part
     while(BeltIsInvalid(iNewApp, nGender))
     {//-- increase
       iNewApp++;
       //-- check we didnt hit the end
       s2DA_ACBonus = GetCachedACBonus(s2DAFile, iNewApp);
       if (s2DA_ACBonus == "FAIL")
       {//-- if so, loop back to 1
          iNewApp = 1;
       }
     }
  }

  if(iToModify == ITEM_APPR_ARMOR_MODEL_PELVIS)
  {//-- check for valid part
     while(HipIsInvalid(iNewApp, nGender))
     {//-- increase
//--DEBUGGING-----------------------------------
SendMessageToPC(oPC, "New Appearance: " + IntToString(iNewApp));
       iNewApp++;
       //-- check we didnt hit the end
       s2DA_ACBonus = GetCachedACBonus(s2DAFile, iNewApp);
       if (s2DA_ACBonus == "FAIL")
       {//-- if so, loop back to 1
          iNewApp = 1;
       }
     }
  }

  if(iToModify == ITEM_APPR_ARMOR_MODEL_ROBE)
  {//-- check for valid part
     while(RobeIsInvalid(iNewApp, nGender))
     {//-- increase
       iNewApp++;
       //-- check we didnt hit the end
       s2DA_ACBonus = GetCachedACBonus(s2DAFile, iNewApp);
       if (s2DA_ACBonus == "FAIL")
       {//-- if so, loop back to 1
          iNewApp = 1;
       }
     }
  }

//--END restriction list verification section ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


    object oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_ARMOR_MODEL, iToModify, iNewApp, TRUE);

    DestroyObject(oItem);

    DelayCommand(0.5f, AssignCommand(OBJECT_SELF, ActionEquipItem(oNewItem, INVENTORY_SLOT_CHEST)));
}




string GetCachedACBonus(string sFile, int iRow) {
    string sACBonus = GetLocalString(GetModule(), sFile + IntToString(iRow));

    if (sACBonus == "") {
        sACBonus = Get2DAString(sFile, "ACBONUS", iRow);

        if (sACBonus == "") {
            sACBonus = "SKIP";

            string sCost = Get2DAString(sFile, "COSTMODIFIER", iRow);
            if (sCost == "" ) sACBonus = "FAIL";
        }

        SetLocalString(GetModule(), sFile + IntToString(iRow), sACBonus);
    }

    return sACBonus;
}  

here is what I hae for the file "tlr_removeihelm"

Hope it helps

Modifié par Greyfort, 05 février 2011 - 09:59 .


#20
Greyfort

Greyfort
  • Members
  • 234 messages
There were two files close to the same name tlr_removeihelm and tlr_removehelm and in thier comments at the top they called both files tlr_removehelm

Example:

//::///////////////////////////////////////////////
//:: Tailoring - Remove Helm
//:: tlr_removehelm.nss
//:://////////////////////////////////////////////
/*

*/
//:://////////////////////////////////////////////
//:: Created By: Stacy L. Ropella
//:: from Mandragon's mil_tailor
//:://////////////////////////////////////////////

both files had this at top so I gave you script from both files when you copy and save be sure you save under the right two names the top scrip the small one is tlr_removehelm.

the second larger scipt is tlr_removeihelm

Modifié par Greyfort, 05 février 2011 - 11:15 .


#21
A Darker Shade of Soul

A Darker Shade of Soul
  • Members
  • 85 messages
I'll give it a shot...thanks 1ce again grey.

#22
A Darker Shade of Soul

A Darker Shade of Soul
  • Members
  • 85 messages
I'm still getting the same compiling error. tlr_removeihelm.nss{34} : ERROR: NO RIGHT BRACKET ON EXPRESSION



34 while(NeckIsInvalid(iNewApp, nGender))



Above is highlighted in blue indicating that is where the error is I am guessing. The number 34 is red in the script editor as well.

#23
A Darker Shade of Soul

A Darker Shade of Soul
  • Members
  • 85 messages
Bump

#24
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
Does the "NeckIsInvalid" function even exist? I didn't see it in that include. I could just be blind but I think it's missing so this line will come up funky. Are you using a different include or supposed to be using a different include than the one posted above by Thayan. I do believe so. Or perhaps they are getting mixed up since Thayan's was "tlr_items_inc"?

Just some thoughts.

#25
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
Ignore this one. Double posted for some reason.

Modifié par GhostOfGod, 09 février 2011 - 12:00 .