Jump to content

[SexLab Scripts] Check for available Animations, how???


Nymra

Recommended Posts

Posted

Hey,

 

after hours of trying to understand this part of the code I gave up for now...

 

The following Code is supposed to check for available Animations for 5P, 4P, 3P, 2P events and report back.

It should also lower the amount of participants in case there is for example no 5P animations for 4 Falmers + 1 Human. 

 

I have no idea how the "Animations1, Animations2, etc. work. Staring at the sexlab code is still like reading chinese for me. 
I also dont understand what kind of value "Animations1.Length" is supposed to return. 
In my logs its sometimes: "0", then "12" I think one time it was 128...

I did expand another ones code, so I never understood this sadly. 
If anybody can point me how to fix this? 

I thought this line:

 

Animations2 = SexLab.AnimSlots.PickByActors(SexLab.MakeActorArray(cfgqst.PlayerRef, Aggressors[0], Aggressors[1]), Aggressive=true)

 

I understand this somehow says "ok, here is Animations2 condition and it is now filled with 3 Actors that are placed in their respective slots (Victim, aggressor, agressso)

But why is then this code after it?

    if (AggressorCount == 2) && !Animations2.Length
        AggressorCount = 1
        Aggressors[1] = None
    endif

I thought this checks for animations available and reduces the actor count if no 3P anims for "Falmer/Falmer/Human" is found?! 

 

Thx alot... 
Complete source code is in attachments. 

Its for my Naked Defeat mod which wants to support 5P anims... all the hassle for like a dozen anims in the game ^^
But well, 4P and 3P also need sorting. And I wanna learn how this all works.

 


	if AggressorCount > 0 
	    if AggressorCount == 4            ;4 = 5P ANIMS 
			Animations4 = SexLab.AnimSlots.PickByActors(SexLab.MakeActorArray(cfgqst.PlayerRef, Aggressors[0], Aggressors[1], Aggressors[2], Aggressors[3]), Aggressive=true)
			if cfgqst.ShowDebugMessages
            Debug.Trace("NAKED DEFEAT: 5-person animations found: "+Animations4.Length)
		;	Debug.Notification("NAKED DEFEAT: 5-person animations found: "+Animations4.Length)
			endif
		endif
		if AggressorCount == 3            ;3 = 4P ANIMS 
			Animations3 = SexLab.AnimSlots.PickByActors(SexLab.MakeActorArray(cfgqst.PlayerRef, Aggressors[0], Aggressors[1], Aggressors[2]), Aggressive=true)
			if cfgqst.ShowDebugMessages
            Debug.Trace("NAKED DEFEAT: 4-person animations found: "+Animations3.Length)
		;	Debug.Notification("NAKED DEFEAT: 4-person animations found: "+Animations3.Length)
			endif
		endif
		if AggressorCount == 2            ;2 = 3P ANIMS 
			Animations2 = SexLab.AnimSlots.PickByActors(SexLab.MakeActorArray(cfgqst.PlayerRef, Aggressors[0], Aggressors[1]), Aggressive=true)
			if cfgqst.ShowDebugMessages
            Debug.Trace("NAKED DEFEAT: 3-person animations found: "+Animations2.Length)
			Debug.Notification("NAKED DEFEAT: 3-person animations found: "+Animations2.Length)
			endif
		endif
		if AggressorCount == 1            ;1 = 2P ANIMS 
			Animations1 = SexLab.AnimSlots.PickByActors(SexLab.MakeActorArray(cfgqst.PlayerRef, Aggressors[0]), Aggressive=true)
			if cfgqst.ShowDebugMessages
            Debug.Trace("NAKED DEFEAT: 2-person animations found: "+Animations1.Length)
		;	Debug.Notification("NAKED DEFEAT: 2-person animations found: "+Animations1.Length)
			endif
		endif
	endif

;-------------------------------------------------------------------------------------------------------------------------------------	
	; STAGE 5: Make Sex Array based on Actors 
	

	if AggressorCount == 4
		if !Animations4.Length			;5P if 4 Aggressors and no 5P anims -> reduce Aggressors to 3
		AggressorCount = 3
		Aggressors[3] = None
		endif
	endif
	if AggressorCount == 3
		if !Animations3.Length			;4P if 3 Aggressors and no 4P anims -> reduce Aggressors to 2		
		AggressorCount = 2
		Aggressors[2] = None
		endif
	endif
	if AggressorCount == 2
		if !Animations2.Length			;3P if 2 Aggressors and no 3P anims -> reduce Aggressors to 1
		AggressorCount = 1
		Aggressors[1] = None
		endif
	endif
	if AggressorCount == 1
		if !Animations1.Length		;2P if 1 Aggressors and no 2P anims -> reduce Aggressors to 0
		AggressorCount = 0
		Aggressors[0] = None
		endif
	endif

 

