Page 1 of 3

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Thu Jun 21, 2012 2:41 am
by Nina Mccormick
The main focus of this type of display system is as follows

1. it provides an easy way to adapt the scripts to be used as general display systems for just about anything.

2. it is designed with modding player homes and dungeons in mind. the Vanilla weapon racks are not well suited for multiple use within a single cell (they work well if you only plan on using no more than a handful in the same cell, but start to consume way more resource than necessary when you start using a bunch of them in the same room), plus it allows for more freedom for creating totally new display designs

3. It gives a better consistency in user-interface, as this system uses the familiar inventory screen to place your items, rather than having to equip the weapon in hand before mounting it to the display.


The idea is for this display system to be "large mod friendly" and as simplified as possible, but even still it has its limits and the user should be aware of the risks of over-using too many scripted objects for their interior cells.



To begin, i will cover the basic structure of how this system is set up:

reference image - example weapon display setup: http://i45.tinypic.com/2eehmpy.jpg

1. The "Trigger" - this is a plain trigger box that is used to count the number of items that are currently being displayed. if the count is zero, it will allow a new item to be placed. If the number is one or more, it will not allow any more items to be placed.

2. The "Container" - The container simultaneously replaces the need for a "dummy marker" (the object that lets the placed weapon know exactly where to go) as well as provide the visual interface for placing the object (the built in show inventory screen)

3. The "Activator" - This object is what the player uses to interact with the display system and it sends a script to open the container, which in turn triggers the rest of the placement script. The activator can be anything, from a simple player-activated trigger box, or a physical mesh. in the case of the example above I am using a stone pedestal mesh as the activator for the weapon display (physical 3d meshes IMO work better than invisible trigger boxes).





How it works:

The player mouses their crosshair over the activator and it will prompt a message like "Activate Weapon Display". when they confirm, it will open up the Show Inventory dialogue window, and the player can place whatever script-defined valid items into the container. once the item is placed into the container, the scripts runs and automatically "drops" the object outside the container and re-aligns the item to the same placement and orientation of the container itself. The player can now pull the item directly off the display system without having to open the inventory screen again, if they want to retrieve their displayed item.



Assembling the parts:

1. create a container: In the object window create a new container (right click, new) and give it an editor ID. You may also want to give it a visible name such as "Weapon Display". this name is what the player will see in the upper left corner of the inventory menu screen.

2. select a model for your container. in the example above i am using a dummy sword for the container of the weapon rack. There are many of these dummy type markers which will appear invisible and unselectable in-game. This is ideal, you do not want to use a physical 3d mesh for the container, as it would not be good if the player can access or see the container itself in game. In my example above i used Meshes\Clutter\DummyItems\DummySword01.nif. The folder DummyItems contains a bunch of differntly shaped marker objects which are perfect for this type of display system containers.

3. leave everything else as default and hit ok (dont worry about scripts we will get to that later)


---


4. create an activator - go to your object window under activators and create a new activator object (right click, new) and give it an editor ID. you definitely want to give this a visible name as well (preferably the same name you gave your container). this name is what the player will see when they mouse over it in the game - "Activate Weapon Display" etc.

