NPC Equipping Weapons & Armor

Post » Fri May 27, 2011 11:26 am

Ok. The player meets this old guy claiming to be a tough fighter who can assist them, etc etc. He/she needs to find a full suit of Imperial chain armor (helm, cuirass, gauntlets, pauldrons, greaves & boots;no shield) and a Nordic claymore. When the player finds this stuff and brings it back to the old man, i'd like the old man to equip all of the items, including the claymore, and attack the player. I know this most likely involves a script. How would I get the old man to take the items, equip them, then attack the player with a final dialog?
User avatar
Iain Lamb
 
Posts: 3453
Joined: Sat May 19, 2007 4:47 am

Post » Fri May 27, 2011 7:07 am

If you set this npc's armor and weapons skills appropriately, he should automatically equip them.

You can do everything through the returns box in the dialogue options. No scripting is actually necessary. Once you write your response, type AddItem->amorIDs 1 and Player->RemoveItem->armorIDs 1 transfer the stuff to him (make sure to check for the player having the items in the conditions boxes under the dialogue response). Then, you can trigger combat by typing in StartCombat into the appropriate dialogue response. You may also want to SetFight 100 to make him still attack you on sight if you go away and leave him for a while.
User avatar
Liv Staff
 
Posts: 3473
Joined: Wed Oct 25, 2006 10:51 pm

Post » Fri May 27, 2011 7:01 am

Ok. I do know of a 'fix'' out there that keeps merchants from equipping items you sell to them. I didn't want that fix to affect this quest if someone had it installed in their game. Maybe that's only set up for merchants. Most likely so.
User avatar
Ymani Hood
 
Posts: 3514
Joined: Fri Oct 26, 2007 3:22 am

Post » Fri May 27, 2011 4:57 am

Yes, I believe the fix only applies to merchants. All other npc classes should equip armor in their inventory normally.
User avatar
Pete Schmitzer
 
Posts: 3387
Joined: Fri Sep 14, 2007 8:20 am

Post » Fri May 27, 2011 10:55 am

Another thing I thought of. In order to detect the presence of the equipment as a function/variable, i'd need 9 slots, plus the filter saying the player has already recieved the quest. Is there another way to do this?
User avatar
Devin Sluis
 
Posts: 3389
Joined: Wed Oct 24, 2007 4:22 am

Post » Fri May 27, 2011 6:00 pm

You could either do it in stages, have one dialogue choice for one set, and another choice for the other, or you could make a single global check script to check the items and set a variable as a flag to say the items are present for dialogue purposes.
User avatar
Cheville Thompson
 
Posts: 3404
Joined: Sun Mar 25, 2007 2:33 pm

Post » Fri May 27, 2011 6:32 am

Ahh, good idea. I'll just split up the quest. I'm not too good at all of that global stuff yet.


Edit: One more thing. The armor is Imperial steel and Imperial chain armor. To adjust the NPC's armor skills so that he can accept and equip both types, could I just make both Heavy and Medium armor skills the same skill level to guarantee he'll wear both types?

Edit#2: Also, you mentioned using the AddItem variable. The player isn't going to get any items from the NPC. So will using just RemoveItem automatically make him take and equip these items?
User avatar
Rachel Tyson
 
Posts: 3434
Joined: Sat Oct 07, 2006 4:42 pm

Post » Fri May 27, 2011 8:00 am


Edit#2: Also, you mentioned using the AddItem variable. The player isn't going to get any items from the NPC. So will using just RemoveItem automatically make him take and equip these items?


No, you have to use both functions.

To add an item to your NPC's inventory: NPC_ID->AddItem, "item_ID", 1
To remove an item from the player's inventory: Player->RemoveItem, "item_ID", 1
User avatar
Justin Hankins
 
Posts: 3348
Joined: Fri Oct 26, 2007 12:36 pm

Post » Fri May 27, 2011 10:05 am

So I assume I would put the removeitem commands before the additem commands? Or it is the opposite?
User avatar
Charlotte X
 
Posts: 3318
Joined: Thu Dec 07, 2006 2:53 am

Post » Fri May 27, 2011 9:10 am

It shouldn't matter what order you put the two functions. Their actions are completely independent of each other.
User avatar
Eve(G)
 
Posts: 3546
Joined: Tue Oct 23, 2007 11:45 am

Post » Fri May 27, 2011 8:06 am

Ok. Thanks for the help.
User avatar
Ella Loapaga
 
Posts: 3376
Joined: Fri Mar 09, 2007 2:45 pm

Post » Fri May 27, 2011 3:34 pm

I can confirm that the code patch only prevents equipping items you sell; items added to an npc by console, script, or mods will be equipped as normal. I know this personally, as the official mod that adds feminine-gold armor added it to a male npc. I used the console to add more appropriate items to their inventory, and they promptply equipped them.
User avatar
Matt Bigelow
 
Posts: 3350
Joined: Sun Sep 30, 2007 6:36 pm

Post » Fri May 27, 2011 11:35 am

Ok. I've actually followed lovinda's advice and everything seems to be working as planned.
User avatar
tannis
 
Posts: 3446
Joined: Sat Dec 09, 2006 11:21 pm


Return to III - Morrowind