nade_calmquest_qf_scr.psc

Posted
3 hours ago, Nymra said:

I also dont understand what kind of value "Animations1.Length" is supposed to return.

Animations is an array, so Length should return the amount of elements in it.

 

3 hours ago, Nymra said:

SexLab.AnimSlots.PickByActors(SexLab.MakeActorArray(cfgqst.PlayerRef, Aggressors[0], Aggressors[1]), Aggressive=true)

This returns an array of all available animations for the given actors. So Length is the amount of available animations.

 

3 hours ago, Nymra said:

if (AggressorCount == 2) && !Animations2.Length
        AggressorCount = 1
        Aggressors[1] = None
    endif

This checks if the array is empty (no animations available) and if so reduces the aggressor count by 1, to search for animations for one less actor.

 

3 hours ago, Nymra said:

I thought this checks for animations available and reduces the actor count if no 3P anims for "Falmer/Falmer/Human" is found?!

It sort of does, there is just an issue with it. In stage 4 you only reload the animation list for your current aggressor count. Then in stage 5 if your list is empty you reduce the count by 1. But you never reloaded the animation list for the new aggressor count, so it's still on whatever value it was set to the last time you started a scene for that aggressor count.

 

Lets for example assume your aggressor count is 3.

4 hours ago, Nymra said:

if AggressorCount == 3            ;3 = 4P ANIMS
            Animations3 = SexLab.AnimSlots.PickByActors(SexLab.MakeActorArray(cfgqst.PlayerRef, Aggressors[0], Aggressors[1], Aggressors[2]), Aggressive=true)
            if cfgqst.ShowDebugMessages
            Debug.Trace("NAKED DEFEAT: 4-person animations found: "+Animations3.Length)
        ;    Debug.Notification("NAKED DEFEAT: 4-person animations found: "+Animations3.Length)
            endif
        endif

This part is then executed.

 

4 hours ago, Nymra said:

if AggressorCount == 2            ;2 = 3P ANIMS
            Animations2 = SexLab.AnimSlots.PickByActors(SexLab.MakeActorArray(cfgqst.PlayerRef, Aggressors[0], Aggressors[1]), Aggressive=true)
            if cfgqst.ShowDebugMessages
            Debug.Trace("NAKED DEFEAT: 3-person animations found: "+Animations2.Length)
            Debug.Notification("NAKED DEFEAT: 3-person animations found: "+Animations2.Length)
            endif
        endif

This part however is not, as AggressorCount is 3, not 2.

 

4 hours ago, Nymra said:

if AggressorCount == 3
        if !Animations3.Length            ;4P if 3 Aggressors and no 4P anims -> reduce Aggressors to 2        
        AggressorCount = 2
        Aggressors[2] = None
        endif
    endif

Then if Animations3 is empty you set AggressorCount to 2. Which means you're now referring to Animations2, but the part that loads the available animations into that property was not executed. So what value does it currently have?

 

 

What I would do here is:
If AggressorCount is 4: Load animations for 5 actors.
If Array is empty: Set AggressorCount to 3.
If AggressorCount is 3: Load animations for 4 actors.
If Array is empty: Set AggressorCount to 2.
If AggressorCount is 2: Load animations for 3 actors.
If Array is empty: Set AggressorCount to 1.
If AggressorCount is 1: Load animations for 2 actors.
If Array is empty: Set AggressorCount to 0.

So basically alternate between the steps of stage 4 and 5.

Posted
7 hours ago, Skitskurr said:

Animations is an array, so Length should return the amount of elements in it.

 

This returns an array of all available animations for the given actors. So Length is the amount of available animations.

 

This checks if the array is empty (no animations available) and if so reduces the aggressor count by 1, to search for animations for one less actor.

 

It sort of does, there is just an issue with it. In stage 4 you only reload the animation list for your current aggressor count. Then in stage 5 if your list is empty you reduce the count by 1. But you never reloaded the animation list for the new aggressor count, so it's still on whatever value it was set to the last time you started a scene for that aggressor count.

 

Lets for example assume your aggressor count is 3.

This part is then executed.

 

This part however is not, as AggressorCount is 3, not 2.

 

Then if Animations3 is empty you set AggressorCount to 2. Which means you're now referring to Animations2, but the part that loads the available animations into that property was not executed. So what value does it currently have?

 

 

What I would do here is:
If AggressorCount is 4: Load animations for 5 actors.
If Array is empty: Set AggressorCount to 3.
If AggressorCount is 3: Load animations for 4 actors.
If Array is empty: Set AggressorCount to 2.
If AggressorCount is 2: Load animations for 3 actors.
If Array is empty: Set AggressorCount to 1.
If AggressorCount is 1: Load animations for 2 actors.
If Array is empty: Set AggressorCount to 0.