5. select a model for your activator. unlike the container it is preferable to use a physical 3d mesh for the activator to avoid quirky issues with mousing over in game. if in the case you absolutely cant use a 3d mesh for your activator, you can use a trigger box set to player activation (under primitive tab), but you must rotate the z angle to something with a decimal value, such as 4.15 degrees (like i said it's quirky and even still may not always work properly).

6. Leave everything else as is, unless you want to put something in the activate override text box. this entry is what determines the name of the action when the player mouses over. by default it is "Activate" whatever object, but you can specify it to say something else like "Interact with" or "Open" etc.


---


7. Place your activator in the world by dragging it into the render window.

8. drag your container and align/orient it to how you want the item to display. NOTE - this display system uses PIVOT POINTS instead of node information. so when the script runs the code that aligns the placed item to your dummy marker/container, it will do so by matching pivot to pivot. The pivot point is indicated in the CK as a + crosshair on the object when it is selected in the render window. keep this in mind in case you are making a weapon rack that allows any kind of weapon to be displayed. A staff's pivot is very different from a greatsword pivot, so make sure you are allowing enough space in your display system to accomodate them all. typically the pivot is near where the hand is supposed to grab the weapon.

tip - one way to "preview" the proper look of the weapon display is to drag an actual weapon into the render window and position it how you wnt it to display. then hit Ctrl + F, and substitute it for your container object.

9. when you have placed your items how you want them, draw a trigger box around the container by using the Multibound menu (its the button of a cube with a T inside it)

10, choose DefaultBlankTrigger as your base object for your trigger. use the arrows to scale the trigger, but do not make it too big. it does not have to be bigger than the wepon or item to be displayed, it just has to be big enough to let the script know when an item is being occupied inside it. double click on it in the render window and go to Primitive tab. Under collision layer, change this to L_TRIGGER


---




11. Scripts.

There are a two separate scripts which this system uses in tandem. One script is for the activator and acts as a control for the whole system. the other is for the container and it handles the placement of the object being displayed.

Double click your Container object in the render window, and select Edit Base. in the script panel click Add and Create New. give your new script a name (give it a specific name and not a generic one, nothing like WeaponRackScript because then it will just get lost in with the rest of the vanilla scripts)


12. copy the following code and paste it into your new container script, directly under the first line which is your scripts name "extends object reference":
(you have full permission to use my script in your mods, or even edit it however you like, but please do give credit somewhere in description)

Spoiler

Bool Property Blocked = False  AutoMessage Property MessageWarning  AutoMessage Property MessageCount  AutoKeyword Property ArmorShield  AutoKeyword Property WeapTypeDagger  AutoKeyword Property WeapTypeSword  AutoKeyword Property WeapTypeGreatSword  AutoKeyword Property ClothingRing  AutoKeyword Property VendorItemPotion  AutoKeyword Property VendorItemPoison  AutoFormList Property GemList  AutoFormList Property ClawList  AutoFormList Property WhitePhial  AutoForm Property ItemSlot = None  Auto HiddenInt Property PlacedItem = 0  Auto HiddenInt Property DisplayType  Auto; 1 = Weapon rack, 2 = Dagger case, 3 = Jewel display, 4 = Shield plaque, 5 = Potion/poison, 6 = Dragon claw, 7 = COA weaponEvent OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)Actor PlayerRef = Game.GetPlayer()If (akSourceContainer == PlayerRef)  If (AllowedItems(akBaseItem))   If (aiItemCount == 1) && (PlacedItem == 0)    PlacedItem += aiItemCount    ItemSlot = akBaseItem    RegisterForSingleUpdate(0.1)   Else    MessageCount.Show()    PlacedItem += aiItemCount    Self.RemoveItem(akBaseItem, aiItemCount, False, PlayerRef)   EndIf  Else   MessageWarning.Show()   PlacedItem += aiItemCount   Self.RemoveItem(akBaseItem, aiItemCount, False, PlayerRef)  EndIfElse  Self.RemoveItem(akBaseItem, aiItemCount, False, akSourceContainer)EndIfEndEventEvent OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)If (akDestContainer == Game.GetPlayer())  UnregisterForUpdate()EndIfPlacedItem -= aiItemCountEndEventEvent OnUpdate()MountCurrentItem(ItemSlot)EndEventFunction MountCurrentItem(Form akBaseItem)Int i = 0ObjectReference MountedItem = DropObject(akBaseItem)If (MountedItem != None)  Blocked = True  While(!MountedItem.Is3DLoaded()) && (i < 10)   Utility.Wait(0.1)   i += 1  EndWhile  MountedItem.SetMotionType(Motion_Keyframed, False)  MountedItem.TranslateToRef(Self, 2000.0, 0.0)  Utility.Wait(1)  Blocked = FalseEndIfEndFunctionBool Function AllowedItems(Form akBaseItem)If (DisplayType == 1)  Return (akBaseItem as Weapon)ElseIf (DisplayType == 2)  Return (akBaseItem.HasKeyword(WeapTypeDagger))ElseIf (DisplayType == 3)  Return ((akBaseItem.HasKeyword(ClothingRing)) || (GemList.HasForm(akBaseItem)))ElseIf (DisplayType == 4)  Return (akBaseItem.HasKeyword(ArmorShield))ElseIf (DisplayType == 5)  Return ((akBaseItem.HasKeyword(VendorItemPotion)) || (akBaseItem.HasKeyword(VendorItemPoison)) || (WhitePhial.HasForm(akBaseItem)))ElseIf (DisplayType == 6)  Return (ClawList.HasForm(akBaseItem))ElseIf (DisplayType == 7)  Return ((akBaseItem.HasKeyword(WeapTypeSword)) || (akBaseItem.HasKeyword(WeapTypeGreatSword)))EndIfEndFunction


