Stop picking the bow!

Post » Mon Jan 25, 2010 11:07 am

Alright so I have a new problem, I am trying to make it so the Player can choose a weapon type out of a list via dialogue, which in turn sets the proper variables to make that Skill's stats higher then the other options. This way she will equip that one. I thought that NPCs equip their equipment based on skills but that doesn't seem to be the case with weapons. Tii Guar ALWAYS equips a bow, I know the script is working and setting the proper stats because I opened the console and typed GetMarksman and then I would change the weapon type and try GetMarksman again, and it came out right.

All four weapons have the same value 50 Drakes.

here is the script I made to handle all of this.

short weaponType ;used to set a new weapon for Tii Guar.short getweaponType ;used for dialogue to determine which weapon Tii Guar has equiped.if ( weaponType == 0 )	"aa shaddow_Tii Guar"-> SetMarksman, 70	"aa shaddow_Tii Guar"-> SetSpear, 50	"aa shaddow_Tii Guar"-> SetLongBlade, 48	"aa shaddow_Tii Guar"-> SetShortBlade, 49	Set getweaponType to 0	Set weaponType to 4elseif ( weaponType == 1 )	"aa shaddow_Tii Guar"-> SetMarksman, 48	"aa shaddow_Tii Guar"-> SetSpear, 70	"aa shaddow_Tii Guar"-> SetLongBlade, 49	"aa shaddow_Tii Guar"-> SetShortBlade, 50	Set getweaponType to 1	Set weaponType to 4elseif ( weaponType == 2 )	"aa shaddow_Tii Guar"-> SetMarksman, 48	"aa shaddow_Tii Guar"-> SetSpear, 50	"aa shaddow_Tii Guar"-> SetLongBlade, 70	"aa shaddow_Tii Guar"-> SetShortBlade, 49	Set getweaponType to 2	Set weaponType to 4elseif ( weaponType == 3 )	"aa shaddow_Tii Guar"-> SetMarksman, 48	"aa shaddow_Tii Guar"-> SetSpear, 50	"aa shaddow_Tii Guar"-> SetLongBlade, 49	"aa shaddow_Tii Guar"-> SetShortBlade, 70	Set getweaponType to 3	Set weaponType to 4elseif ( weaponType == 4 )	;don't do anything this is just to stop it from setting over and over again.endif


Please help me and thank you very much in advance!
User avatar
Cat
 
Posts: 3451
Joined: Mon Dec 18, 2006 5:10 am

Post » Mon Jan 25, 2010 1:12 am

force equip is the easy way, but it only works with tribunal. I think the implementation is to force equip a crap weapon and then take it away from them and then they'll switch weapons normally. See page 40 of MWSFD.

Try Grumpy's companion mod; I know his script has a working version of this function, but as I said, force equip is broken pre-Tribunal.

Edit: You could always try just taking her weapon away so she doesn't have it anymore. Of course, this means there's no way to go about it unless you know what weapon she's using at all times, which'd lead to problems if she's using something the player gave her, since you can't remove it if you don't know what it is.
User avatar
Umpyre Records
 
Posts: 3436
Joined: Tue Nov 13, 2007 4:19 pm

Post » Mon Jan 25, 2010 1:01 am

Yes, that is the reason why I am instead setting the skill levels, which is what MWSD said would work. But it clearly doesn't.

:(
User avatar
Sophie Miller
 
Posts: 3300
Joined: Sun Jun 18, 2006 12:35 am

Post » Mon Jan 25, 2010 7:58 am

I would try something extreme, like set the desired weapon skill to 100 and all others to 0, and see if that works.
User avatar
maria Dwyer
 
Posts: 3422
Joined: Sat Jan 27, 2007 11:24 am

Post » Mon Jan 25, 2010 11:07 am

Thank you very much Danjb!

Because of this working I figured there must be a limit in which the weapons stop switching to the proper one and sure enough after nearly half an hour of testing numbers I found that number for each of the four options. It was long but surely worth it. This is now all working and if I were to raise any of the skills (that aren't being set to 100) up by one point it wouldn't work and she would just pull out her bow.

Here is the resulting code:

short weaponType ;used to set a new weapon for Tii Guar.short getweaponType ;used for dialogue to determine which weapon Tii Guar has equiped.if ( weaponType == 0 )	"aa shaddow_Tii Guar"-> SetMarksman, 100	"aa shaddow_Tii Guar"-> SetSpear, 24	"aa shaddow_Tii Guar"-> SetLongBlade, 24	"aa shaddow_Tii Guar"-> SetShortBlade, 24	Set getweaponType to 0	Set weaponType to 4elseif ( weaponType == 1 )	"aa shaddow_Tii Guar"-> SetMarksman, 23	"aa shaddow_Tii Guar"-> SetSpear, 100	"aa shaddow_Tii Guar"-> SetLongBlade, 23	"aa shaddow_Tii Guar"-> SetShortBlade, 23	Set getweaponType to 1	Set weaponType to 4elseif ( weaponType == 2 )	"aa shaddow_Tii Guar"-> SetMarksman, 24	"aa shaddow_Tii Guar"-> SetSpear, 24	"aa shaddow_Tii Guar"-> SetLongBlade, 100	"aa shaddow_Tii Guar"-> SetShortBlade, 24	Set getweaponType to 2	Set weaponType to 4elseif ( weaponType == 3 )	"aa shaddow_Tii Guar"-> SetMarksman, 7	"aa shaddow_Tii Guar"-> SetSpear, 7	"aa shaddow_Tii Guar"-> SetLongBlade, 7	"aa shaddow_Tii Guar"-> SetShortBlade, 100	Set getweaponType to 3	Set weaponType to 4elseif ( weaponType == 4 )	;don't do anything this is just to stop it from setting over and over again.endif


Thank you very much to all those who helped me fix this problem and to Danjb for recommending the idea that lead to this working!
User avatar
Jose ordaz
 
Posts: 3552
Joined: Mon Aug 27, 2007 10:14 pm

Post » Mon Jan 25, 2010 7:54 am

I think it has to do with how NPCs will always attack in the same pattern...
First they cast offensive Spells or use an enchanted item (if they have them.) Then they use any Marksman weapons they might have. Last, they will switch to a melee weapon if/when they have no Marksman ammo.
Most NPCs that use melee will not have any Marksman weapons, to avoid this problem.

Anyways, glad you found a way to work around it :)
User avatar
louise tagg
 
Posts: 3394
Joined: Sun Aug 06, 2006 8:32 am

Post » Mon Jan 25, 2010 3:57 am

That is very interesting. I think that information will serve me well in the future thank you.
User avatar
suzan
 
Posts: 3329
Joined: Mon Jul 17, 2006 5:32 pm

Post » Mon Jan 25, 2010 1:21 pm

Hehe, I'm glad you figured it out :)

Good work finding the exact numbers!

Just a thought, you might have to warn the player against giving the companion, say, a Fortify Marksman item, in case it forces them to always use Marksman.
User avatar
Robert Bindley
 
Posts: 3474
Joined: Fri Aug 03, 2007 5:31 pm


Return to III - Morrowind