Jump to content

Need some help on how to get a script to call a function on another script


Recommended Posts

Posted

So I'm slowly making some progress adding a dynamic appearance stat to Hardship. I already have all the "vanilla" modifiers working, and added a couple from SAKR, so my goal of setting up the modifiers will probably happen with no issues.

But I'm planning to add several extra modifiers from other mods, and it can be difficult to check how they all work together, for balance. So I thought I would create a debug message to help me along.

 

For context, the changes I made to the mod so far was adding a _T_CurrentAppearance global, that goes from 0 to 10, based on the existing _T_Appearance that I commandeered to do my bidding. So you set up a base Appearance, that value is copied to _T_CurrentAppearance and the modifiers change this global further into a final value. This calculation is made in the main quest of the mod, in the _T_BWQuest script, to keep it updated. There's another script in the quest: _T_Functions script.

I've also set up a new item, a makeup box, with a menu set to OnEquipped that allows you to check your current appearance, putting on makeup - with constructible makeup kits - or remove it, modifying the value.

I've decided to add the debug action to this box, since it would be helpful to develop this, but also eventually to the player. The first version worked, but I had to add the calculation code into this item's script. It felt a bit too much, so I tried to simplify it by putting this modifier calculation into the mentioned _T_Functions, and call it from the makeupbox script. The idea is, in the makeupbox script you choose the "debug" menu button, the code calls on the function (in _T_Functions) that calculates the individual modifiers, and then another function in the _T_Function script (somethingsomething.show(mod 1, mod 2, mod 3...)) shows a message with those same modifiers. This is a code that works inside the makeupbox script, but I both want to reduce overhead, and learn how to call functions from other scripts. But, I'm missing how to do it.

If I use the (quest script).scriptfunction() code the compiler can't find the function in the functions script. Gives "DebugAppearanceModifiers is not a function or does not exist". When going to the properties, I can only choose the quest as a whole, and I'm not sure if that is enough, since there are 2 scripts there.

If I give the full "address" of the script, "Tentacus:Beggar_Whore:_T_Functions", the error is "cannot call the member function DebugAppearanceModifiers alone or on a type, must call it on a variable". I also tried using CastAs on the main quest of the mod, but again, the compiler can't find the function...

Is this even possible to do? I've read that some objects have limits on how they can interact with quests, references, etc. But other mods seem to have this kind of setup.

Code that works:
 

Spoiler
Scriptname _T_MakeUpBoxScript extends ObjectReference

;-----------------------------------------------------
;Setup
;-----------------------------------------------------

Actor Property PlayerRef Auto 
Armor Property _T_MakeUp Auto Const
MiscObject Property _T_MakeUpKitFull Auto
MiscObject Property _T_MakeUpKitHalf Auto
MiscObject Property _T_MakeUpKitEmpty Auto
Message Property _T_MakeUpBoxMESG Auto Const
GlobalVariable Property _T_CurrentAppearance Auto
GlobalVariable Property _T_MakeUpOn Auto

ActorValue property Charisma Auto
GlobalVariable Property _T_BeatenCounter Auto
Message Property _T_AppearanceDEBUG_MESG Auto Const
int property CHA_Mod auto conditional
int property Bruises_Mod auto conditional
int property Hair_Mod auto conditional

;Main Code
;----------------------------------------------------- 

