Jump to content

[LE] LotDB-style displays not working


drbitey

Recommended Posts

So recently I've been trying to make a LotDB-style display. (wherein you place an item on an activator display and can remove it and put it back at any time) I'm more of a level design guy and have only recently started trying to do anything regarding papyrus so am a noob and have definitely made some sort of bad mistake. Here's my code, could anyone help me with what I've done wrong and need to fix? Nothing happens right now when activating, not even a "you do not have the required item" notification.

 

trophy is the static version of the item to be displayed, starts disabled

hideawayship is the item required, its ID being HideawayShip

notrophy is the generic "you don't have this item" notification

 

Scriptname HideawayBoatTrophy extends ObjectReference

ObjectReference Property Trophy Auto

ObjectReference Property HideawayShip Auto

Message Property NoTrophy Auto

Event OnActivate(ObjectReference akActionRef)

if (Trophy.IsDisabled())

if (Game.GetPlayer().GetItemCount(HideawayShip) > 0)

Trophy.Enable()

Game.GetPlayer().RemoveItem(HideawayShip, 1)

else

NoTrophy.show()

endif

else

Trophy.Disable()

Game.GetPlayer().AddItem(HideawayShip, 1, true)

endif

EndEvent

 

Link to comment
Share on other sites

First of all you need to define in the script's property what kind of object should the script look in the player's inventory.

Example:

ObjectReference Property Trophy Auto

- Is the STATIC version of your item.

MiscObject Property TrophyMisc Auto

- The Misc item in the Player's inventory.

* The items that can live in the Player's inventory are:

Armor

Weapon

Book

Soul Gem

Ingredient

Misc Items

Potion

Food


Here you have a script for adding & removeing Misc Items, modify it so it serves your purpose.

With some explanation on the functions so you can see what lines does what.



ObjectReference Property StaticMisc Auto
{Link REF the static display object to Enable when Misc item is remove from Player's inventory}

MiscObject Property MiscToPlace Auto
{The Misc Item to place in the display & Remove from Player's Inventory}

Message Property NoItemMSG auto
{The message to show if the player doesn't have the ITEM in their inventory}

Bool Property isPlaced = false Auto Hidden


Event OnActivate(ObjectReference akActivator)
If akActivator == Game.GetPlayer()

if (isPlaced == FALSE) ; is the item placed?

if akActivator.getItemCount(MiscToPlace) >= 1 ; Does the player have the item?
blockActivation()
isPlaced = TRUE
StaticMisc.enable() ; Enable the Static item
akActivator.RemoveItem(MiscToPlace, 1) ; Remove the item from the players inventory
blockActivation(FALSE)

else
NoItemMSG.show() ; If the player doesnt have the item, show the No Item message.
endif

else
isPlaced = FALSE
blockActivation()
StaticMisc.disable() ; If the item was already placed, disable the static item
akActivator.AddItem(MiscToPlace, 1) ; add the item back to player's inventory
blockActivation(FALSE)
endif
EndIf
EndEvent



I hope it helps...

Edited by maxarturo
Link to comment
Share on other sites

 

First of all you need to define in the script's property what kind of object should the script look in the player's inventory.
Example:
ObjectReference Property Trophy Auto
- Is the STATIC version of your item.
MiscObject Property TrophyMisc Auto
- The Misc item in the Player's inventory.
* The items that can live in the Player's inventory are:
Armor
Weapon
Books
Soul Gem
Ingredient
Misc Items
Potion
Food
Here you have a script for adding & removeing Misc Items, modify it so it serves your purpose.
With some explanation on the functions so you can see what lines does what.

ObjectReference Property StaticMisc Auto
{Link REF the static display object to Enable when Misc item is remove from Player's inventory}
 
MiscObject Property MiscToPlace Auto
{The Misc Item to place in the display & Remove from Player's Inventory}
 
Message Property NoItemMSG auto
{The message to show if the player doesn't have the ITEM in their inventory}
 
Bool Property isPlaced = false Auto Hidden
 
 
Event OnActivate(ObjectReference akActivator)
      If akActivator == Game.GetPlayer()
 
          if (isPlaced == FALSE) ; is the item placed?
 
             if akActivator.getItemCount(MiscToPlace) >= 1 ; Does the player have the item?
                 blockActivation()
                 isPlaced = TRUE
                 StaticMisc.enable() ; Enable the Static item
                 akActivator.RemoveItem(MiscToPlace, 1) ; Remove the item from the players inventory
                 blockActivation(FALSE)
 
          else
                  NoItemMSG.show() ; If the player doesnt have the item, show the No Item message.
        endif
 
       else
                isPlaced = FALSE
                blockActivation()
                StaticMisc.disable() ; If the item was already placed, disable the static item
                akActivator.AddItem(MiscToPlace, 1) ; add the item back to player's inventory
                blockActivation(FALSE)
     endif
  EndIf
EndEvent

I hope it helps...

 

it works perfectly, thank you so much!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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