So basically alternate between the steps of stage 4 and 5.

 

 

ok nice. I see. 

I now changed the code in (hopefully) correct way (99% correct does not work as I noticed lol :D)
 

BUT: 
I feel like Sexlab is only checking the actor count in general (5 Actors -> search for 5P) instead of 
4 falmers 1 human , search for falmer 5P.

Because if aggressors are 4 and all falmers the thread still fails


From Papyurs LOG: 


[04/06/2021 - 04:28:43PM] SEXLAB - PickByActors(Positions=[[Actor < (00000014)>], [HentaiCreaturesActor < (FF000CB1)>], [HentaiCreaturesActor < (FF001902)>], [HentaiCreaturesActor < (FF001929)>], [HentaiCreaturesActor < (FF001927)>]], Limit=64, Aggressive=TRUE)
[04/06/2021 - 04:28:43PM] SEXLAB - GetByDefault(Males=0, Females=1, IsAggressive=TRUE, UsingBed=False, RestrictAggressive=TRUE)
[04/06/2021 - 04:28:43PM] SEXLAB - AnimCache: HIT[6] -- 0:1:TRUE:False:TRUE:TRUE -- Count[12]
[04/06/2021 - 04:28:43PM] NAKED DEFEAT: 5-person animations found: 12

 

I now wonder if I can somehow change the command to check for race instead, but I think then this all will take even longer as it already does :(

 

	if AggressorCount == 4            ;5P  
		Animations4 = SexLab.AnimSlots.PickByActors(SexLab.MakeActorArray(cfgqst.PlayerRef, Aggressors[0], Aggressors[1], Aggressors[2], Aggressors[3]), Aggressive=true)
		if cfgqst.ShowDebugMessages
		Debug.Trace("NAKED DEFEAT: 5-person animations found: "+Animations4.Length)
		Debug.Notification("NAKED DEFEAT: 5-person animations found: "+Animations4.Length)
		endif
		if Animations4.Length < 1			;5P if 4 Aggressors and no 5P anims -> reduce Aggressors to 3
		AggressorCount = 3
		Aggressors[3] = None
		endif
	endif
	if AggressorCount == 3           ;4p
		Animations3 = SexLab.AnimSlots.PickByActors(SexLab.MakeActorArray(cfgqst.PlayerRef, Aggressors[0], Aggressors[1], Aggressors[2]), Aggressive=true)
		if cfgqst.ShowDebugMessages
		Debug.Trace("NAKED DEFEAT: 4-person animations found: "+Animations3.Length)
		Debug.Notification("NAKED DEFEAT: 4-person animations found: "+Animations3.Length)
		endif
		if Animations3.Length < 1				
		AggressorCount = 2
		Aggressors[2] = None
		endif
	endif
	if AggressorCount == 2            ;3P
		Animations2 = SexLab.AnimSlots.PickByActors(SexLab.MakeActorArray(cfgqst.PlayerRef, Aggressors[0], Aggressors[1]), Aggressive=true)
		if cfgqst.ShowDebugMessages
		Debug.Trace("NAKED DEFEAT: 3-person animations found: "+Animations2.Length)
		Debug.Notification("NAKED DEFEAT: 3-person animations found: "+Animations2.Length)
		endif
		if Animations2.Length  < 1			;3P if 2 Aggressors and no 3P anims -> reduce Aggressors to 1
		AggressorCount = 1
		Aggressors[1] = None
		endif
	endif
	if AggressorCount == 1             ;2P 
		Animations1 = SexLab.AnimSlots.PickByActors(SexLab.MakeActorArray(cfgqst.PlayerRef, Aggressors[0]), Aggressive=true)
		if Animations1.Length  < 1		;2P if 1 Aggressors and no 2P anims -> reduce Aggressors to 0
		AggressorCount = 0
		Aggressors[0] = None
		endif
	endif

 

Posted

I skipped a bit through SexLabs documentation and I think AnimSlots are only for humans. There is a function in SexLabFramework called GetCreatureAnimationsByRace(int ActorCount, Race RaceRef). In fact there are many of GetCreatureAnimation functions for different needs in SexLab, you might want to see for yourself which one you want to use.

Posted
6 minutes ago, Skitskurr said:

I skipped a bit through SexLabs documentation and I think AnimSlots are only for humans. There is a function in SexLabFramework called GetCreatureAnimationsByRace(int ActorCount, Race RaceRef). In fact there are many of GetCreatureAnimation functions for different needs in SexLab, you might want to see for yourself which one you want to use.

 

thx for pointing this out. I sometimes get lost when I try to find stuff :D

Think it would be possible to check if human group or creaturegroup easily and then I can make these different checks, hmm. thx alot! 

Archived

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

  • Recently Browsing   0 members

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