Event OnEquipped(Actor akActor)
   Int iButton = _T_MakeUpBoxMESG.Show() ; Shows your mirror menu.
   If iButton == 0 ; Check appearance
         If (_T_CurrentAppearance.GetValue() as int) == 0
            Debug.Notification("Your Appearance is DISGUSTING (0)")
         ElseIf (_T_CurrentAppearance.GetValue() as int) == 1
            Debug.Notification("Your Appearance is UGLY (1)")
         ElseIf (_T_CurrentAppearance.GetValue() as int) == 2
            Debug.Notification("Your Appearance is UNATTRACTIVE (2)")
	  ElseIf (_T_CurrentAppearance.GetValue() as int) == 3
            Debug.Notification("Your Appearance is PLAIN (3)")
         ElseIf (_T_CurrentAppearance.GetValue() as int) == 4
            Debug.Notification("Your Appearance is APPEALING (4)")
	  ElseIf (_T_CurrentAppearance.GetValue() as int) == 5
            Debug.Notification("Your Appearance is ATTRACTIVE (5)")
	  ElseIf (_T_CurrentAppearance.GetValue() as int) == 6
            Debug.Notification("Your Appearance is BEAUTIFUL (6)")
	  ElseIf (_T_CurrentAppearance.GetValue() as int) == 7
            Debug.Notification("Your Appearance is GORGEOUS (7)")
         ElseIf (_T_CurrentAppearance.GetValue() as int) == 8
            Debug.Notification("Your Appearance is RAVISHING (8)")
         ElseIf (_T_CurrentAppearance.GetValue() as int) >8
            Debug.Notification("Your Appearance is FLAWLESS (" +_T_CurrentAppearance.GetValue() as int+ ")")
         Endif
         Utility.wait(1.0)

   Elseif iButton == 1
          If _T_MakeUpOn.GetValue() as int ==1
             Debug.Notification("You are already wearing makeup. You need to wait for it to wear off.")
          Elseif (PlayerREF.GetItemCount(_T_MakeUpKitHalf) > 0) 
             PlayerREF.RemoveItem(_T_MakeUpKitHalf)
             PlayerREF.AddItem(_T_MakeUpKitEmpty) 
             _T_MakeUpOn.SetValue(1)
          Elseif (PlayerREF.GetItemCount(_T_MakeUpKitFull) > 0)
             PlayerREF.RemoveItem(_T_MakeUpKitFull)
             PlayerREF.AddItem(_T_MakeUpKitHalf) 
             _T_MakeUpOn.SetValue(1)
          Else
             Debug.Notification ("You don't have any makeup kits in your inventory.")
          Endif
          Utility.wait(1.0)

   Elseif iButton == 2
          If _T_MakeUpOn.GetValue() as int ==0
             Debug.Notification("You are not wearing makeup.")
          Else 
             _T_MakeUpOn.SetValue(0)
          Endif
          Utility.wait(1.0)

   Elseif iButton == 3
         
          If PlayerREF.GetValue(Charisma) >= 9
              CHA_Mod = 2
          Elseif PlayerREF.GetValue(Charisma) >= 6
              CHA_Mod = 1
           Elseif PlayerREF.GetValue(Charisma) <= 1
              CHA_Mod = -1
           Else
             CHA_Mod = 0
           Endif

           Bruises_Mod = - (_T_BeatenCounter.GetValue() as int)

           If (PlayerREF.GetWornItem(30) == None || PlayerREF.GetWornItem(31) == None)
              Hair_Mod = -1
           Else
              Hair_Mod = 0
           Endif

           Utility.wait(1.0)
           AppearanceDebugMessage()
           
   Endif
	PlayerREF.UnequipItem(_T_MakeUp, false, false)

EndEvent

Function AppearanceDebugMessage()

            _T_AppearanceDEBUG_MESG.Show(CHA_Mod, Bruises_Mod, Hair_Mod)

Endfunction

 

 

The kind of code I want to implement:
 

Spoiler
Scriptname _T_MakeUpBoxScript extends ObjectReference

;-----------------------------------------------------
;Setup
;-----------------------------------------------------

Actor Property PlayerRef Auto 
Armor Property _T_MakeUp Auto Const
MiscObject Property _T_MakeUpKitFull Auto
MiscObject Property _T_MakeUpKitHalf Auto
MiscObject Property _T_MakeUpKitEmpty Auto
Message Property _T_MakeUpBoxMESG Auto Const
GlobalVariable Property _T_CurrentAppearance Auto
GlobalVariable Property _T_MakeUpOn Auto

Quest  property _T_DialogueQuest Auto
;_T_Functions property _T_FunctionAppearance auto

;Main Code
;----------------------------------------------------- 

