Universal Item Display Script (Weapons, Shields, Potions etc

Post » Wed Jun 26, 2013 9:50 am

I have tried making a helmet display using this script, and when I couldn't get that to work, I tried a dagger display. Both fail when validating what I'm trying to store in them. I feel like I've been over this a thousand times, so I'm hoping a fresh set of eyes (and more experienced ones) can see it easily. Here are the parts of the script that I've modified:

Added this:
Keyword Property ArmorHelmet Auto

Inserted a few items here:

Int Property PlacedItem = 0 Auto Hidden
Int Property DisplayType = 1 Auto
; 1 = Weapon rack, 2 = Dagger case, 3 = Jewel display, 4 = Shield plaque, 5 = Potion/poison, 6 = Dragon claw, 7 = Helmet, 8 = COA weapon, 9 = Treasure, 10 = Mask
ObjectReference ItemRef
Form ItemBase

Here is the end:

Bool 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)) || (PoisonList.HasForm(akBaseItem)))
ElseIf (DisplayType == 6)
Return (OgClawFormList.HasForm(akBaseItem))
ElseIf (DisplayType == 7)
Return (akBaseItem.HasKeyword(ArmorHelmet))
ElseIf (DisplayType == 8)
Return ((akBaseItem.HasKeyword(WeapTypeSword)) || (akBaseItem.HasKeyword(WeapTypeGreatSword)))
ElseIf (DisplayType == 9)
Return (OgTreasureFormList.HasForm(akBaseItem))
ElseIf (DisplayType == 10)
Return (OgMaskFormList.HasForm(akBaseItem))
EndIf
EndFunction

I can't figure out why a vanilla iron helmet fails the keyword(ArmorHelmet) check. Also, a vanilla dwarven dagger fails the keyword(weaptypedagger) check. I have no more ideas. I appreciate your help.

Ogdar

EDIT: I've tried changing the 'Int Property DisplayType = 1 Auto' line to the value '7' for the helmet display. That didn't make a difference, and leaving it just 'DisplayType Auto' didn't work, either. Every time I try to add a helmet to the display, I get my 'warning' message. TBH, I'm getting very tired of that message. .v.

Does anyone have any idea why this script doesn't work?
User avatar
Stephanie Kemp
 
Posts: 3329
Joined: Sun Jun 25, 2006 12:39 am

Post » Wed Jun 26, 2013 3:47 pm

Update: AD, when using a FormList, there are no problems. Only when I'm using the Keyword validation does it fail.
User avatar
Jose ordaz
 
Posts: 3552
Joined: Mon Aug 27, 2007 10:14 pm

Post » Wed Jun 26, 2013 10:26 am

if the item fails the keyword check but succeeds in a formlist check, there is something wrong with either:
A ) the item doesnt have the keyword queried (some vanilla items have the wrong keywords, or is missing keywords it should have)
B ) the keyword you added is not recognized (double check to see if the property is filled correctly)
User avatar
Nick Jase Mason
 
Posts: 3432
Joined: Sun Jul 29, 2007 1:23 am

Post » Wed Jun 26, 2013 7:01 pm

Ok, I checked the helmet and keyword to make sure they had the same number. Same goes for the property value of the container script. Speaking of values, I chose the warning and count messages, gave it the correct display number and also chose ArmorHelmet. Everything else was left as . Is that correct?

Oddly, none of the 'keyword' ones I've done work. I know that adding the Helmet and Cloaks (from Cloaks of Skyrim) were my doing, so maybe I made a mistake, but for the dagger display I didn't change anything you had, but I still get the 'only daggers can be put here' message.


Keyword Property ArmorHelmet Auto
Keyword Property ArmorCloak Auto
Keyword Property WeapTypeDagger Auto


ElseIf (DisplayType == 2)
Return (akBaseItem.HasKeyword(WeapTypeDagger))
ElseIf (DisplayType == 8)
Return (akBaseItem.HasKeyword(ArmorHelmet))
ElseIf (DisplayType == 11)
Return (akBaseItem.HasKeyword(ArmorCloak))

And these work:

FormList Property OgClawFormList Auto
FormList Property OgMaskFormList Auto

ElseIf (DisplayType == 6)
Return (OgClawFormList.HasForm(akBaseItem))
ElseIf (DisplayType == 10)
Return (OgMaskFormList.HasForm(akBaseItem))
User avatar
Alada Vaginah
 
