Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Scripting Question/Help (Getting the armor a reference is wearing)


JosefGrey
 Share

Recommended Posts

Hey everyone. Hopefully this is the right forum to ask about this on. I'm taking a stab at learning Oblivion's scripting language and am working on a mod in which I have to get a reference for an NPC's equipped armor, then use it to compare to the formIDs in a list of custom armors to see which one the NPC is wearing. So far all I've gotten accomplished is becoming frustrated. Here's a brief example of what I'm trying to use to do this:


ref who

ref armorid


;get a reference for NPC armor in upper body, lower body,

;hand, foot slot

set armorid to who.GetEquippedObject 20

if armorid.GetIsID FormIDGoesHere

   ;do something

endif

From what I understand the GetIsID function should return a 1 if the reference belongs to the base object that the FormID represents. When the script runs in game however, it simply stops at the if statement (I'm assuming I'm using the GetIsID function incorrectly, but it looks valid based on the documentation on the construction set wiki). Can anyone please offer an alternative method or perhaps let me know what I'm doing wrong here? At this point I've tried a lot of other methods and nothing seems to be able to allow me to check what armor a reference is wearing, so any suggestions would REALLY be appreciated. Thanks!

Link to comment
Share on other sites

Well there's a couple possibilities, would be helpful if you posted the whole script.

GetEquipedObject is an OBSE function. I'm assuming if the script compiles properly that you know this and are launching both the cs and the game with the OBSE launcher.

Slot 20 is for armor that fills the lower, upper, hand AND foot slots like the DB armor, if your NPC isn't wearing armor that does that you wont get a result returned.

How and where in the script are you filling the "who" variable, if this is happening after the armor check or not working properly you're checking an empty reference.

If none of the above helps, post the whole script and we'll have a look. :thumbup:

WT

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...