Event OnEquipped(Actor akActor)
   Int iButton = _T_MakeUpBoxMESG.Show() ; Shows your mirror menu.
   If iButton == 0 ; Check appearance
         If (_T_CurrentAppearance.GetValue() as int) == 0
            Debug.Notification("Your Appearance is DISGUSTING (0)")
         ElseIf (_T_CurrentAppearance.GetValue() as int) == 1
            Debug.Notification("Your Appearance is UGLY (1)")
         ElseIf (_T_CurrentAppearance.GetValue() as int) == 2
            Debug.Notification("Your Appearance is UNATTRACTIVE (2)")
	  ElseIf (_T_CurrentAppearance.GetValue() as int) == 3
            Debug.Notification("Your Appearance is PLAIN (3)")
         ElseIf (_T_CurrentAppearance.GetValue() as int) == 4
            Debug.Notification("Your Appearance is APPEALING (4)")
	  ElseIf (_T_CurrentAppearance.GetValue() as int) == 5
            Debug.Notification("Your Appearance is ATTRACTIVE (5)")
	  ElseIf (_T_CurrentAppearance.GetValue() as int) == 6
            Debug.Notification("Your Appearance is BEAUTIFUL (6)")
	  ElseIf (_T_CurrentAppearance.GetValue() as int) == 7
            Debug.Notification("Your Appearance is GORGEOUS (7)")
         ElseIf (_T_CurrentAppearance.GetValue() as int) == 8
            Debug.Notification("Your Appearance is RAVISHING (8)")
         ElseIf (_T_CurrentAppearance.GetValue() as int) >8
            Debug.Notification("Your Appearance is FLAWLESS (" +_T_CurrentAppearance.GetValue() as int+ ")")
         Endif
         Utility.wait(1.0)

   Elseif iButton == 1
          If _T_MakeUpOn.GetValue() as int ==1
             Debug.Notification("You are already wearing makeup. You need to wait for it to wear off.")
          Elseif (PlayerREF.GetItemCount(_T_MakeUpKitHalf) > 0) 
             PlayerREF.RemoveItem(_T_MakeUpKitHalf)
             PlayerREF.AddItem(_T_MakeUpKitEmpty) 
             _T_MakeUpOn.SetValue(1)
          Elseif (PlayerREF.GetItemCount(_T_MakeUpKitFull) > 0)
             PlayerREF.RemoveItem(_T_MakeUpKitFull)
             PlayerREF.AddItem(_T_MakeUpKitHalf) 
             _T_MakeUpOn.SetValue(1)
          Else
             Debug.Notification ("You don't have any makeup kits in your inventory.")
          Endif
          Utility.wait(1.0)

   Elseif iButton == 2
          If _T_MakeUpOn.GetValue() as int ==0
             Debug.Notification("You are not wearing makeup.")
          Else 
             _T_MakeUpOn.SetValue(0)
          Endif
          Utility.wait(1.0)

   Elseif iButton == 3
           Utility.wait(1.0)
           scriptobject _T_Functions_script = _T_DialogueQuest.CastAs("Tentacus:Beggar_Whore:_T_Functions")
           
           _T_Functions_script.DebugAppearanceModifiers()
 ;          Tentacus:Beggar_Whore:_T_Functions.AppearanceDebugMessage()

   Elseif iButton == 4
           Utility.wait(1.0)
  ;         _T_Functions.DebugAppearanceModifiers()
   ;        _T_Functions.AppearanceOtherModsMessage1()

   Elseif iButton == 5
           Utility.wait(1.0)
    ;       _T_Functions.DebugAppearanceModifiers()
     ;      _T_Functions.AppearanceOtherModsMessage2()

   Endif
	PlayerREF.UnequipItem(_T_MakeUp, false, false)

EndEvent

 

 

With the _T_Functions bit:
 