13. go to File and save. and it should compile with no errors. if it does give you an error it might be because this forum adds html debris - particularly the "&" instead of "&". if you do get a compile error, post the error in the comments and i will help you sort it out

14. hit ok to save and close. Go to Messages in the object window and create new. create a new message object, give it an editor ID and click the Message Box check box. Then in the text field type a Warning message such as "you can only put weapons on the weapon display". hit ok to save. duplicate this item and give it a new editor ID. leave everything the same, but change the text to a Count message such as "You can only put one weapon on the weapon display". hit ok to save. you should have a total of 2 new message objects (one Warning and one Count).


15. go back to your container and edit base again. click on Properties in the script window. Depending on the type of rack you are making, you will ONLY fill the properties which you need for that rack. you will never fill all the properties for any one display system.

for our example weapon rack, you will only need to fill the following:
DisplayType - fill with a value of "1"
MessageCount - fill with the Count message item you created.
MessageWarning - fill with the Warning message item you created.

for other display types such as dagger case, shield rack, potion rack etc, leave a comment and i will detail which properties you need to fill, or if you can decipher the code in the AllowedItems function, it should tell you which properties will be used for that type. but in any case, DisplayType, and both Message properties must be filled for all types.


---


16. double click your Activator in the render window and Edit Base. go to the script section and add a new script, and give it a name

17. copy and paste the following code into your new activator script:

Spoiler

ObjectReference Property ItemChest  AutoObjectReference Property ItemTrigger  AutoEvent OnActivate(ObjectReference akActionRef)If (akActionRef == Game.GetPlayer())  If ((ItemTrigger.GetTriggerObjectCount() == 0) && ((ItemChest as YourContainerScript).Blocked == False))   ItemChest.Activate(akActionRef)  EndIfEndIfEndEvent

NOTE - the line of code that says "YourContainerScript" - replace with the full name of the container script you created above.


18. save the script, close and hit ok to close the Edit Base window. but keep the edit reference window open.

19. in the reference edit window of your activator object scroll all the way to the Scripts tab and click Properties

20. Fill the ItemChest and ItemTrigger properties by pointing them to the Container and Trigger in the render window.

21. click ok to save, and save your mod.



If you made it this far without falling asleep you are in good shape. your display system should now be functional and you can test it out in game. i know its a lengthy tutorial but that is because we are building a new system from scratch.
If you have any questions, or if you are curious as to how the script actually works, i can break down the code for you in the comments below.

when your test is complete you can copy and paste more of these by selecting all the parts and pasting them around your interior cell (the properties should also update with each copy).

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Thu Jun 21, 2012 3:13 am
by naana
just to drive the point home, this is what is dumped in the papyrus log, just by COC'ing into riverwood. this is from Alvors weapon rack:

[05/05/2012 - 03:43:06AM] DARYL - [WeaponRackActivateSCRIPT < (000ACD7F)>] running OnCellLoad() and AlreadyInit = False[05/05/2012 - 03:43:06AM] DARYL - [WeaponRackActivateSCRIPT < (000ACD81)>] running OnCellLoad() and AlreadyInit = False[05/05/2012 - 03:43:06AM] DARYL - [WeaponRackActivateSCRIPT < (000B6F6A)>] running OnCellLoad() and AlreadyInit = False[05/05/2012 - 03:43:06AM] DARYL - [WeaponRackActivateSCRIPT < (000ACD7F)>] The TriggerMarker is [WeaponRackTriggerSCRIPT < (000ACD7E)>][05/05/2012 - 03:43:06AM] DARYL - [WeaponRackActivateSCRIPT < (000ACD81)>] The TriggerMarker is [WeaponRackTriggerSCRIPT < (000ACD80)>][05/05/2012 - 03:43:06AM] DARYL - [WeaponRackActivateSCRIPT < (000B6F6A)>] The TriggerMarker is [WeaponRackTriggerSCRIPT < (000B6F69)>][05/05/2012 - 03:43:07AM] DARYL - [WeaponRackActivateSCRIPT < (000ACD81)>] The Starting Weapon is None[05/05/2012 - 03:43:07AM] DARYL - [WeaponRackActivateSCRIPT < (000ACD81)>] Doesn't have a starting weapon[05/05/2012 - 03:43:07AM] DARYL - [WeaponRackActivateSCRIPT < (000ACD81)>] finishing OnCellLoad() and AlreadyInit = TRUE[05/05/2012 - 03:43:07AM] DARYL - [WeaponRackActivateSCRIPT < (000ACD7F)>] The Starting Weapon is [ObjectReference < (00035514)>][05/05/2012 - 03:43:07AM] DARYL - [WeaponRackActivateSCRIPT < (000B6F6A)>] The Starting Weapon is [ObjectReference < (000B6F6B)>][05/05/2012 - 03:43:07AM] DARYL - [WeaponRackActivateSCRIPT < (000ACD7F)>] Has a starting weapon[05/05/2012 - 03:43:07AM] DARYL - [WeaponRackActivateSCRIPT < (000B6F6A)>] Has a starting weapon[05/05/2012 - 03:43:07AM] DARYL - [WeaponRackActivateSCRIPT < (000ACD7F)>] Handling Starting Weapon[05/05/2012 - 03:43:07AM] DARYL - [WeaponRackActivateSCRIPT < (000B6F6A)>] Handling Starting Weapon[05/05/2012 - 03:43:07AM] DARYL - [WeaponRackActivateSCRIPT < (000ACD7F)>] Disabling physics on [ObjectReference < (00035514)>][05/05/2012 - 03:43:07AM] DARYL - [WeaponRackActivateSCRIPT < (000B6F6A)>] Disabling physics on [ObjectReference < (000B6F6B)>][05/05/2012 - 03:43:07AM] DARYL - [WeaponRackActivateSCRIPT < (000ACD7F)>] Moving 0 to the SwordMarker[05/05/2012 - 03:43:07AM] DARYL - [WeaponRackActivateSCRIPT < (000ACD7F)>] finishing OnCellLoad() and AlreadyInit = TRUE[05/05/2012 - 03:43:07AM] DARYL - [WeaponRackActivateSCRIPT < (000B6F6A)>] Moving 0 to the WarhammerMarker[05/05/2012 - 03:43:07AM] DARYL - [WeaponRackActivateSCRIPT < (000B6F6A)>] finishing OnCellLoad() and AlreadyInit = TRUE


that may not seem like a lot of papyrus activity, but imagine what happens when you add 20-30+ of these weapon racks into a single cell. i'm not discrediting bethesda's script at all, because the weapon racks were never meant to be used more than a few times per cell (you never see more than a handful of them anywhere in vanilla game).

so just be mindful, if you are going to use vanilla stuff, use it with VANILLA INTENT.

