CakeBandit Posted November 9, 2016 Share Posted November 9, 2016 (edited) I have some NPCs I made/edited that will not use their weapon in combat after using a bow. If they use their bow, once they get into melee range they will just use their fists until I reset the actor or force them to equip their sword. Is there any way to prevent this from happening so they use their weapon? I was going to write a script that just makes them equip their sword when they unequip their bow, but the problem is that these NPCs use leveled items so I would have to make an annoying long script that may not work since the bow types may not always match the sword types. Is there any easier way to do this? Is there a way to check if an NPC is not holding a weapon and a way to make them equip the best weapon in their inventory or something? Or another possibility, does unarmed have some object ID I can use so I can just something like "UnequipItem (Unarmed) 1" so they cannot use unarmed combat at all? Edited November 9, 2016 by CakeBandit Link to comment Share on other sites More sharing options...
Surilindur Posted November 9, 2016 Share Posted November 9, 2016 (edited) The base game scripting is pretty limited, and I do not think it is possible to use it to make a solution that works with every weapon. However, through knowledge gained from an ancient tome by the name of OBSE Command Documentation, one can wield the unearthly powers bestowed upon us mortals by the almighty OBSE. Wield that power, have it do your bidding, invoke it to quell the onslaught of unsubmitting tasks - command it, and tear down the walls of impossibility as you march on to a glorious victory! Well. Sort of. At least it helps a bit. :sweat: The tome is here --> http://obse.silverlock.org/obse_command_doc.html It is possible to list all base objects of weapons in an actors inventory, then progress through all those, and determine which one is the most powerful melee weapon (has the highest base - I think it uses base - attack damage). You can then equip it, if one is found. No information on any weapons is needed, and you should be able to make something that works for everything. Here is a small example in the spoiler below, you can attach it to the NPC of your choice. It requires OBSE, and remember to launch the CS with OBSE too when you are going to save/compile the script. You could also consider using the CSE --> http://www.nexusmods.com/oblivion/mods/36370 scriptname UniquelyNamedEquipTestScript int i array_var Best array_var Items begin _GameMode if eval ( !( IsWeaponOut ) || ( GetEquippedObject 16 ) ) return endif let Best := ar_Map "weapon"::0, "damage"::0 let Items := GetItems 33 let i := ar_Size Items while ( i > 0 ) let i -= 1 if eval ( ( GetWeaponType Items[i] ) > 3 ) continue endif if eval ( ( GetAttackDamage Items[i] ) > ( Best["damage"] ) ) let Best["weapon"] := Items[i] let Best["damage"] := GetAttackDamage Items[i] endif loop if eval ( Best["weapon"] ) EquipItemSilent Best["weapon"] endif let Best := ar_Null let Items := ar_Null end The example should work (I tweaked it a little today again, have not checked to see if it still works). However since the GameMode block runs each frame, performance might be less than stellar in that one. You could build your own system for registering when the weapon needs to be equipped. Hopefully that helps a little. :thumbsup: Edited November 10, 2016 by Contrathetix Link to comment Share on other sites More sharing options...
Recommended Posts