Spoiler
Function DebugAppearanceModifiers()
       Base_App = _T_Appearance. GetValue() as int
       CHA_Mod = 0
       If PlayerREF.GetValue(Charisma) >= 9
           CHA_Mod = 2
       Elseif PlayerREF.GetValue(Charisma) >= 6
           CHA_Mod = 1
       Elseif PlayerREF.GetValue(Charisma) <= 1
           CHA_Mod = -1
       Endif
                                              
       Hair_Mod = 0
                                              
       Weapon equipped = PlayerRef.GetEquippedWeapon( )
       if ( equipped && ! equipped.HasKeyword( WeaponTypeUnarmed ) )
          W_Mod = -1
       Elseif PlayerRef.GetItemCount( ObjectTypeWeapon ) > 0
          W_Mod = -1
       Else
          W_Mod = 1
       Endif

       Booze_Mod = 0
       Add_Mod = 0
       If PlayerREF.HasKeyword (AlcoholEffect)
          Booze_Mod = 1
          Elseif PlayerREF.HasKeyword (AddictionEffect)
             Add_Mod = -1
       Endif

       int HC_Helper = 0
       int HE_Helper = PlayerRef.GetValue(HC_HungerEffect) as int
       int TE_Helper = PlayerRef.GetValue(HC_ThirstEffect) as int
       int SE_Helper = PlayerRef.GetValue(HC_SleepEffect) as int
       if (Game.GetDifficulty() == 6)
          If (HC_HE_Fed.GetValue() == HE_Helper || HC_HE_Peckish.GetValue() == HE_Helper)
             HC_Helper += 1
          Elseif (HC_HE_Starving.GetValue() == HE_Helper || HC_HE_Ravenous.GetValue() == HE_Helper || HC_HE_Famished.GetValue() == HE_Helper)
             HC_Helper = -1
          Endif

	   If  (HC_TE_Hydrated.GetValue() == TE_Helper || HC_TE_Parched.GetValue() == TE_Helper)
             HC_Helper += 1
          Elseif  (HC_TE_SeverelyDehyrdated.GetValue() == TE_Helper || HC_TE_Dehydrated.GetValue() == TE_Helper || HC_TE_MildlyDehydrated.GetValue() == TE_Helper)
             HC_Helper = -1
          Endif

          If PlayerREF.HasPerk (HC_WellRestedPerk)
             HC_Helper += 1
          Elseif  (HC_SE_Incapacitated.GetValue() == SE_Helper || HC_SE_Exhausted.GetValue() == SE_Helper || HC_SE_Fatigued.GetValue() == SE_Helper)
              HC_Helper = -1
          Endif

          If HC_Helper == 3
             HC_Mod = 1
          Elseif HC_Helper == -1
            HC_Mod = -1
          Endif
       Endif

       If _T_MakeUpOn.GetValue() as int == 1
          Makeup_Mod = 1
       Endif

       Float TempHealth = PlayerREF.GetValue(Health)
       Float TempRads = PlayerREF.GetValue(Rads)
       If (TempRads / TempHealth > 0.3)
          Rad_Mod = -1
       Endif

       ;Variables from guest mods
          ;SAKR
       If Game.IsPluginInstalled("SkimpyArmorKeywordResource.esm")
           Quest SAKR_API = Game.GetFormFromFile(0x00000800, "SkimpyArmorKeywordResource.esm") as quest
           sakr_kwd_shoesHighHeels = Game.GetFormFromFile(0x26B4, "SkimpyArmorKeywordResource.esm") as Keyword
           sakr_kwd_shoesKillerHeels = Game.GetFormFromFile(0x26B5, "SkimpyArmorKeywordResource.esm") as Keyword
           ScriptObject sakr_script = SAKR_API.CastAs("SAKR:SAKR_Main")
           int skimpyRating = sakr_script.CallFunction("getPlayerOverallSkimpyRating", new var[0]) as int
           If skimpyRating > 90                ;Don't just go around naked, built an outfit!
               Skimpy_Mod = 0
           Elseif skimpyRating > 80
              Skimpy_Mod = 2
           Elseif skimpyRating > 60
              Skimpy_Mod = 1
           Elseif skimpyRating < 15
              Skimpy_Mod = -1
           Endif

           Heel_Mod = 0
           If PlayerREF.WornHasKeyword(sakr_kwd_shoesKillerHeels)
              Heel_Mod = 1
           Elseif (PlayerREF.WornHasKeyword(sakr_kwd_shoesHighHeels) || PlayerREF.GetWornItem(33) == None)
           Else
               Heel_Mod = -1
	    Endif
        Endif
        
Endfunction

Function AppearanceDebugMessage()

        _T_AppearanceDEBUG_MESG.Show(CHA_Mod, Bruises_Mod, Hair_Mod, HC_Mod, Rad_Mod, Booze_Mod, Add_Mod, W_Mod, Makeup_Mod)
       
Endfunction

Function AppearanceModDebugMessage1()

        _T_AppearanceModDEBUG_MESG1.Show(Skimpy_Mod, Heel_Mod)

Endfunction

Function AppearanceModDebugMessage2()

        _T_AppearanceModDEBUG_MESG2.Show(CSLipstick_Mod)

Endfunction

 

 

Posted

upload the script files into google's ai and ask it what you need, there's a 60% chance that it will give you something that actually works.

Posted (edited)

So I'm more familiar with the Skyrim Creation Kit, I'm assuming it's mostly the same on  FO4.

 

The filename of the source script is _T_Function.psc if I understand correctly? And you commented out all lines that give errors?

 

The issue here might be seen in these lines:

 

 

_T_Functions property _T_FunctionAppearance auto

 

_T_Functions.DebugAppearanceModifiers()

 

 

_T_Functions is the type of the property, if you want to call a function from it, you need to use the variable's name, in this case _T_FunctionAppearance

