Jump to content

Scripting Advice - Efficiency


kxdace

Recommended Posts

Posted

Hello Friends,

I have a question about the efficiency of a mod I created. The PC is a Gigolo and can ask NPC’s if they are in need of his “services”.

This dialog can be enabled \ disabled by speaking to the boss.

BOSS “Are you ready for work”

PC Option 1 – Yes (Script 01)

PC Option 2 – No perhaps another time 

 

===SCRIPT 01===

Function Fragment_0(ObjectReference akSpeakerRef)

 

 

       Actor akSpeaker = akSpeakerRef as Actor

       Game.GetPlayer().addToFaction(fFaction)

 

 

EndFunction

 

 

                Faction Property fFaction  Auto

 

 

The conditions for the "GigoloOn" dialog are:

PL GetInFaction Faction fFaction == 1

S GetInFaction Faction fFaction == 0

 

The PC asks an NPC are they in need of his services (Answer is always yes) and they become a follower.

 

Function Fragment_0(ObjectReference akSpeakerRef)

 

 

       Actor akSpeaker = akSpeakerRef as Actor

       akSpeaker.AddToFaction(fFaction)

       Alias_Holder01.ForceRefTo(akSpeaker)

       akSpeaker.SetPlayerTeammate()

 

 

EndFunction

 

 

       Faction Property fFaction  Auto 

                ReferenceAlias Property  Alias_Holder01 Auto

 

 

The next dailog option will allow the PC to engage or decline in sex with the following code:

 

 

Function Fragment_0(ObjectReference akSpeakerRef)

 

 

             Actor akSpeaker = akSpeakerRef as Actor

 

 

             ;debug.notification("new actor")

 

 

             Actor actI = Alias_Holder01.GetActorReference()   

 

 

             ;debug.notification("Actor 1: " + akspeaker)           

             ;debug.notification("Actor 2: " + Alias_Holder01.GetActorReference()   )    

 

 

             actI.SetPlayerTeammate(false)

             ;debug.notification("Act 1 removed from team")

 

 

             actI.RemoveFromFaction(fFaction)

             ;debug.notification("Act 1 removed from faction")

 

 

             akSpeaker.SetPlayerTeammate(false)

             akSpeaker.RemoveFromFaction(fFaction)

 

 

             Alias_Holder01.clear()

 

 

             Game.GetPlayer().AddItem(Gold001, gAmount)

 

 

 

 

             actor[] sexActors = new actor[2]

             sexActors[0] = akspeaker

             sexActors[1] = SexLab.PlayerRef

             sslBaseAnimation[] anims

             SexLab.StartSex(sexActors, anims)

 

 

 

 

EndFunction

 

 

       ReferenceAlias Property  Alias_Holder01 Auto

       Faction Property fFaction  Auto

       SexLabFramework property SexLab auto

       int Property gAmount Auto

                MiscObject Property Gold001  Auto 

 

 

 

Or the player has the choice to decline:

 

 

 

Function Fragment_0(ObjectReference akSpeakerRef)

 

 

 

 

Actor akSpeaker = akSpeakerRef as Actor

 

 

             Actor actI = Alias_Holder01.GetActorReference()   

 

 

             actI.SetPlayerTeammate(false)

             actI.RemoveFromFaction(fFaction)

             Alias_Holder01.clear()

 

 

 

 

EndFunction

 

 

       ReferenceAlias Property  Alias_Holder01 Auto

       Faction Property fFaction  Auto

                SexLabFramework property SexLab auto

 

Any advice on how effective my code is? The only reason I ask is sometime the game crashes if I load a game while I have a "customer" set to follow me in that save.

Other than that my game is very stable. I have about 70 mods. Have played roughly 50 hours and this is the only time I ever experience any kind of crashes.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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