jetfalmer Posted March 2, 2013 Share Posted March 2, 2013 (edited) Hi guys. I need your help with an idea to improve a mod.I made a face showing closed faced helmet to go with the Ancient falmer Armor.It is a retexture based on the ebony helmet of the mod "improved closed faced helmets" by navida1The problem is my player has a beard and it clips through the helmet.This will allow male characters to wear masks like the dark brotherhood and other without clipping.As there is no biped slot for beards in the CK,A solution will be a script that "shaves" the player as he equips the helmet, by giving him the nobeardand restores his beard as he unequips it.Here are two scripts I made following the papyrus tutorial. They are very sloppy though! Scriptname EquipHelmetScript extends ObjectReferenceEvent OnObjectEquipped(Form akBaseObject, ObjectReference akReference) if akBaseObject as armor Debug.Trace("This actor just equipped a piece of armor!") if ( Player.GetNthHeadPart(6) != BeardList.GetAt(0) as HeadPart ;if he has a beard...BeardList.GetAt(0) =nobeard old_beard =Player.GetNthHeadPart(6) ;stores the beard info before it shaves it old_beard_color = Player.GetNthHeadPart(6) ??? ;stores the beard's color. I dont know how! Player.SetNthHeadPart(BeardList.GetAt(0) as HeadPart, 6) ;gives the nobeard endif endIfendEventand alsoScriptname UnequipHelmetScript extends ObjectReferenceEvent OnObjectUnequipped(Form akBaseObject, ObjectReference akReference) if akBaseObject as Armor Debug.Trace("This actor just unequipped a piece of armor!") if old_beard has a value then ?????? ; if the player had no beard in the first place or the helmet was already equiped when the mod was activated. Player.SetNthHeadPart(6) = old_beard ;restores beard set beard color = old_beard_color ??? ;restores beards color I dont know how endIf end ifendEventThanks for reading this. Edited March 2, 2013 by jetfalmer Link to comment Share on other sites More sharing options...
Lywin Posted March 2, 2013 Share Posted March 2, 2013 Can you have a different colored beard than your hair? I can't recall at the moment. In the unequip script I'm not sure old_beard has to have a specific value, just be != none maybe?I do see an issue possibly if the player gets a face change with the helmet equipped and they change their beard,you would be restoring the previous beard, unless helmets get unequip when doing that then your event should be called beforeresulting in no issues. SetNthHeadPart(HeadPart nHeadPart, Int slotPart)You have it right in the Equip Event, but call it incorrectly in the Unequip Event. Link to comment Share on other sites More sharing options...
steve40 Posted March 3, 2013 Share Posted March 3, 2013 (edited) Your scripts won't even compile, doh. The script must extend ACTOR if you want to use OnObjectEquipped and OnObjectUnequipped events, and can only be placed on an ACTORYou must use OnEquipped and OnUnequipped events if you want to put the script directly on the armorYou haven't defined the player property.You haven't defined the BeardList property.You must call GetNthHeadpart on an ACTORBASE.There are missing parentheses in your IF statement.You haven't declared some of your variables (old_beard, old_beard_color)."endif" should be one word.SetNthHeadpart has the wrong syntax, as Lywin has pointed out. Also, You neglected to test if the equipped/unequipped armor is actually a helmet.You can't do this as two separate scripts. Both of those events need to be in the same script because they need to share two common variables (old_beard, old_beard_color). EDIT: this script complies. Whether it does what you want is another matter: Scriptname EquipHelmetScript extends Actor Actor Property PlayerREF auto HeadPart Property HumanBeard00NoBeard auto ActorBase pBase HeadPart old_beard ColorForm bColor Event OnInit() pBase = playerREF.GetActorBase() EndEvent Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference) if akBaseObject as armor && (akBaseObject as armor).IsHelmet() Debug.Notification("This actor just equipped a helmet!") if pBase.GetNthHeadPart(6) != HumanBeard00NoBeard ;if he has a beard old_beard = pBase.GetNthHeadPart(6) ;stores the beard info before it shaves it bColor = pBase.GetHairColor() ;stores the hair color pBase.SetNthHeadPart(HumanBeard00NoBeard, 6) ;gives the nobeard endIf endIf endEvent Event OnObjectUnequipped(Form akBaseObject, ObjectReference akReference) if akBaseObject as Armor && (akBaseObject as armor).IsHelmet() Debug.Notification("This actor just unequipped a helmet!") if old_beard != none && pBase.GetNthHeadPart(6) == HumanBeard00NoBeard ;if the player has a saved beard AND if the player currently has no beard pBase.SetNthHeadPart(old_beard, 6) ;restores beard pBase.SetHairColor(bColor) ;restores hair color) Utility.SetINIBool("bUseFaceGenPreprocessedHeads:General", false) ;disable preprocessed heads playerREF.QueueNiNodeUpdate() ;update the mesh for face changes to be visible Utility.SetINIBool("bUseFaceGenPreprocessedHeads:General", true) ;reenable preprocessed heads endIf endIf endEvent EDIT: This script must be placed on a PLAYER QUEST ALIASEDIT: I corrected the script to extend Actor instead of ObjectReference EDIT: If you want a script to put specifically on the HELMET, then the script needs to be thus: Scriptname EquipHelmetScript extends ObjectReference Actor Property PlayerREF auto HeadPart Property HumanBeard00NoBeard auto ActorBase pBase HeadPart old_beard ColorForm bColor Event OnInit() pBase = playerREF.GetActorBase() EndEvent Event OnEquipped(Actor akActor) if akActor == playerREF Debug.Notification("The player just equipped a helmet!") if pBase.GetNthHeadPart(6) != HumanBeard00NoBeard ;if he has a beard old_beard = pBase.GetNthHeadPart(6) ;stores the beard info before it shaves it bColor = pBase.GetHairColor() ;stores the hair color pBase.SetNthHeadPart(HumanBeard00NoBeard, 6) ;gives the nobeard endIf endIf endEvent Event OnUnequipped(Actor akActor) if akActor == playerREF Debug.Notification("The player just unequipped a helmet!") if old_beard != none && pBase.GetNthHeadPart(6) == HumanBeard00NoBeard ;if the player has a saved beard AND if the player currently has no beard pBase.SetNthHeadPart(old_beard, 6) ;restores beard pBase.SetHairColor(bColor) ;restores hair color) Utility.SetINIBool("bUseFaceGenPreprocessedHeads:General", false) ;disable preprocessed heads playerREF.QueueNiNodeUpdate() ;update the mesh for face changes to be visible Utility.SetINIBool("bUseFaceGenPreprocessedHeads:General", true) ;reenable preprocessed heads endIf endIf endEvent EDIT: I updated the scripts to do away with the stupid FormList.EDIT: fixed a bug Edited March 3, 2013 by steve40 Link to comment Share on other sites More sharing options...
jetfalmer Posted March 3, 2013 Author Share Posted March 3, 2013 (edited) I can't believe you did that! Thank you steve40. I'm sorry that your eyes had to see my bad scripting. I will add this to the mod and get back with the outcome. Edit: doesn't work. I probably did sth wrong here is the linkhttp://skyrim.nexusmods.com/mods/32722 Edited March 3, 2013 by jetfalmer Link to comment Share on other sites More sharing options...
jet4571 Posted March 3, 2013 Share Posted March 3, 2013 Why not just use the same system as normal guard helmets do? some of the guards do have a beard and if the player wears one of the helmets and has a beard the beard is gone. Link to comment Share on other sites More sharing options...
jetfalmer Posted March 3, 2013 Author Share Posted March 3, 2013 (edited) Why not just use the same system as normal guard helmets do? some of the guards do have a beard and if the player wears one of the helmets and has a beard the beard is gone. Because it is a different type of helmet .See for yourself. This is the reason why DB cowl doesn't come with a mask for males. Steve40 is trying to bypass that with his script. Edited March 3, 2013 by jetfalmer Link to comment Share on other sites More sharing options...
Recommended Posts