So the above lines should be: 

 

_T_Functions property _T_FunctionAppearance auto

 

_T_FunctionAppearance.DebugAppearanceModifiers()

 

This should allow the compiler to find the function in the quest script (don't forget to fill in that property later, I can't count how often I messed that up).

 

 

Hope this helps. I'm not familiar with the script full address thing, never encountered that with Skyrim mods.

Edited by a_random_user
Posted
On 10/2/2026 at 3:24 AM, JohnyBurner said:

So I'm slowly making some progress adding a dynamic appearance stat to Hardship. I already have all the "vanilla" modifiers working, and added a couple from SAKR, so my goal of setting up the modifiers will probably happen with no issues.

But I'm planning to add several extra modifiers from other mods, and it can be difficult to check how they all work together, for balance. So I thought I would create a debug message to help me along.

 

For context, the changes I made to the mod so far was adding a _T_CurrentAppearance global, that goes from 0 to 10, based on the existing _T_Appearance that I commandeered to do my bidding. So you set up a base Appearance, that value is copied to _T_CurrentAppearance and the modifiers change this global further into a final value. This calculation is made in the main quest of the mod, in the _T_BWQuest script, to keep it updated. There's another script in the quest: _T_Functions script.

I've also set up a new item, a makeup box, with a menu set to OnEquipped that allows you to check your current appearance, putting on makeup - with constructible makeup kits - or remove it, modifying the value.

I've decided to add the debug action to this box, since it would be helpful to develop this, but also eventually to the player. The first version worked, but I had to add the calculation code into this item's script. It felt a bit too much, so I tried to simplify it by putting this modifier calculation into the mentioned _T_Functions, and call it from the makeupbox script. The idea is, in the makeupbox script you choose the "debug" menu button, the code calls on the function (in _T_Functions) that calculates the individual modifiers, and then another function in the _T_Function script (somethingsomething.show(mod 1, mod 2, mod 3...)) shows a message with those same modifiers. This is a code that works inside the makeupbox script, but I both want to reduce overhead, and learn how to call functions from other scripts. But, I'm missing how to do it.

If I use the (quest script).scriptfunction() code the compiler can't find the function in the functions script. Gives "DebugAppearanceModifiers is not a function or does not exist". When going to the properties, I can only choose the quest as a whole, and I'm not sure if that is enough, since there are 2 scripts there.

If I give the full "address" of the script, "Tentacus:Beggar_Whore:_T_Functions", the error is "cannot call the member function DebugAppearanceModifiers alone or on a type, must call it on a variable". I also tried using CastAs on the main quest of the mod, but again, the compiler can't find the function...

Is this even possible to do? I've read that some objects have limits on how they can interact with quests, references, etc. But other mods seem to have this kind of setup.

Code that works:
 

  Reveal hidden contents
Scriptname _T_MakeUpBoxScript extends ObjectReference

;-----------------------------------------------------
;Setup
;-----------------------------------------------------

Actor Property PlayerRef Auto 
Armor Property _T_MakeUp Auto Const
MiscObject Property _T_MakeUpKitFull Auto
MiscObject Property _T_MakeUpKitHalf Auto
MiscObject Property _T_MakeUpKitEmpty Auto
Message Property _T_MakeUpBoxMESG Auto Const
GlobalVariable Property _T_CurrentAppearance Auto
GlobalVariable Property _T_MakeUpOn Auto

ActorValue property Charisma Auto
GlobalVariable Property _T_BeatenCounter Auto
Message Property _T_AppearanceDEBUG_MESG Auto Const
int property CHA_Mod auto conditional
int property Bruises_Mod auto conditional
int property Hair_Mod auto conditional

;Main Code
;----------------------------------------------------- 

