Chronepsys Posted August 2, 2022 Posted August 2, 2022 (edited) Hi all, I am looking for a way to use/cast something when I use an misc item in my inventory.By now, the effet start when the item is picked up and nothing on the use from inventory. I read some tuto and things here and there and understand that it seems the "activate" would be linked to the item type. Today i am planning to use a trick in which i would equip/unequip to simulate that sort of use but it is not really what i am looking for. Maybe somebody could help me with a way to get it working as intended ? Can someone help me please ? Edited August 2, 2022 by Chronepsys
IsharaMeradin Posted August 2, 2022 Posted August 2, 2022 For anything not consumed when used from the inventory (i.e. not potions, poisons, food or ingredients), OnEquipped is the event used to listen for any "activation" attempts. For example, my inventory management mod for SSE has a series of objects that the player carries in their inventory. When used, these objects open up a container that corresponds with their category. The script used is as follows, feel free to adapt to your needs. Reveal hidden contents 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
Chronepsys Posted August 4, 2022 Author Posted August 4, 2022 Hi Ishara, I work on my mod today, i'll tell you after testing it. Thank you for your help.
Chronepsys Posted August 4, 2022 Author Posted August 4, 2022 (edited) Unfortunately, i get no effect.Here is the code i use.Can you take a look please ? Maybe it comes from the type of item i use (miscItem) Reveal hidden contents Scriptname LHGlobeTmh extends ObjectReference;Source by Chronepsys ;--------------Properties----------------------------------Cell Property LHExtManor AutoCell Property LHExtLaboratory AutoCell Property IntManor AutoCell Property IntLaboratory AutoCell Property IntGreenHouse Auto ObjectReference Property TmhMarkerHouse Auto ObjectReference Property TmhMarkerBack Auto Actor Property PlayerRef = None Auto;------------------------------------------------------------- ;------------Effect------------------------------------------Event OnEquipped(Actor akActor) If akActor == PlayerRef Actor target = Game.GetPlayer() If ( target.GetParentCell() != LHExtManor ) && ( target.GetParentCell() != LHExtLaboratory ) && ( target.GetParentCell() != IntManor ) && ( target.GetParentCell() != IntLaboratory ) && ( target.GetParentCell() != IntGreenHouse ) TmhMarkerBack.MoveTo(target) target.MoveTo(TmhMarkerHouse) Else target.MoveTo(TmhMarkerBack) EndIf EndIfEndEvent;------------------------------------------------------------- Edited August 4, 2022 by Chronepsys
Chronepsys Posted August 4, 2022 Author Posted August 4, 2022 Forget it. I get it works fine. Big thanks for your help.
Recommended Posts