Jump to content

Help with editing an existing follower/scripts


Recommended Posts

Hello,
I am a novice at modding. I am trying to do a few things with Oghren specifically.

  1. Make Oghren a dual wield specialist instead of two handed.
  2. Unequip his starting gear and equip a custom set when you see him in the Diamond Quarter and in Tapster's.

I am pretty sure I have done the first one correctly. I edited the 2DA on Google Sheets, downloaded it as an .xlsx file, converted the .xlsx file into a .xls file, turned the .xls into a .GDA using the ExcelProcessor.exe and put the .GDA in the override folder. Here is a screenshot of the 2DA. I would appreciate if someone would take a look at it and make sure I didn't miss or mess up anything.

As far as the second goes, I created the custom items in the toolset and exported them, the .UTI files are in the override. I should state that I did edit his .UTC so that he starts with the custom gear I made for him. I made a second custom set which just looks more casual which is also in his inventory. Basically what I want is for the second custom set to be equipped when you see him before he joins your party, and then when he does join he will be wearing the first set and have his weapons equipped. I noticed in the scripts orz210ar_tapsters.nss and orz300ar_nobles_quarter there is a portion that unequips the item in his main hand. I just expanded on that but I obviously did something wrong because when I try to export the script it does not create the .ncs file. Here is what I did:

UnequipItem(oOghren,GetItemInEquipSlot(INVENTORY_SLOT_MAIN,oOghren));
UnequipItem(oOghren,GetItemInEquipSlot(INVENTORY_SLOT_OFFHAND,oOghren));
UnequipItem(oOghren,GetItemInEquipSlot(INVENTORY_SLOT_CHEST,oOghren));
UnequipItem(oOghren,GetItemInEquipSlot(INVENTORY_SLOT_BOOTS,oOghren));
UnequipItem(oOghren,GetItemInEquipSlot(INVENTORY_SLOT_GLOVES,oOghren));
EquipItem(oOghren,oItem"oghrenshirt.uti"(INVENTORY_SLOT_CHEST,oOghren));
EquipItem(oOghren,oItem"oghrenshoe.uti"(INVENTORY_SLOT_BOOTS,oOghren));
EquipItem(oOghren,oItem"oghrenbrace.uti"(INVENTORY_SLOT_GLOVES,oOghren));

I assume it has to do with the EquipItem lines because I winged it with those lines since I didn't have an existing line to go from. The error message in the toolset when I try to export says:

orz300ar_nobles_quarter.nss - orzar_nobles_quarter.nss(189): Undefined identifier (oItem)

The message after says Compile failed.

I was hoping someone could maybe tell me what I missed or if I need to do something different to get it to export and get this all working right. Thanks for reading.

Link to comment
Share on other sites

  • 2 weeks later...

Hi legitmatebusiness! I've been looking into how to alter the starting equipment of NPCs/companions myself and found this helpful tutorial vid on YouTube: https://www.youtube.com/watch?v=F6qpegG6JYw. It talks about changing armor, but it seems the same principle applies to the other gear and/or abilities as well. So far I haven't had a chance to attempt this yet (life is that little thing that interferes with modding!), but if it made sense to me, then anyone can follow it. :tongue: Good luck w/ the modding & if I manage to get around to doing this in the near future, I'll be sure to let you know how. :thumbsup:

 

Best regards & stay safe out there!

 

FIREFLY11

Link to comment
Share on other sites

Apologies for my late entry to this thread - I've not visited the forums for awhile. If it's too late for my post to help you, OP, perhaps it will help someone else with the same problem.

 

In order for the EquipItem function to work, you need a reference (oItem) to an existing item. Since the function that retrieves references to inventory items actually returns an array, we'll need to declare it as an array, like so:

 

object [] oItem;

 

Since you've already added your custom items to Oghren's inventory, you'll need to set oItem to reference each of them before you can equip them. I'm going to assume that the tags of your custom items follow the standard naming conventions, that is (for example) the tag for oghrenshirt.uti is set to "oghrenshirt". If not, you'll need to substitute the tags you're actually using.

 

So - to set the value of our oItem variable to refer to your custom oghrenshirt - and then equip it, we need these lines of code:

 

oItem = GetItemsInInventory(oOghren,GET_ITEMS_OPTION_ALL,0,"oghrenshirt");

EquipItem(oOghren,oItem[0]);

 

Notice that I omitted the inventory slot arg in the EquipItem function call. It's optional, and really only needed for items that could occupy multiple slots (example: a dagger could be equipped in the main hand or offhand, and there are 2 slots for rings).

 

We can repeat those lines for the other custom items you were trying to equip in the code segment you provided, like so:

 

oItem = GetItemsInInventory(oOghren,GET_ITEMS_OPTION_ALL,0,"oghrenshoe");

EquipItem(oOghren,oItem[0]);

oItem = GetItemsInInventory(oOghren,GET_ITEMS_OPTION_ALL,0,"oghrenbrace");

EquipItem(oOghren,oItem[0]);

 

If you replace the EquipItem lines in the code snippet you provided with the lines in courier font I've provided here, your script should compile and execute.

 

Hope I helped.

Link to comment
Share on other sites

Are you trying to edit the vanilla script or writing your own? I highly advise against editing anything vanilla, especially scripts. Soooo....with that said....what I suggest doing is using PRCSCR and plot flags instead. It's much cleaner, won't break anything beyond repair, and will prevent it from conflicting with any other mods.

 

PRCSCR xls/gdas use area lists instead of area resource names unless the area isn't on an area list and i *think* most of the areas in orzammar, it is likely that the two different areas you want to use are on an area list along with a few other areas on the same lists, so in your script you're going to have to check for a valid object in the area you want to use....i usually just use the area resource name. An example is Cousland Castle....both the day and night castles are on the same area list, bhn01al_castle_cousland, so I would have to write my PRCSCR script to check first if I'm in the day or night area....here's how I would do it.....

 

void main()
{
object oCousland = GetObjectByTag("bhn100ar_castle_cousland"); <------defining my object by using the area name, not the list name....

object oDog = GetObjectByTag("gen00fl_dog"); <------defining who i'm going to re-equip.....dog is the easiest

 

if(IsObjectValid(oCousland)) <-----checking to see if i'm in the right area.....

 

{

if (!WR_GetPlotFlag(PLT_LHC_PLAYER_EQUIPMENT, LHC_DOG_EQUIPMENT)) <----- the plot i created to check to see if dog's equipment has been changed....since i used the ! it checks to see if it's false
{
object oCollar = GetItemInEquipSlot(INVENTORY_SLOT_DOG_COLLAR, oDog);
object oPaint = GetItemInEquipSlot(INVENTORY_SLOT_DOG_WARPAINT, oDog);

 

WR_DestroyObject(oCollar);
WR_DestroyObject(oPaint);

 

resource rCollar = R"lhc_hvr_collar.uti";
resource rPaint = R"lhc_hvr_warpaint.uti";

object oArmor = CreateItemOnObject(rCollar, oDog);
object oWeapon = CreateItemOnObject(rPaint, oDog);

 

EquipItem(oDog, oArmor, INVENTORY_SLOT_DOG_COLLAR);
EquipItem(oDog, oWeapon, INVENTORY_SLOT_DOG_WARPAINT);
WR_SetPlotFlag(PLT_LHC_PLAYER_EQUIPMENT, LHC_DOG_EQUIPMENT, TRUE); <--------sets the plot flag so it won't keep doing it over and over and over
}
}

}

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...