SirJesio Posted February 15, 2018 Share Posted February 15, 2018 Hello everyone! I need some help creating a mod in the creation kit, I am very very new to modding and wanted to try it out. So my plan was to create a mod that scales the actor when a certain Necklace is equipped, I created a necklace and attached a script to it, I got it to work with the event OnEquipped(Actor) but this event ONLY works when you EQUIP the item yourself, but when equipping the item through the command to yourself or an NPC the event won't fire. Then I tried OnObjectEquipped(ObjectReference,Form) but I this has to be attached to an actor, or am a missing something? I would really appreciate the help and I am willing to explain if I missed something. Thanks in advance! This Is what I have so far: Scriptname GiantScript extends Actor {Increases the scale of the actor when the necklace is equipped} Import Utility ObjectReference property JewelryNecklaceGiant auto Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference);checks if the item is equipped if akBaseObject == JewelryNecklaceGiant Utility.wait(0.5) SetScale(0.5) endIf endEvent Event OnObjectUnequipped(Form akBaseObject, ObjectReference akReference) if akBaseObject == JewelryNecklaceGiant utility.wait(0.5) SetScale(1) endIf endEvent Link to comment Share on other sites More sharing options...
JonathanOstrus Posted February 15, 2018 Share Posted February 15, 2018 (edited) Ok first up if the script is going on the necklace it should extend type ObjectReference not Actor. Then you can use the OnEquipped and OnUnequipped. Second if this script is going on the necklace, you don't need to check for the necklace type. It's always going to be true when the script fires because the script is on the checking object itself. Next, since you're directly using Utility.Wait you don't need to Import Utility in the top of the script. The whole purpose of that is so you don't have to use Utility.Wait and can just use Wait. However I personally find it to be ambiguous and confusing if I'm working with multiple types that may have the same function names. That said, Utility, Math, and Debug are probably the only 3 that have the unlikelihood of having naming conflicts like that. To be honest I'm not entirely sure why you have the wait in place anyway. Lastly keep in mind changing scale in this fashion does not affect the collision properties of the actor. As per the wiki page notes https://www.creationkit.com/index.php?title=SetScale_-_ObjectReference So try this script on the necklace. You may need to use it on a save that has never seen your mod yet. Scriptname GiantScript extends ObjectReference {Increases the scale of the actor when this object is equipped} float originalScale ; grab original scale in case it is not 1.0 Event OnEquipped(Actor akActor) Utility.wait(0.5) originalScale = akActor.GetScale() ;akActor.SetScale(2.0) ; make twice as big akActor.SetScale(0.5) ; make half as big endEvent Event OnUnequipped(Actor akActor) utility.wait(0.5) akActor.SetScale(originalScale) ; return to original scaling endEvent Edited February 15, 2018 by BigAndFlabby Link to comment Share on other sites More sharing options...
SirJesio Posted February 15, 2018 Author Share Posted February 15, 2018 First of all, Thank you so much for helping me, It means a lot! Second, the reason why I use Utility.wait is because the scale wont affect after I leave the menu (Don't know why but it works) Third, is that this script only works if I equip it on myself, but when i try to equip it on an NPC through the command (equipitem ...) it wont fire. I hope I was clear enough, if not let me know! Link to comment Share on other sites More sharing options...
JonathanOstrus Posted February 15, 2018 Share Posted February 15, 2018 (edited) So I broke down and actually went to test it. So the GetScale and SetScale using the var doesn't work right. I was assuming using a scale in CK made it reflect as a non 1 in game. But the game uses a 1.0 scale with an adjusted base. So...Yeah use 1.0 instead lols. As for not firing, there seems to be an issue using the console to equipitem where it doesn't cause the OnEquipped event to fire. If you trade the item to the npc and they equip it, it does fire. I didn't bother to make another script to equip the item via papyrus but that may work. I just checked the wiki page notes and it states "This event won't always fire. If the item is being equipped normally through the Inventory it works as intended. If it equipped through the console or papyrus calls instead, the event will not fire." An alternative idea might be to use a magic effect with an enchantment on the object instead. You can then grab the OnEffectStart and OnEffectFinish events to do your scaling. Edited February 15, 2018 by BigAndFlabby Link to comment Share on other sites More sharing options...
SirJesio Posted February 15, 2018 Author Share Posted February 15, 2018 Thank you so much! I think I will make an enchantment out of it, maybe I can add some negative or positive side effects too! I've learned something new and I am willing to learn a lot more! Link to comment Share on other sites More sharing options...
Recommended Posts