Jump to content

[LE] Make misc item "Equip-able"


davethepak

Recommended Posts

I am trying to figure out how the game determines if an item can be "equipped" or not.

 

I suspect it is the item type (armor, weapon, etc.) but then the torch (which is a light) is eqippable as well.

 

Basically, I have a misc item that I want the player to be able to use with a hot key (equip) and I will have an oneequip event on the item to trigger a magic effect.

 

(I have figured out to do this with a shield type item, or even a ring that takes no slots, but I would rather have it be a MISC item type).

 

I am not sure if this is even possible, but welcome any suggestions.

 

Thank you in advance.

Link to comment
Share on other sites

This isn't my strong point, but you might be able to change the mesh to be a miscellaneous item on a shield or weapon framework.

 

You might take a look at Chesko's Wearable Lanterns and Campfire mods, both of which have the player able to hold or wear nonstandard items. There should be links on the description page to Chesko's own website, where he has tutorials on how to use the framework of Campfire to create your own custom mods, both with and without Campfire having to be a master. Possibly you can get the ideas you need in those tutorials. They're pretty straight forward. I was able to make a portable storage mod with it, without any knowledge of scripting.

Link to comment
Share on other sites

MiscObjects will receive the OnEquipped event just fine. They won't actually equip on the player character. But when the Use / Equip button is selected in the inventory the OnEquipped event will trigger. You may need to forcibly exit the inventory menu in order to have whatever actions take place. You can also tell it to equip when pressing a key bind but probably not a quick slot key bind as I do not think that MiscObjects can be made favorites.

 

I use this script in my Inventory Management System Rebuilt mod for the MiscObject and Armor items that represent the various categories. You are more than welcome to adapt any portion of it for your purposes.

 

 

Scriptname abim_IMS_SatchelEquipScript extends ObjectReference  

ObjectReference 	Property 	TheContainer 	= None	Auto
Actor 				Property 	PlayerRef 		= None	Auto
FormList 			Property 	abim_IMS_RepItemList 	Auto
Int 				Property 	RepItemIndex 			Auto

Event OnEquipped(Actor akActor)
	If akActor == PlayerRef
		Game.DisablePlayerControls(False, False, False, False, False, True)	; Exit menu
		Utility.Wait(0.01)
		TheContainer.Activate(PlayerRef)									; activate container interface
		Utility.Wait(0.01) 
		Game.EnablePlayerControls(False, False, False, False, False, True)	; Reenable menu		
		If abim_IMS_RepItemList.GetAt(RepItemIndex) as Armor 				; un-equip only if an armor item
			PlayerRef.UnequipItem(abim_IMS_RepItemList.GetAt(RepItemIndex), False, True)
		EndIf
	EndIf
EndEvent

 

 

Link to comment
Share on other sites

Any "Misc Item" can be equipped as long as it has a script on it "OnEquipped()" & "OnUnequipped()" to be able to fire the function you wish, but to equip it with a hot key, i don't know... i've never tried it.

 

Edit: Typo... + Apparently we posted the same info at the same time, although IsharaMeradin added more details to it.

Edited by maxarturo
Link to comment
Share on other sites

Thank you everyone for your quick and informative responses!!!

 

thumbincubation - thank you! I checked into wearable lanterns, and they are armor items; which is how they are equipped. they are just mapped to unused slots - which is clever and enlightening - I had only just recently thought about items that are mapped to non standard slots.

 

IsharaMeradin - as always you spoil others with the quality and depth of your answers. Your code is very interesting - I was thinking about adding a storage chest that links to general stores - now I will have to check out some of your mods.

I had never seen the = None Auto in properties before. Now I have something new to research. Thank you for your answer - it may lead me on a greater tangent! (very hard to stay focused when modding).

 

maxarturo - wow, that is amazing news. I will test it out with what I am doing.

 

Thank all of you. This is why I love the skyrim modding community. I have a bunch of personal mods I have made over time - the contributions of others incentivizes me to polish them up and post them.....(eventually...sigh...).

 

Follow up: As mentioned, I can make the equippable, but it cannot be favorited (and it still gives the message this item cannot be equipped).

I have half of what I wanted to work, so can go from here.

 

Thank all of you again.

Edited by davethepak
Link to comment
Share on other sites

"I can make the equippable, but it cannot be favorited (and it still gives the message this item cannot be equipped). "


Misc items that have an "OnEquipped()" script won't actually get equipped / placed on the actor's body, it will just fire the "OnEquipped()" script.

Misc items can not be "favorited", as for the message: "this item cannot be equipped".

There is a work around to not show the message that i can't remember right now, plus i'm not around my pc to check it.

Link to comment
Share on other sites

 

I had never seen the = None Auto in properties before. Now I have something new to research. Thank you for your answer - it may lead me on a greater tangent! (very hard to stay focused when modding).

It is how one can designate a default value for the property and still be able to override that value by going into the property window and editing it. This is useful for things like the ore veins which have a default value of 3 for the ore received. Hearthfires reused that script for the quarry stone and clay pits and changed the value to something really high so that those veins would seem to be unlimited.

 

In my example it ended up not being necessary but is harmless to have left in place.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...