Jump to content

My Sofia Sexlab Defeat Compatibility Patch


Recommended Posts

Posted (edited)

I recently developed a patch for Sofia and Sexlab Defeat, if you use both mods at once before you probably noticed that Sofia tends to ignore Sexlab Defeat regardless of your settings.

 

I found out the problem seems to be that Sofia often fail to register into Defeat's victim faction, which is why she always getting up and keep fighting and interrupt the assault. 

 

I tested a bit and it seems to be working, but I do not felt like using RegisterForSingleUpdate(1.0) was the best idea, as this make sure the game constantly checking if player and Sofia is in the victim faction. Supposedly it's not a big deal, but I wonder if there are better approach.

 

Scriptname DefeatSofiaScript extends Quest

Faction Property DefeatFaction Auto
ReferenceAlias Property Sofia Auto

Event OnInit()
    RegisterForSingleUpdate(1.0)
EndEvent

Event OnUpdate()
    Actor player = Game.GetPlayer()
    Actor SofiaRef = Sofia.GetActorReference()

    if player.IsInFaction(DefeatFaction)
        if !SofiaRef.IsInFaction(DefeatFaction)
            SofiaRef.AddToFaction(DefeatFaction)
        endif
    endif

    RegisterForSingleUpdate(1.0)
EndEvent

 

 

Sofia Sexlab Defeat Patch.zip

 

[When she hears people still making patch for her]

 

20250611155146_1.jpg.bd09269bc550286a43c068bf398fb360.jpg

 

[When she found out what that patch is]

 

20250611153853_1.jpg.1f59903ce59c63adff02f6c5764dbe5f.jpg

Edited by nightwing100
Posted (edited)
Scriptname DefeatSofiaScript extends Quest

Faction Property DefeatFaction Auto
Actor Property Player Auto
Actor Property Sofia Auto

Event OnCombatStateChanged(Actor akTarget, int combatState)
	If akTarget == Player && combatState == 0 && Player.IsInFaction(DefeatFaction)
		If Sofia.IsInFaction(DefeatFaction) == False
			Sofia.AddToFaction(DefeatFaction)
		EndIf
	EndIf
EndEvent

 

This will wait until the player's combat state is changed. When in Defeat's bleedout, the player's combat state should be 0 and thus allow the rest of the code to trigger.

 

Make the player a persistent Actor property so the script doesn't need to keep fetching the player. You should be able to fill the Player and Sofia actor properties with the appropriate actor selections in the Quest Aliases area. Use "Specific Reference" for each since they are unique, and their reference should therefore never change.

 

Never use "Game.GetPlayer()" - It's a slow method of grabbing the player. I've always found a way to not use it.

 

Also, use this website: ck.uesp.net/wiki

Edited by NymphoElf
Posted

Thanks, sadly this seems only works when player is knockdown and not when player surrender for some reason. I spent a few hours adjusting the script, also tried utility wait 5 seconds just in case the script was fire too early. But it still doesn't works. 

Posted
15 minutes ago, nightwing100 said:

Thanks, sadly this seems only works when player is knockdown and not when player surrender for some reason.

 

See if you can find the surrender function or event in Defeat's scripts and try to capture that function or event in your script.

There's a way to do it. You just need to figure it out.

Posted
19 minutes ago, NymphoElf said:

 

See if you can find the surrender function or event in Defeat's scripts and try to capture that function or event in your script.

There's a way to do it. You just need to figure it out.

 

Alright, I will get back to it when I have more time. For now at least the script works.

 

Thanks again~

  • 2 months later...
Posted

You're so great. I tried several ways to make sofia can be defeat correctly,which caused more annoying bugs.This is really helpful. Hope you'll get much more success

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