Event OnEquipped(Actor akActor)
   Int iButton = _T_MakeUpBoxMESG.Show() ; Shows your mirror menu.
   If iButton == 0 ; Check appearance
         If (_T_CurrentAppearance.GetValue() as int) == 0
            Debug.Notification("Your Appearance is DISGUSTING (0)")
         ElseIf (_T_CurrentAppearance.GetValue() as int) == 1
            Debug.Notification("Your Appearance is UGLY (1)")
         ElseIf (_T_CurrentAppearance.GetValue() as int) == 2
            Debug.Notification("Your Appearance is UNATTRACTIVE (2)")
	  ElseIf (_T_CurrentAppearance.GetValue() as int) == 3
            Debug.Notification("Your Appearance is PLAIN (3)")
         ElseIf (_T_CurrentAppearance.GetValue() as int) == 4
            Debug.Notification("Your Appearance is APPEALING (4)")
	  ElseIf (_T_CurrentAppearance.GetValue() as int) == 5
            Debug.Notification("Your Appearance is ATTRACTIVE (5)")
	  ElseIf (_T_CurrentAppearance.GetValue() as int) == 6
            Debug.Notification("Your Appearance is BEAUTIFUL (6)")
	  ElseIf (_T_CurrentAppearance.GetValue() as int) == 7
            Debug.Notification("Your Appearance is GORGEOUS (7)")
         ElseIf (_T_CurrentAppearance.GetValue() as int) == 8
            Debug.Notification("Your Appearance is RAVISHING (8)")
         ElseIf (_T_CurrentAppearance.GetValue() as int) >8
            Debug.Notification("Your Appearance is FLAWLESS (" +_T_CurrentAppearance.GetValue() as int+ ")")
         Endif
         Utility.wait(1.0)

   Elseif iButton == 1
          If _T_MakeUpOn.GetValue() as int ==1
             Debug.Notification("You are already wearing makeup. You need to wait for it to wear off.")
          Elseif (PlayerREF.GetItemCount(_T_MakeUpKitHalf) > 0) 
             PlayerREF.RemoveItem(_T_MakeUpKitHalf)
             PlayerREF.AddItem(_T_MakeUpKitEmpty) 
             _T_MakeUpOn.SetValue(1)
          Elseif (PlayerREF.GetItemCount(_T_MakeUpKitFull) > 0)
             PlayerREF.RemoveItem(_T_MakeUpKitFull)
             PlayerREF.AddItem(_T_MakeUpKitHalf) 
             _T_MakeUpOn.SetValue(1)
          Else
             Debug.Notification ("You don't have any makeup kits in your inventory.")
          Endif
          Utility.wait(1.0)

   Elseif iButton == 2
          If _T_MakeUpOn.GetValue() as int ==0
             Debug.Notification("You are not wearing makeup.")
          Else 
             _T_MakeUpOn.SetValue(0)
          Endif
          Utility.wait(1.0)

   Elseif iButton == 3
         
          If PlayerREF.GetValue(Charisma) >= 9
              CHA_Mod = 2
          Elseif PlayerREF.GetValue(Charisma) >= 6
              CHA_Mod = 1
           Elseif PlayerREF.GetValue(Charisma) <= 1
              CHA_Mod = -1
           Else
             CHA_Mod = 0
           Endif

           Bruises_Mod = - (_T_BeatenCounter.GetValue() as int)

           If (PlayerREF.GetWornItem(30) == None || PlayerREF.GetWornItem(31) == None)
              Hair_Mod = -1
           Else
              Hair_Mod = 0
           Endif

           Utility.wait(1.0)
           AppearanceDebugMessage()
           
   Endif
	PlayerREF.UnequipItem(_T_MakeUp, false, false)

EndEvent

Function AppearanceDebugMessage()

            _T_AppearanceDEBUG_MESG.Show(CHA_Mod, Bruises_Mod, Hair_Mod)

Endfunction

 

 

The kind of code I want to implement:
 

  Reveal hidden contents
Scriptname _T_MakeUpBoxScript extends ObjectReference

;-----------------------------------------------------
;Setup
;-----------------------------------------------------

Actor Property PlayerRef Auto 
Armor Property _T_MakeUp Auto Const
MiscObject Property _T_MakeUpKitFull Auto
MiscObject Property _T_MakeUpKitHalf Auto
MiscObject Property _T_MakeUpKitEmpty Auto
Message Property _T_MakeUpBoxMESG Auto Const
GlobalVariable Property _T_CurrentAppearance Auto
GlobalVariable Property _T_MakeUpOn Auto

Quest  property _T_DialogueQuest Auto
;_T_Functions property _T_FunctionAppearance auto

;Main Code
;----------------------------------------------------- 

