mougy Posted July 4, 2023 Share Posted July 4, 2023 i am making a display mod. the thing is i want to make a static object only become visible when the displayed object is put in place by the player and become disabled again when it is removed. ex, i want to make a display for summon dwarven mudcrab spell of the creation club and put a static of the dwarven mudcrab above it.so i want the mudcrab to be enabled when the spell is displayed and disabled when the spell is removed. is there any way to do that? Link to comment Share on other sites More sharing options...
IsharaMeradin Posted July 5, 2023 Share Posted July 5, 2023 It depends on how the initial display that you want to trigger your display is set up as to how you need to approach this. If the player 'places' an item and that item actually gets put into a container while a separate static object gets enabled, then you want to assign that first static object as an enable state parent of your static object. When the first static gets enabled, yours will enable as well. Hope that the original behaves that way as any other method will be harder to tap into. Link to comment Share on other sites More sharing options...
mougy Posted July 5, 2023 Author Share Posted July 5, 2023 (edited) thanks for the replysadly that didn't work. the displayed item is an Xmarker where the item will be put. i am using this script from anniversary edition. scriptname defaultDisplayUniqueItemScript extends ObjectReferenceActor property PlayerRef autoArmor property optArmorToDisplay auto{ Choose one 'opt' property to fill. The Armor to display. }Weapon property optWeaponToDisplay auto{ Choose one 'opt' property to fill. The Weapon to display. }MiscObject property optMiscObjectToDisplay auto{ Choose one 'opt' property to fill. The MiscObject to display. }Book property optBookToDisplay auto{ Choose one 'opt' property to fill. The Book to display. }Potion property optPotionToDisplay auto{ Choose one 'opt' property to fill. The Potion to display. }Ingredient property optIngredientToDisplay auto{ Choose one 'opt' property to fill. The Ingredient to display. }soulgem property optsoulgemToDisplay auto{ Choose one 'opt' property to fill. The soulgem to display. }ammo property optammoToDisplay auto{ Choose one 'opt' property to fill. The ammo to display. }Message property ItemNotInInventoryMessage auto{ The message to display if the item is not in the player's inventory. }Keyword property LinkedMarkerKeyword auto{ The keyword of the linked marker reference. }Event OnActivate(ObjectReference akActionRef) if akActionRef == PlayerRef Form itemToDisplay = GetDisplayItem() if PlayerRef.GetItemCount(itemToDisplay) > 0 ; If the player has the item, place it. DisplayItem(itemToDisplay) else ; If the player doesn't have the item, and ; it's not already on display, show an error. if !IsItemOnDisplay(itemToDisplay) ItemNotInInventoryMessage.Show() endif endif endifEndEventfunction DisplayItem(Form akItem) ObjectReference theItem = PlayerRef.DropObject(akItem) theItem.BlockActivation() PositionItemAndDisablePhysics(theItem) theItem.BlockActivation(false)endFunctionfunction PositionItemAndDisablePhysics(ObjectReference akItemOnDisplayRef) if akItemOnDisplayRef while !akItemOnDisplayRef.Is3DLoaded() Utility.Wait(0.1) endWhile akItemOnDisplayRef.SetMotionType(Motion_Keyframed, false) ObjectReference triggerMarker = GetLinkedRef(LinkedMarkerKeyword) akItemOnDisplayRef.MoveTo(triggerMarker) endifendFunctionForm function GetDisplayItem() if optArmorToDisplay return optArmorToDisplay elseif optWeaponToDisplay return optWeaponToDisplay elseif optMiscObjectToDisplay return optMiscObjectToDisplay elseif optBookToDisplay return optBookToDisplay elseif optPotionToDisplay return optPotionToDisplay elseif optIngredientToDisplay return optIngredientToDisplay elseif optSoulgemToDisplay return optSoulgemToDisplay elseif optammoToDisplay return optammoToDisplay endifendFunctionbool function IsItemOnDisplay(Form akItem) return Game.FindClosestReferenceOfTypeFromRef(akItem, GetLinkedRef(LinkedMarkerKeyword), 32.0)endFunction when i added this line to the scriptself.getLinkedRef().enable()it kinda worked but only when putting the display not when i remove it. Edited July 5, 2023 by mougy Link to comment Share on other sites More sharing options...
IsharaMeradin Posted July 5, 2023 Share Posted July 5, 2023 So that script works more like a weapon rack where it shows the actual item as opposed to a pre-placed static as can be seen in most of the Legacy of the Dragonborn mod. Then what you will need to do is add the line that you did for enabling your object. Then create a separate quest that will have a player alias record. The player alias will contain a script that will use the OnItemAdded event to catch when the object is added to inventory. A check to see if the first display is disabled (remotely run the xMarker's IsItemOnDisplay function) and if it is then disable yours. And if you do not want to edit scripts from another mod, use the OnItemRemoved event with a check to see if the first display is enabled and if it is enable yours (may need to register for a single update and check again after a few seconds in case script parsing of the other mod takes longer). Using an inventory event filter to prevent the OnItemAdded and OnItemRemoved events from running for every item added to or removed from the player would be a good idea. Link to comment Share on other sites More sharing options...
mougy Posted July 5, 2023 Author Share Posted July 5, 2023 thanks, i will try that. though i am so beginner to scripting so this is a lot to process and do for a simple display :) thanks again, appreciate the help. Link to comment Share on other sites More sharing options...
maxarturo Posted July 5, 2023 Share Posted July 5, 2023 You are adding extra lines to an existing game's default vanilla script? If this is the case, then do not do that!! But create your own script from scratch. Link to comment Share on other sites More sharing options...
mougy Posted July 5, 2023 Author Share Posted July 5, 2023 yes, thanks for the advice, i copied the script, made a new one, paste the script then added my new lines. Link to comment Share on other sites More sharing options...
Recommended Posts