Enemies equipping items in their inventory?
ListenMirndt
Member Posts: 24
Is there a script or method to make enemies equip items in their inventory? (instead of attacking unarmed) but without having to put a weapon in the enemies hands during creature creation (my item spawn script puts some random weapons into an enemies inventory) and i just want the enemy to draw and use that item...
0
Comments
EDIT: Upon rereading, I just noticed you mentioned you were giving your creatures weapons through a spawn script, so I added a line in my orc's spawn script to give him a longsword and removed the original from his inventory. I was expecting him to not pull it out, but he actually did. However, I also didn't really answer your original question at all. For what you want, it should be as simple as adding a line at the end of their spawn script consisting of "ActionEquipMostDamagingMelee();" or "ActionEquipMostDamagingRanged();", depending on what you want them to do. If you only want them to do it once they spot a target, I would add this to your OnPerception script, replacing with the appropriate action if needed.
Admittedly, I couldn't really test it well considering my creature automatically pulls out his weapon on his own, but when I had it check for a nonhostile and made him a commoner it worked, so it should work if they're hostile. That's the hope, anyway.