Event OnEquipped(Actor akActor)
   Int iButton = _T_MakeUpBoxMESG.Show() ; Shows your mirror menu.
   If iButton == 0 ; Check appearance
         If (_T_CurrentAppearance.GetValue() as int) == 0
            Debug.Notification("Your Appearance is DISGUSTING (0)")
         ElseIf (_T_CurrentAppearance.GetValue() as int) == 1
            Debug.Notification("Your Appearance is UGLY (1)")
         ElseIf (_T_CurrentAppearance.GetValue() as int) == 2
            Debug.Notification("Your Appearance is UNATTRACTIVE (2)")
	  ElseIf (_T_CurrentAppearance.GetValue() as int) == 3
            Debug.Notification("Your Appearance is PLAIN (3)")
         ElseIf (_T_CurrentAppearance.GetValue() as int) == 4
            Debug.Notification("Your Appearance is APPEALING (4)")
	  ElseIf (_T_CurrentAppearance.GetValue() as int) == 5
            Debug.Notification("Your Appearance is ATTRACTIVE (5)")
	  ElseIf (_T_CurrentAppearance.GetValue() as int) == 6
            Debug.Notification("Your Appearance is BEAUTIFUL (6)")
	  ElseIf (_T_CurrentAppearance.GetValue() as int) == 7
            Debug.Notification("Your Appearance is GORGEOUS (7)")
         ElseIf (_T_CurrentAppearance.GetValue() as int) == 8
            Debug.Notification("Your Appearance is RAVISHING (8)")
         ElseIf (_T_CurrentAppearance.GetValue() as int) >8
            Debug.Notification("Your Appearance is FLAWLESS (" +_T_CurrentAppearance.GetValue() as int+ ")")
         Endif
         Utility.wait(1.0)

   Elseif iButton == 1
          If _T_MakeUpOn.GetValue() as int ==1
             Debug.Notification("You are already wearing makeup. You need to wait for it to wear off.")
          Elseif (PlayerREF.GetItemCount(_T_MakeUpKitHalf) > 0) 
             PlayerREF.RemoveItem(_T_MakeUpKitHalf)
             PlayerREF.AddItem(_T_MakeUpKitEmpty) 
             _T_MakeUpOn.SetValue(1)
          Elseif (PlayerREF.GetItemCount(_T_MakeUpKitFull) > 0)
             PlayerREF.RemoveItem(_T_MakeUpKitFull)
             PlayerREF.AddItem(_T_MakeUpKitHalf) 
             _T_MakeUpOn.SetValue(1)
          Else
             Debug.Notification ("You don't have any makeup kits in your inventory.")
          Endif
          Utility.wait(1.0)

   Elseif iButton == 2
          If _T_MakeUpOn.GetValue() as int ==0
             Debug.Notification("You are not wearing makeup.")
          Else 
             _T_MakeUpOn.SetValue(0)
          Endif
          Utility.wait(1.0)

   Elseif iButton == 3
           Utility.wait(1.0)
           scriptobject _T_Functions_script = _T_DialogueQuest.CastAs("Tentacus:Beggar_Whore:_T_Functions")
           
           _T_Functions_script.DebugAppearanceModifiers()
 ;          Tentacus:Beggar_Whore:_T_Functions.AppearanceDebugMessage()

   Elseif iButton == 4
           Utility.wait(1.0)
  ;         _T_Functions.DebugAppearanceModifiers()
   ;        _T_Functions.AppearanceOtherModsMessage1()

   Elseif iButton == 5
           Utility.wait(1.0)
    ;       _T_Functions.DebugAppearanceModifiers()
     ;      _T_Functions.AppearanceOtherModsMessage2()

   Endif
	PlayerREF.UnequipItem(_T_MakeUp, false, false)

EndEvent

 

 

With the _T_Functions bit:
 

  Reveal hidden contents
