Jump to content

Weapon & Armor Display cases Papyrus Script


Shade1982

Recommended Posts

Very interesting advice!

 

I copied your code, but it gives me errors on your integer line "no viable alternative at input 'Game'", I'm trying to figure it out, but haven't found it yet.

 

Both the pickaxe and the woodcutters axe are classified as war axes as far as I can tell. If I use the other script they work like one anyway.

 

[EDIT] Good god, I keep making stupid mistakes because I'm not reading your text correctly. No wonder I can't get anything to work on my own... I got it to work now, thanks :). [/EDIT]

Edited by Shade1982
Link to comment
Share on other sites

That's good. Are you sure about the woodcutters axe? I couldn't find any WeapType keyword on it.

 

However, I think I figured out how to modify the mannequin script. I wouldn't have thought it'll be that simple:

 

 

Make a copy of MannequinActivatorScript and add a keyword property:

 

Keyword Property ArmorMaterial auto

 

The property has to be filled with one of the ArmorMaterial... keywords (for clothes and robes it's ArmorClothing).

 

Then, modify the OnItemAdded event like this:

 

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
;Trace("DARYL - " + self + " Adding " + akBaseItem + " to the Mannequin")

if (akBaseItem as Armor) 
	;Trace("DARYL - " + self + " Form " + akBaseItem + " is armor!")
			
	if(akBaseItem.HasKeyword(ArmorMaterial))
                       AddToArmorSlot(akBaseItem)
                       self.EquipItem(akBaseItem)
	else
		debug.MessageBox("Wrong type of Armor!")
		self.RemoveItem(akBaseItem, aiItemCount, true, Game.GetPlayer())
	endif
else
	;Trace("DARYL - " + self + " Form " + akBaseItem + " is NOT armor!")
	;MessageBox("You can only place armor on the Mannequin.")
	MannequinArmorWeaponsMESSAGE.Show()
	;WaitMenuMode(0.1)
	self.RemoveItem(akBaseItem, aiItemCount, true, Game.GetPlayer())
	;Game.GetPlayer().AddItem(akBaseItem, aiItemCount, TRUE)
endif


endEvent

Link to comment
Share on other sites

I manually created any missing keywords. Same for the dagger for example, for some reason the game treats daggers very differently from other weapon types...

 

Your script seems to work perfectly, awesome! You are my new hero now :).

 

I would give you credit in my mod, but it's for personal use only and will never be published, sorry :).

Link to comment
Share on other sites

  • 1 year later...

Thanks for a very informative thread. I'm attempting a rack (plaque, really), that accepts only a specific weapon. Thanks to previous posts I'm able to correctly identify the weapon with a simple integer matching.

 

But could anyone tell my why this adjusted script snippet below insists on placing the weapon on the rack? The variable "RequiredItemHexToDecimal" is an Int Auto I've set at top of script (I manually look up the hex code and use an online converter to get a decimal). The boolean returns fine, so the variables themselves don't seem to be an issue.

My problem appears to be the if statement... for some reason, the weapon placement handler fires no matter what.
Auto STATE EmptyRack
EVENT onActivate(ObjectReference TriggerRef)
  Int theWeaponHexInteger = Game.GetPlayer().GetEquippedWeapon().getFormID()
  Bool isAllowedWeapon = (RequiredItemHexToDecimal == theWeaponHexInteger)
  if (TriggerRef == Game.GetPlayer() as Actor)
    if(isAllowedWeapon == FALSE)
      Debug.Notification("Incorrect weapon")
    else
      HandleWeaponPlacement()
    endif 
  endif 
endEVENT
endSTATE
Any pointer is much appreciated.
Edited by timstertimster
Link to comment
Share on other sites

  • Recently Browsing   0 members

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