placing a million vanilla weapon racks is asking for serious trouble, not necessarily to you, but the users of your mod (you don't know how many other mods they have enabled). think of resource as a limited budget, dont spend it all in one shot. leave enough overhead so that you leave with a surplus as a courtesy to other modders who need that resource for their mods too.

another culprit is bookshleves, so much resources used for so little benefit. mannequins are also load-hogs, but at least they serve a very useful purpose, but should be used sparingly and cautiosly (i personally never have more than 12-16 in a single cell)

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Thu Jun 21, 2012 6:04 am
by victoria johnstone
For step 4a, instead of attaching a script to the trigger, you can just set the trigger as the activate parent of the container. Remember that the trigger cannot be at 0.0 for Z axis rotation or else you can't activate it.

Thanks for posting this! I have a decorator assistant mod that I have http://www.gamesas.com/topic/1368584-need-help-with-my-mod/ with. After reading this and seeing how you used the TranslateX functions, I decided to try it out and it doesn't have the bugs involved with using MoveTo and SetPosition. I'm going to update the scripts in my mod to use the translate functions instead.

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Thu Jun 21, 2012 1:18 pm
by Paula Rose
edit - parent activate doesnt work on containers

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Thu Jun 21, 2012 4:50 am
by oliver klosoff
Hi Amethyst Deceiver

I'd be very interested in trying out your new and improved script. I tried working with the original version but couldn't get it working so had to put it aside for a while as I had other problems to resolve first. I've come back to see if I can pick up where I left off so if you could please post a new tutorial with scripts I would be very grateful. I'm pretty new to working with scripts though so if you could make the tutorial as step-by-step as possible that would really help.

Thanks again and here's hoping!

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Thu Jun 21, 2012 2:29 am
by Karine laverre
full tutorial is up

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Thu Jun 21, 2012 11:24 am
by Danii Brown
Fantastic, I'm going to try this right now. Wish me luck! :biggrin:

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Thu Jun 21, 2012 2:36 pm
by Hussnein Amin
Right, I got side-tracked so I've just started now. And already I've fallen at the first hurdle :blush:

In step 2 you say to select a model for the container. I've opened up the properties and I'm looking for the dummysword01.nif file but I can't find it. Where should I be looking?

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Thu Jun 21, 2012 1:44 pm
by Petr Jordy Zugar
You won't find anything until you've extracted the meshes bsa. If you don't want to do that, you can create a dummy file. Double-click on an item to edit it, for example an XMarker.

For the model, you will see the name of the nif file that it uses. For an XMarker, this is MarkerX.nif. The file path for these files are in your ...\Skyrim\Data\Meshes\ folder. So create a text file in your meshes folder, and rename it to "MarkerX.nif". Now you can create a new container, and for its model, point it towards your dummy file.

Remember to delete your dummy file before loading the game.

NOTE: The model for the XMarker isn't actually invisible, you just can't see it in the game because an XMarker has the "IsMarker" flag checked. In other words, find something else to use for your model.

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Thu Jun 21, 2012 12:00 am
by N Only WhiTe girl
:sad: Trying to enter the script in step 12 and it causes CK to crash.

I've narrowed it down to this line:

Bool Property Blocked = False Auto
Message Property MessageWarning Auto
Message Property MessageCount Auto
Keyword Property ArmorShield Auto
Keyword Property WeapTypeDagger Auto
Keyword Property WeapTypeSword Auto
Keyword Property WeapTypeGreatSword Auto
Keyword Property ClothingRing Auto
Keyword Property VendorItemPotion Auto
Keyword Property VendorItemPoison Auto
FormList Property GemList Auto
FormList Property ClawList Auto
FormList Property WhitePhial Auto
Form Property ItemSlot = None Auto Hidden
Int Property PlacedItem = None Auto Hidden
Int Property DisplayType Auto
; 1 = Weapon rack, 2 = Dagger case, 3 = Jewel display, 4 = Shield plaque, 5 = Potion/poison, 6 = Dragon claw, 7 = COA weapon

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
Actor PlayerRef = Game.GetPlayer()
If (akSourceContainer == PlayerRef)
If (AllowedItems(akBaseItem))
If (aiItemCount == 1) && (PlacedItem == 0)

It will add the script before this line but as soon as I put the line in CK crashes. Any ideas?

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Thu Jun 21, 2012 5:30 am
by Avril Churchill
Int Property PlacedItem = None Auto Hidden
that actually should be

Int Property PlacedItem = 0 Auto Hidden



i must have accidentally wrote "none" when i was cleaning up the HTML from the script after editing the post.

an integer cannot have a none value

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Thu Jun 21, 2012 11:58 am
by Pawel Platek
Tried again with the updated script but it still fails after entering the red line in my last post.

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Thu Jun 21, 2012 12:14 am
by NAtIVe GOddess
Nope, still can't get past step 12...

I tried creating a blank scrip file on the container and then opening the .pex file using notepad++ to paste the full script in there since it crashed every time I tried it in the CK. Seems that after applying the properties when I go back to the .pex file your script has vanished.

I thought I'd try the rest of the steps anyway to see if it somehow magically worked but then got stuck on step 20. I'm guessing the property type for ItemChest should be set to container but I don't know what to set ItemTrigger to...

Maybe I'm just making hard work of this. I feel like I'm missing something obvious, but I've run through the steps many times now and still get the same problems :ermm:

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Thu Jun 21, 2012 8:34 am
by NeverStopThe
Nope, still can't get past step 12...

I tried creating a blank scrip file on the container and then opening the .pex file using notepad++ to paste the full script in there since it crashed every time I tried it in the CK. Seems that after applying the properties when I go back to the .pex file your script has vanished.

I thought I'd try the rest of the steps anyway to see if it somehow magically worked but then got stuck on step 20. I'm guessing the property type for ItemChest should be set to container but I don't know what to set ItemTrigger to...

Maybe I'm just making hard work of this. I feel like I'm missing something obvious, but I've run through the steps many times now and still get the same problems :ermm:

PEX files are compiled scripts and should never be modifier as is!

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Thu Jun 21, 2012 7:16 am
by Eve(G)
OK, that explains why I can't change anything on the script directly after creating. Still can't figure out why I can't get the script to apply in the first place though. As soon as I click OK to save the script it brings up a "Creation Kit has crashed" window and shuts it down.

:wallbash:

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Wed Jun 20, 2012 11:44 pm
by Georgine Lee
thats very strange. whats even more strange is how you managed to save the 2nd script without the first, since the 2nd script directly references the first script by name (it wont even compile unless the first script is saved in the scripts folder with the function that is being called)

are you sure you copy/pasted everything into the blank script after creating it (directly under the text that reads "yourscriptname" extends objectrefernce)

when you hit save does it crash? or only after you try to close the container base object?

also itemtrigger refers to the object you created in steps 9-10

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Thu Jun 21, 2012 3:07 am
by ChloƩ
100% sure I'm copying the whole script from step 12. It crashes as soon as I click the OK button on the panel that I paste the script into. I enter my script name, leave the Extends field set to objectreference and then paste the script in the box at the bottom. As I said I tried entering just parts of the script starting from the top and it works up until I use the line in red above.

As for the part about the second script, I was only able to do this as I had created a blank script for step 12 and then tried to copy the text into the .pex file directly. So there was actually a script file there, though it was blank. This meant I could reference it in the second script.

Lastly, I get the bit about the itemtrigger refering to the object from steps 9 and 10, but when you add a new property it asks for the Type at the top. I wasn't sure what to set here as this determines what objects you can set for the value and as far as I can tell once you create it you can't change it...

Thanks again for your help, I know what it's like dealing with people who just don't seem to get what you're trying to show them :biggrin:

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Wed Jun 20, 2012 11:26 pm
by Kayla Keizer
100% sure I'm copying the whole script from step 12. It crashes as soon as I click the OK button on the panel that I paste the script into. I enter my script name, leave the Extends field set to objectreference and then paste the script in the box at the bottom. As I said I tried entering just parts of the script starting from the top and it works up until I use the line in red above.

The "box at the bottom" is the documentation string; it is not where you put the code. That is usually used for comments on the purpose of the script (if you decide to use it at all).

You should just click OK after entering the name and choosing what the script extends in order to create a new script. The new script will be added to your object. Then you right-click the script and choose "Edit Source", which will bring up the window that you actually paste the script into.

I'm not sure that would be any help though. Even though you were pasting the code into the wrong spot, it still shouldn't have caused a crash.

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Thu Jun 21, 2012 11:28 am
by Latino HeaT
:facepalm: I feel like such an idiot. It all makes perfect sense now. See, I told you I'd never done this before!

OK so I've entered the script and it saves fine. I'm guessing the 'comment' field can only contain so many characters as I seem to remember it crashed on the equivalent line when I tried the previous time.

Anyway I've followed the rest of the steps and it is now working! Thank you so much for the help with this :bowdown:

I feel a bit cheeky asking for more but you never know if you dont ask. I jumped in game to test and it takes the wepons fine, though obviously the different pivot points on the weapons mean they line up differently. Am I right in thinking that the mounts will be specific to certain weapon types? Ie, you will have to set up a mount for bows slightly differerntly to swords? Also I mounted a dagger on the test mount and I can't take it off, the weapon must sit fully inside the container or something so I can't get to it. I guess using a dummy dagger or different container object will resolve this?

Finally I would love to try this out for a variety of different storage types such as potions, books if possible and so on. I'd love to see the list of Properties required for each thing.

But once again let me say thanks for your work!

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Thu Jun 21, 2012 12:11 am
by Baby K(:
you shouldnt add a new property for itemtrigger because the property is already there. you only need to fill it by clicking edit value and then pointing it to your trigger box in the render window.


if you cant remove a weapon after mounting it, there is something wrong with your trigger (or placement of it). the shape of the container doesnt have any purpose other than to give you an idea of how your item will be placed. the trigger determines whether an item can be placed or not, so make sure when you position it in the CK, there are no objects touching it or inside it anywhere (other than the container of course)

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Thu Jun 21, 2012 3:08 am
by Lily
Very cool tutorial, thanks for writing this up :D

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Thu Jun 21, 2012 2:01 pm
by STEVI INQUE
Hi Amethyst

I'm back for a bit more advice on your script please. I've just started playing around with it to see what else I can get it to store and remember you saying to ask if we wanted a list of properties to fill on the container script properties. I thought it would be as simple as changing the DisplayType value from 1 for a weapon to 6 for a Dragon Claw for example but it doesn't appear to work. The container itself works but it won't accept a claw and instead shows the warning text. Could you please advise?

Also does this system work for replacing bookshelves? I encountered large performance hits when trying to use multiple bookshelves so was hoping that your method might work as an alternative. I haven't tried anything with books yet but was just wondering if it would be viable?

Cheers

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Thu Jun 21, 2012 12:30 am
by adam holden
for dragon claws, you would need to create a formlist and add all the dragon claws to that formlist (search claw in misc item, it should bring up all the dragon claws, there are 10 total, ignore the one thst says E3goldenclaw or something), drag these items into your formlist window

in the script, the property Clawlist needs to be filled with this new formlist you created.


vanilla bookshelves are a huge waste of resource. they should be avoided at all costs, unless your player home is the size of Breezehome with very few mannequins (no more than 2 or 3). the way the script was written it was definitely never intended to be used in large interiors or with several other bookshelves in the same cell

i am in the process of writing a mod-friendly script for a bookshelf that doesnt consume so much load resource, but it may not be likely. i will post it if i do make progress though. (this display script wont work with books because you need the books to be affected by physics and gravity, this script disables physics for the displayed items)

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Thu Jun 21, 2012 9:52 am
by Claire Lynham
OK cool, I'll keep an eye out for the bookshelf script to see if it comes along. On a side could I still use this script to create a single book mount so I could place a book on a lecturn for example?

PS - claw mount now working, thanks!

Universal Item Display Script (Weapons, Shields, Potions etc

PostPosted: Thu Jun 21, 2012 9:07 am
by Ann Church
if you want the lecturn to be a special book display (where the player can put whatever book they want on it), this script could work for it (actually not bad idea).

you would need to add the following to the bottom of the AllowedItems function (just above the last EndIf line)

ElseIf (DisplayType == 8)  Return (akBaseItem as Book)

then just set your DisplayType property to a value of 8, and dont need to fill any other properties besides the required ones.


but if you want this to be something for like a quest where the player has to place a specific book on a lecturn in order for something to happen in the quest, i would suggest making a new script specifically for that purpose