Posts: 3368
Joined: Sun Jun 25, 2006 8:31 pm

Post » Wed Jun 26, 2013 6:03 pm

I even went so far to ctrl-c the name from the 'keyword' and paste it into my script. I checked the items I was trying to store, and they have the appropriate keyword.
User avatar
Brιonα Renae
 
Posts: 3430
Joined: Mon Oct 22, 2007 3:10 am

Post » Wed Jun 26, 2013 8:47 am

What container are you guys using for your Dragon Claw dummy container? I have the \DummyTGRLoot.nif working, but I have to place it in a really wierd place for the claws to line up on the shelf like I need them to. Would using the vanilla dragon claw mesh and the texture for the dummy items work for a container?
User avatar
Leanne Molloy
 
Posts: 3342
Joined: Sat Sep 02, 2006 1:09 am

Post » Wed Jun 26, 2013 10:19 pm

I'm using the dummybook01.nif. Do you have any idea how to make a 'dummy' from a normal mesh?
User avatar
Albert Wesker
 
Posts: 3499
Joined: Fri May 11, 2007 11:17 pm

Post » Wed Jun 26, 2013 5:11 pm


Ah, lemme try that one, and no, not really for the dummy from normal mesh. I pulled up a dummy in nifscope, and they don't have a texture that I could find, so my hair-brained idea wont work I don't think.
User avatar
Sophie Payne
 
Posts: 3377
Joined: Thu Dec 07, 2006 6:49 am

Post » Wed Jun 26, 2013 5:36 pm

I've got it to work decent lying on a table, but I'm having fits with getting anything to stick on the wall. grumble.... grumble....
User avatar
Jessica Thomson
 
Posts: 3337
Joined: Fri Jul 21, 2006 5:10 am

Post » Wed Jun 26, 2013 3:03 pm

