Jump to content

Mannequins scripting


viper123

Recommended Posts

So i am bussy modding my first big mod. Its a castle home, finnished with most of the rooms and placing all the npc and stuff, now to start with phase to scripting.

 

I wan't to know if i can make the armor on a mannequin be equiped on the npc gaurds around the castle. So that the gaurds can look like the player wan't them to look. Same with weapon racks. The weapon on the wall mounted weapon display should be equiped by the npc gaurds.

 

Any idee's on how to do this, and how hard will it be to do it?

 

tnx in advance

Link to comment
Share on other sites

You would need to make a modified MannequinActivatorSCRIPT. Don't change the vanilla script, make a new one and copy the code from the vanilla script.

 

Then, make some new properties on top of the script (where the other properties are already). One for each guard:

 

Actor Property Guard01 auto

 

 

Change the OnItemAdded() section 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!")
	AddToArmorSlot(akBaseItem)
	self.EquipItem(akBaseItem)
	
	Guard01.AddItem(akBaseItem, 1)
	Guard01.EquipItem(akBaseItem)
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

 

 

...and the OnObjectUnequipped() section like this:

 

Event OnObjectUnequipped(Form akBaseObject, ObjectReference akReference)
;Trace("DARYL - " + self + akBaseObject + " was unequipped by the Mannequin")

if (akBaseObject as Armor)
	;Trace("DARYL - " + self + " Form " + akBaseObject + " is armor!")
	RemoveFromArmorSlot(akBaseObject)
	Guard01.UnequipItem(akBaseObject)
	Guard01.RemoveItem(akBaseObject, 1)
else
	;Trace("DARYL - " + self + " Form " + akBaseObject + " is NOT armor!")
endif
endEvent

 

Copy the added lines and change it for each guard.

 

Compile it, add it to the mannequin and don't forget to set the properties. I would suggest to test it with a 'naked' guard.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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