Function DebugAppearanceModifiers()
       Base_App = _T_Appearance. GetValue() as int
       CHA_Mod = 0
       If PlayerREF.GetValue(Charisma) >= 9
           CHA_Mod = 2
       Elseif PlayerREF.GetValue(Charisma) >= 6
           CHA_Mod = 1
       Elseif PlayerREF.GetValue(Charisma) <= 1
           CHA_Mod = -1
       Endif
                                              
       Hair_Mod = 0
                                              
       Weapon equipped = PlayerRef.GetEquippedWeapon( )
       if ( equipped && ! equipped.HasKeyword( WeaponTypeUnarmed ) )
          W_Mod = -1
       Elseif PlayerRef.GetItemCount( ObjectTypeWeapon ) > 0
          W_Mod = -1
       Else
          W_Mod = 1
       Endif

       Booze_Mod = 0
       Add_Mod = 0
       If PlayerREF.HasKeyword (AlcoholEffect)
          Booze_Mod = 1
          Elseif PlayerREF.HasKeyword (AddictionEffect)
             Add_Mod = -1
       Endif

       int HC_Helper = 0
       int HE_Helper = PlayerRef.GetValue(HC_HungerEffect) as int
       int TE_Helper = PlayerRef.GetValue(HC_ThirstEffect) as int
       int SE_Helper = PlayerRef.GetValue(HC_SleepEffect) as int
       if (Game.GetDifficulty() == 6)
          If (HC_HE_Fed.GetValue() == HE_Helper || HC_HE_Peckish.GetValue() == HE_Helper)
             HC_Helper += 1
          Elseif (HC_HE_Starving.GetValue() == HE_Helper || HC_HE_Ravenous.GetValue() == HE_Helper || HC_HE_Famished.GetValue() == HE_Helper)
             HC_Helper = -1
          Endif

	   If  (HC_TE_Hydrated.GetValue() == TE_Helper || HC_TE_Parched.GetValue() == TE_Helper)
             HC_Helper += 1
          Elseif  (HC_TE_SeverelyDehyrdated.GetValue() == TE_Helper || HC_TE_Dehydrated.GetValue() == TE_Helper || HC_TE_MildlyDehydrated.GetValue() == TE_Helper)
             HC_Helper = -1
          Endif

          If PlayerREF.HasPerk (HC_WellRestedPerk)
             HC_Helper += 1
          Elseif  (HC_SE_Incapacitated.GetValue() == SE_Helper || HC_SE_Exhausted.GetValue() == SE_Helper || HC_SE_Fatigued.GetValue() == SE_Helper)
              HC_Helper = -1
          Endif

          If HC_Helper == 3
             HC_Mod = 1
          Elseif HC_Helper == -1
            HC_Mod = -1
          Endif
       Endif

       If _T_MakeUpOn.GetValue() as int == 1
          Makeup_Mod = 1
       Endif

       Float TempHealth = PlayerREF.GetValue(Health)
       Float TempRads = PlayerREF.GetValue(Rads)
       If (TempRads / TempHealth > 0.3)
          Rad_Mod = -1
       Endif

       ;Variables from guest mods
          ;SAKR
       If Game.IsPluginInstalled("SkimpyArmorKeywordResource.esm")
           Quest SAKR_API = Game.GetFormFromFile(0x00000800, "SkimpyArmorKeywordResource.esm") as quest
           sakr_kwd_shoesHighHeels = Game.GetFormFromFile(0x26B4, "SkimpyArmorKeywordResource.esm") as Keyword
           sakr_kwd_shoesKillerHeels = Game.GetFormFromFile(0x26B5, "SkimpyArmorKeywordResource.esm") as Keyword
           ScriptObject sakr_script = SAKR_API.CastAs("SAKR:SAKR_Main")
           int skimpyRating = sakr_script.CallFunction("getPlayerOverallSkimpyRating", new var[0]) as int
           If skimpyRating > 90                ;Don't just go around naked, built an outfit!
               Skimpy_Mod = 0
           Elseif skimpyRating > 80
              Skimpy_Mod = 2
           Elseif skimpyRating > 60
              Skimpy_Mod = 1
           Elseif skimpyRating < 15
              Skimpy_Mod = -1
           Endif

           Heel_Mod = 0
           If PlayerREF.WornHasKeyword(sakr_kwd_shoesKillerHeels)
              Heel_Mod = 1
           Elseif (PlayerREF.WornHasKeyword(sakr_kwd_shoesHighHeels) || PlayerREF.GetWornItem(33) == None)
           Else
               Heel_Mod = -1
	    Endif
        Endif
        
Endfunction

Function AppearanceDebugMessage()

        _T_AppearanceDEBUG_MESG.Show(CHA_Mod, Bruises_Mod, Hair_Mod, HC_Mod, Rad_Mod, Booze_Mod, Add_Mod, W_Mod, Makeup_Mod)
       
Endfunction

Function AppearanceModDebugMessage1()

        _T_AppearanceModDEBUG_MESG1.Show(Skimpy_Mod, Heel_Mod)

Endfunction

Function AppearanceModDebugMessage2()

        _T_AppearanceModDEBUG_MESG2.Show(CSLipstick_Mod)

Endfunction

 

 

 

Take a look at how the SAKR API or "sex attributes" are structured. Alternatively.

Also, I’ve provided working code here for calling the `violate` functions.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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