Jump to content
IGNORED

[Mod] AAF API startscene performance


Recommended Posts

Hi

 

I have a script calling startscene(). Problem is that the actors do some other stuff before starting the scene, and the time between calling startscene and the scene actually starting is about 5-10 seconds, during which they just walk around and probably do some other prep stuff in the background, which kind of breaks fluidity and "immersion". Point is, is there a way to start the scene faster?

 

These are the scene settings

  AAF:AAF_API:SceneSettings settings = AAF_API.GetSceneSettings()
  settings.duration = utility.randomint(_SAC_JF2_SEXDURATION.GetValueInt()-30, _SAC_JF2_SEXDURATION.GetValueInt()+30)
  settings.preventFurniture = False
  settings.skipwalk = true
  settings.usePackages = true
  settings.position = None
  settings.includeTags = None
  settings.excludeTags = None
  settings.locationobject = actors[0]
  settings.skipwalk = True
  settings.scanradius = 100

if actors[0] != None
  femaleprotagonist.PlayIdle(_SAC_AAF_NeutralPose)
  AAF_API.StartScene(actors, settings)
else
  cleanup()
EndIf

TY

Link to comment
On 11/29/2019 at 1:45 PM, dagobaking said:

With skipwalk it should happen pretty fast. I haven't seen a lag of 5-10 seconds.

 

If you want to make sure that there is no movement you could run commands to try to lock the actor(s) in place before running startscene.

 

I'm not sure what's wrong, the code is supposed to teleport in and restrain the male actors while the female plays an idle, stay like that for a few seconds then start the scene.

 

In reality, the female plays the idle, no male actors move in, then the female starts walking around, then the other actors suddenly teleport in and start the scene

 

 

Function DoSexStuff()

if utility.randomint(1, 100) <= _SAC_JF2_THREESOME_P.GetValueInt()
  participants = 3
else
  participants = 2
EndIf

Actor[] actors = new Actor[participants]

if utility.randomint(1, 100) <= _SAC_JF2_PLAYERFUCK_P.GetValueInt()
  if Game.GetPlayer().isinscene() == 0 && Game.GetPlayer().HasKeyword(AAFActorBusy) == false && Game.GetPlayer().HasKeyword(AAFActorLocked) == false && Game.GetPlayer().Isincombat() == false
   actors[0] = Game.GetPlayer()
   playerisinscene = 1
 ;  SetFlyCam(True)
  else
    if _SAC_JF2_ENABLE_NOTIFICATIONS.GetValueInt()
    Debug.Notification("player has been selected but is currently in scene or combat, switching to random female")
    EndIf
    actors[0] = NPCFemale
  EndIf
else
  actors[0] = NPCFemale
endif

_sac_JF_sex_marker_REF = game.getplayer().placeatme(_sac_JF_sex_marker)

float randomanglez = game.getplayer().getanglez()
_sac_JF_sex_marker_REF.setposition(game.getplayer().getpositionx()+100*math.sin(randomanglez), game.getplayer().getpositiony()+100*math.cos(randomanglez), game.getplayer().getpositionz())
;_sac_JF_sex_marker_REF.movetonearestnavmeshlocation()

femaleprotagonist = actors[0]

               femaleprotagonist.AddKeyword(AAFActorLocked)
               NPCMale1.AddKeyword(AAFActorLocked)
               NPCMale2.AddKeyword(AAFActorLocked)
              
               femaleprotagonist.AddKeyword(KW_RSE_NPCInScene)
               NPCMale1.AddKeyword(KW_RSE_NPCInScene)
               NPCMale2.AddKeyword(KW_RSE_NPCInScene)

               femaleprotagonist.AddToFaction(CaptiveFaction)
               NPCMale1.AddToFaction(CaptiveFaction)
               NPCMale2.AddToFaction(CaptiveFaction)  

               femaleprotagonist.stopcombat()
               NPCMale1.stopcombat()
               NPCMale2.stopcombat()

               femaleprotagonist.stopcombatalarm()
               NPCMale1.stopcombatalarm()
               NPCMale2.stopcombatalarm()

  actors[1].MoveTo(_sac_JF_sex_marker_REF)
  actors[0].moveto(_sac_JF_sex_marker_REF)
  actors[2].moveto(_sac_JF_sex_marker_REF)

  utility.wait(1)

if playerisinscene == 1
  actors[0].SetRestrained(true)
endIf

  actors[1].SetRestrained(true)
  actors[2].SetRestrained(true)

player_equipped_weapon = game.GetPlayer().GetEquippedWeapon()

actors[0].unequipitem(actors[0].GetEquippedWeapon())

actors[1] = NPCMale1
actors[1].unequipitem(actors[1].GetEquippedWeapon())

if participants >= 3

actors[2] = NPCMale2
actors[2].unequipitem(actors[2].GetEquippedWeapon())

endif

          protagonist_strip = 0
          if utility.randomint(1, 1) == 1
            Clothes = femaleprotagonist.GetWornItem(3).Item as Armor
            femaleprotagonist.unequipitem(Clothes)
            protagonist_strip = 1
          EndIf

if playerisinscene == 0
femaleprotagonist.playidle(Kneel_Idle)
utility.wait(5)
endIf

  AAF:AAF_API:SceneSettings settings = AAF_API.GetSceneSettings()
  settings.duration = utility.randomint(_SAC_JF2_SEXDURATION.GetValueInt()-30, _SAC_JF2_SEXDURATION.GetValueInt()+30)
  settings.preventFurniture = False
  settings.skipwalk = true
  settings.usePackages = true
  settings.position = None
  settings.includeTags = None
  settings.excludeTags = None
  settings.locationobject = actors[0]
  settings.skipwalk = True
  settings.scanradius = 100

if actors[0] != None
  if playerisinscene == 0
  femaleprotagonist.PlayIdle(_SAC_AAF_NeutralPose)
  endIf
	AAF_API.StartScene(actors, settings)
else
  cleanup()
EndIf

EndFunction

 

Link to comment
6 hours ago, SAC said:

In reality, the female plays the idle, no male actors move in, then the female starts walking around, then the other actors suddenly teleport in and start the scene

I have seen quirks like that happen. But, not in a way that could be reproduced every time. So, it appears to me to be related to the vanilla engine managing resources or something.

Link to comment

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...