i got this to work in my place (it's a cleaned out bandit fort where if you get to the end, it's basically a player ready hideout). Problem is, everything i put in the display (weapons at this point as that's the only display i made), get flagged as stolen. I'm able to drop non-stolen weapons in the hideout and pick them up fine without having the stolen flag on, but using the case and scripts above somehow puts them in a stolen state. Not sure if this is intended or not. Is there anyway to get the stolen state of the item, somehow store it, then when taking the item back, revert to that particular state? So if i do put a stolen item, it will stay that way. If i put a non-stolen item, I'll get a non-stolen item back when I take it.

Thanks for any help. Appreciate this script and tutorial.

-Mush-
User avatar
Craig Martin
 
Posts: 3395
Joined: Wed Jun 06, 2007 4:25 pm

Post » Wed Jun 26, 2013 4:14 pm


This may or may not be your problem, but did you by any chance just duplicate a vanilla cell to use for your hideout? If so, it might have ownership set to someone. (Just a wild guess.)
User avatar
CYCO JO-NATE
 
Posts: 3431
Joined: Fri Sep 21, 2007 12:41 pm

Post » Wed Jun 26, 2013 1:10 pm

This was a while ago (more than 6 months) when i did so. Knowing me, yes. But i just checked, I set the place to player faction, no npc owner, and (Public, Off limits, and Can't wait) were all NOT checked. I just check marked Public to test but that didn't make a difference.


Edit: Going to try putting these display's in an outside public area to test around.

-Mush-

Edit 2: It's my place. I put the case in whiterun as a test and it ran fine. Kept the original non-stolen item. Hmm, I don't really get what's going on though, cause like i mentioned, if i drop items from my inventory and pick them up, they keep the same status. Nothing in the place is even marked as owned by anyone. I'm able to loot anything there and not have it as stolen. Somehow when the item gets dropped them moved to the wall, it's picking up an ownership someplace in my hideout. This is going to be a pain to track. Anyhow, thanks for giving me a heads up Balok.
User avatar
jessica robson
 
Posts: 3436
Joined: Mon Oct 09, 2006 11:54 am

Post » Wed Jun 26, 2013 9:15 am

Is there ownership set on your container?
User avatar
joseluis perez
 
Posts: 3507
Joined: Thu Nov 22, 2007 7:51 am

Post » Wed Jun 26, 2013 10:32 am

no, I made the container from scratch and used a dummymisc mesh. Left the container reference at default. Going to try and set the container to player to see if that helps.
User avatar
Code Affinity
 
Posts: 3325
Joined: Wed Jun 13, 2007 11:11 am

Post » Wed Jun 26, 2013 9:44 am

if the dungeon belongs to the player after the quest, it is better if you set ownership to the player for the entire cell.

in any case, when i revise this script i will add automatic ownership laundering when the item gets placed (that way it is never displayed as stolen). sometimes stolen items dont want to stay put (they fall on the ground on the next visit)
User avatar
FirDaus LOVe farhana
 
Posts: 3369
Joined: Thu Sep 13, 2007 3:42 am

Post » Wed Jun 26, 2013 1:36 pm


Will try that, thanks.


I added a line to the mountcurrentitem function on the container script. It sets the item to the player. I've been trying to find a way to store the owner before putting it up so when i take it back it'll return the status back to it. Not even sure if it's possible to do that on references in the container though. I guess for now, the way it works would be no different than if I put the item into any container and have my follower loot it. That also clears the owner tag.

Spoiler
Function MountCurrentItem(Form akBaseItem, ObjectReference akItemReference)ObjectReference MountedItemInt i = 0If (akItemReference)	   DropObject(akBaseItem)	   MountedItem = akItemReferenceElse	   MountedItem = DropObject(akBaseItem)EndIfIf (MountedItem != None)	   Blocked = True	   While(!MountedItem.Is3DLoaded()) && (i < 10)		  Utility.Wait(0.1)		  i += 1	   EndWhile	   MountedItem.SetActorOwner(Game.GetPlayer().GetActorBase())	   ; Added this line	   MountedItem.SetMotionType(Motion_Keyframed, False)	   MountedItem.TranslateToRef(Self, 2000.0, 0.0)	   Utility.Wait(1)	   Blocked = False	   ItemRef = NoneEndIfEndFunction
User avatar
Pat RiMsey
 
Posts: 3306
Joined: Fri Oct 19, 2007 1:22 am

Post » Wed Jun 26, 2013 7:21 am

When I'm setting up the display, sometimes I don't have the container exactly where I want (in the case of using a book nif for a claw). I look at it in-game, and then come back to the CK to move it. Problem is that when I go back in-game, it places the item in the original location. I've gotten around this by creating new ones, but am I missing something that would make this easier?
User avatar
Scared humanity
 
Posts: 3470
Joined: Tue Oct 16, 2007 3:41 am

Post » Wed Jun 26, 2013 1:48 pm

@ogdar - it sounds like your problem (and probably with the keyword issue as well) is coming from not using clean saves. you should always have a test save (one that has no history of mods installed, including the one you are currently making), or in this case, it would be safe to use a COC from main menu to test your scripts

when writing scripts, you should never save and reload subsequent saves made after editing scripts (because the old script data could be cached in the save game itself)
User avatar
Arrogant SId
 
Posts: 3366
Joined: Sat May 19, 2007 11:39 am

Post » Wed Jun 26, 2013 4:04 pm

I am working on a rack that can autofill a bunch of item in a raw directly through the player inventory, and it's working well with some item (dragonClaw for example), but it seems that some other items are not seen at all by the triggerbox mecanism.
That's the case for the DragonPriest Masks.
Does someone knows how to fix that?


Below my rack code for those who are interested
Only one script on an activator.
That requires to fill both markers and triggers arrays (each marker must have his trigger on the same array index), then the authItemlist fill by the relevant item for the rack.
I also figured that it's faster and more reliable to use SetPosition/SetAngle rather than translatetoRef()

Spoiler
Scriptname mcUnivDisplayActivator extends ObjectReference  {part of code based on Amethyst Deceiver universaldisplay}ObjectReference [] Property ItemMarker  AutoObjectReference [] Property ItemTrigger  Autoformlist property mcAuthItemList Autoactor property playerRef automessage property mcNoRoomLeft autoauto state idleState	Event OnActivate(ObjectReference akActionRef)		If (akActionRef == playerRef)			gotostate("busyState")		EndIf	EndEventendstateState busyState	event onbeginstate()			If (getFirstFreePlace() >= 0)			placeItems(mcAuthItemList)		EndIf			gotostate("idleState")	endeventendstateint function getFirstFreePlace(int lastused = -1)	int i = lastused + 1	while (i < ItemTrigger.length)		if ItemTrigger[i].GetTriggerObjectCount() == 0				return i		endif		i += 1	endwhile	mcNoRoomLeft.show()	return -1endfunctionfunction placeitems(formlist l)	form f = none	int freeRef = -1	int i = 0		While (i < l.getsize())		f = l.getat(i)					if playerRef.getitemcount(f) > 0			freeRef = getFirstFreePlace(freeRef)			if freeRef < 0				return			endif			MountCurrentItem(f,ItemMarker[freeRef] )			endif		i += 1	EndWhileendfunctionbool Function MountCurrentItem(Form akBaseItem, ObjectReference imarker)	ObjectReference MountedItem		MountedItem =  playerRef.DropObject(akBaseItem, 1)	If MountedItem				Int i = 20		While(!MountedItem.Is3DLoaded()) && i			Utility.Wait(0.1)			i -= 1		EndWhile			MountedItem.SetMotionType(Motion_Keyframed, False)		MountedItem.setangle(imarker.getangleX() , imarker.getangleY() ,imarker.getangleZ() )		MountedItem.setposition(imarker.getpositionx(), imarker.getpositiony(), imarker.getpositionz())		return true	EndIf	return falseEndFunction


note: If necessary, it's easy to replace the player inventory by an another container.
User avatar
e.Double
 
Posts: 3318
Joined: Tue Jul 24, 2007 11:17 pm

Post » Wed Jun 26, 2013 10:35 am

player.dropitem will cause problems if the object has a objectref formID. that was the whole reason why i made this rack script to begin with

by laundering the formID through a container event you can catch the objectref formID of the object as it is dropped. you wont be able to catch the formID through a direct player drop (which is why the vanilla weapon racks are unfixable).
User avatar
amhain
 
Posts: 3506
Joined: Sun Jan 07, 2007 12:31 pm

Post » Wed Jun 26, 2013 7:59 am

ah damn...

I really wanted to avoid this step...

Thanks for the answer anyway^^

ps: i wonder if this issue is related to the one where the player enchanted item is bugged by the equipitem() function... it's kind of the same range of datas not catched properly...
User avatar
Ronald
 
Posts: 3319
Joined: Sun Aug 05, 2007 12:16 am

Post » Wed Jun 26, 2013 12:44 pm

i think its any function that relies on executing from a baseID, but if there is a specific reference (as is probably the case with a customized reference like an enchanted item, not sure), it would need to specify a refID, but the function doesn't use refID's. thats my guess
User avatar
STEVI INQUE
 
Posts: 3441
Joined: Thu Nov 02, 2006 8:19 pm

Post » Wed Jun 26, 2013 11:23 am

but in the case of dropitem(), since it should return an objectreference id, what id it actually returns (in that situation)? an other objectreference? (that means there is another reference lost somewhere?) or just the baseform id? (because i can manipulate it: i can place it on markers, for example)
User avatar
Taylor Bakos
 
Posts: 3408
Joined: Mon Jan 15, 2007 12:05 am

Post » Wed Jun 26, 2013 10:47 pm

it doesnt return any formID at all, that is why papyrus doesnt know what to do with it once you declare the objectref variable in the function. the returned value causes an error.

normally if you do a debug.messagebox(MountedItem) you will get a value printed on screen like: "FF000d63" which is the formID for the newly created objectreference of the item's base object.

with dropobject() on a persistent reference that already has a CK-assigned refID (i.e. a persistent or quest alias object in your iventory that was picked up in the world as an item that was placed there explicitly through the CK and not dynamically generated), mountedItem will return a value of "[Item 1 in container (01001234)].disableHavokOnLoad" instead of a refID. there is nothing you can do with that return value as it is not readable by papyrus to perform any function
User avatar
AnDres MeZa
 
Posts: 3349
Joined: Thu Aug 16, 2007 1:39 pm

Post » Wed Jun 26, 2013 8:02 pm

OK that is good to know. Thx

However since I was able to manipulate these objects (ie dragonpriestmask), I tested a bit deeper, and i figured that they have not objectref attached.
I assume now that the object/mesh is just buggy and can't be caught by the trigger box... which is weird because they have physics, unless armor are not supposed to interact with trigger box... dunno
User avatar
Franko AlVarado
 
Posts: 3473
Joined: Sun Nov 18, 2007 7:49 pm

PreviousNext

Return to V - Skyrim