Jump to content

SexLab.HookActors - Are these somehow different from Game.GetPlayer?


Fredas

Recommended Posts

Posted

I finally bit the bullet and added MCM to my mod.  Then went ahead and threw in code to affect NPCs.  That's when I encountered the first barrier I probably will not be able to hurdle without help.

 

In a nutshell, I'm making use of NiOverride's various functions, and said functions require an ObjectReference.  These functions are perfectly happy with Game.GetPlayer().  However, they do not like the actor variables returned by SexLab.HookActors.  I do not grasp the difference, but evidently it is important.  If the variables returned by SexLab.HookActors need to be cast to something else before they equate the same kind of ObjectReference as what Game.GetPlayer returns, then that's the info I need.

 

Thanks in advance.

 

Posted

I finally bit the bullet and added MCM to my mod.  Then went ahead and threw in code to affect NPCs.  That's when I encountered the first barrier I probably will not be able to hurdle without help.

 

In a nutshell, I'm making use of NiOverride's various functions, and said functions require an ObjectReference.  These functions are perfectly happy with Game.GetPlayer().  However, they do not like the actor variables returned by SexLab.HookActors.  I do not grasp the difference, but evidently it is important.  If the variables returned by SexLab.HookActors need to be cast to something else before they equate the same kind of ObjectReference as what Game.GetPlayer returns, then that's the info I need.

 

Thanks in advance.

 

Without seeing a script example I'm not sure what your trying to use as an object ref

if it's an alias you can have something like this ====              MyAlias.GetActorRef()  or really anything that is an actor as long as your properties are set correctly

                                         

SexLab seems to understand its an actor using that method and it's quick way to get it done.

 

or something like this might work======== ActorBase MyActor = MyActorRef.GetActorRef().GetBaseObject() as ActorBase

Posted

I'll toss in a truncated bit of code to see if it helps better than my explanation.

 

 

 

event SexLabsAnimationStart(String _eventName, String _args, Float _argc, Form _sender)
   Actor[] actorList = SexLab.HookActors(_args)
   int actorCount = actorList.Length
   int ActorCounting = 0
   actor person
   while ActorCounting < actorCount
      person = actorList[ActorCounting]
      if person != game.getplayer()
         NiOverride.AddNodeOverrideString(person, true, "Face [Ovl0]", 9, 0, "blargh.dds", true)
         ; *** (this does absolutely nothing) ***
      endif
      ActorCounting += 1
   endwhile
   NiOverride.AddNodeOverrideString(game.getplayer(), true, "Face [Ovl0]", 9, 0, "blargh.dds", true)
   ; *** (this works perfectly fine, illustrating that there is some important difference) ***
endevent

 

 

 

And many thanks for taking the time to help out.

 

Posted

I don't know looks like you have a loop going for anyone but the player then when it the loop ends it does something with the player.

 

I'm guessing nothing valid is being selected in the loop and then it's finishing with the player when it can't find anything if I understand the script correctly.

 

I don't really have any ideas if whatever your have in the actorlist is valid. I've never had to use  hook.actors() for anything so I'm not really familiar with how to set it up. I'm sure Ashal or somebody more familiar with that part of the framework will pop on at some point and help.

 

edit;

 

int actorcounting = 0

 

while ActorCounting < actorCount       how can the actorCount ever be less than 0?

Posted

I don't know looks like you have a loop going for anyone but the player then when it the loop ends it does something with the player.

 

The code I pasted is just a quick thing I typed up to illustrate what I'm doing, how I'm doing it, and where things don't seem to be working as intended.  Pay the logical inconsistencies no mind. ;p

 

I'm guessing nothing valid is being selected in the loop and then it's finishing with the player when it can't find anything if I understand the script correctly.

 

In this case what is happening is it's finding a non-player actor successfully.  I can even "ping" the result with person.GetLeveledActorBase().GetRace().GetName() and have it return "NordRace", so that settles that.  It definitely executes the NiOverride function, as made adequately manifest by an entire day's worth of debug.notification tests.  It's just not working.  And my best guess is that NiOverride does not like something about SexLab.HookActors' actor variable.

 
I'm sure Ashal or somebody more familiar with that part of the framework will pop on at some point and help.

 

I definitely, sincerely hope so.  The whole script is literally wasted effort until this is tackled.

Posted

Game.GetPlayer() returns a single actor

 

SexLab.HookActors() returns an array of actors. You can't use a function on an array.

Posted

Game.GetPlayer() returns a single actor

 

SexLab.HookActors() returns an array of actors. You can't use a function on an array.

 

Yes, I gather that.  The code snippet above should reveal that I am not making that particular mistake.  Everything I do that's related to treating SexLab.HookActors' output as actors works, except for NiOverride.

Posted

 

Game.GetPlayer() returns a single actor

 

SexLab.HookActors() returns an array of actors. You can't use a function on an array.

 

Yes, I gather that.  The code snippet above should reveal that I am not making that particular mistake.  Everything I do that's related to treating SexLab.HookActors' output as actors works, except for NiOverride.

 

 

Post your actual script your using and somebody might be able to help you.

Posted

Post your actual script your using and somebody might be able to help you.

 

Fair enough.  In the interest of troubleshooting this, I've condensed my script down to just the functions which highlight the problem.

 

 

 

ScriptName BScriptNPC extends Quest
 
SexLabFramework property SexLab auto
 
Event OnInit()
   Utility.Wait(0.5)
   UnregisterForAllModEvents()
   RegisterForModEvent("AnimationStart", "SexLabsAnimationStart")
endevent
 
event SexLabsAnimationStart(String _eventName, String _args, Float _argc, Form _sender)
   Actor[] actorList = SexLab.HookActors(_args)
   actor person
   person = actorList[0]
 
   utility.wait(5.0)
   debug.notification("SexLab.HookActors actor #0 is " + person.GetLeveledActorBase().GetRace().GetName())
   ; *** (This gives the result, "Nord - Nel".)
 
   debug.notification("SexLab.HookActors actor #0 is " + person.GetLeveledActorBase().GetSex())
   ; *** (This assures that it's female.)
 
   utility.wait(10.0)
   NiOverride.AddNodeOverrideFloat(person, true, "Face [Ovl0]", 8, 0, 1.0, true)
   NiOverride.AddNodeOverrideString(person, true, "Face [Ovl0]", 9, 0, "blargh.dds", true)
   ; *** (The above gives no visual result on the target actor, who is the only actor available besides the player.)
 
   utility.wait(10.0)
   debug.notification("NelOverrideA is " + NiOverride.GetNodeOverrideFloat(person, true, "Face [Ovl0]", 8, 0))
   ; *** (This returns "NelOverrideA is 1.000000".)
 
   debug.notification("NelOverrideB is " + NiOverride.GetNodeOverrideString(person, true, "Face [Ovl0]", 9, 0))
   ; *** (This returns "NelOverride B is blargh.dds".)
   
   utility.wait(10.0)
   NiOverride.AddNodeOverrideFloat(Game.GetPlayer(), true, "Face [Ovl0]", 8, 0, 1.0, true)
   NiOverride.AddNodeOverrideString(Game.GetPlayer(), true, "Face [Ovl0]", 9, 0, "blargh.dds", true)
   ; *** (The above, meanwhile, gives the intended result on the player, like always.)
 
   utility.wait(10.0)
   debug.notification("PlayerOverrideA is " + NiOverride.GetNodeOverrideFloat(Game.GetPlayer(), true, "Face [Ovl0]", 8, 0))
   ; *** (This returns "PlayerOverrideA is 1.000000".)
 
   debug.notification("PlayerOverrideB is " + NiOverride.GetNodeOverrideString(Game.Getplayer(), true, "Face [Ovl0]", 9, 0))
   ; *** (This returns "PlayerOverrideB is blargh.dds".)
 
endevent

 

 

 

 

2nd parameter, isFemale

Are all the actors females?

 

They are, yes.  The test NPC in this case is the "Nel" follower that was recently made available here.

 
Posted

I'd try something like this

debug.trace(person)
debug.trace(NiOverride.HasOverlays(person))
If !NiOverride.HasOverlays(person)
  NiOverride.AddOverlays(person)
EndIf
debug.trace(NiOverride.HasOverlays(person))
Your "Face [Ovl0]" looks like an overlay thingy. From Nioverride.psc:

; Adds all enabled overlays to an Actor (Cannot add to player, always exists for player)
Function AddOverlays(ObjectReference ref) native global
Posted

I'd try something like this

Your "Face [Ovl0]" looks like an overlay thingy. From Nioverride.psc:

; Adds all enabled overlays to an Actor (Cannot add to player, always exists for player)
Function AddOverlays(ObjectReference ref) native global

 

I'm about 99% sure this is the ingredient I was missing.  Man, what a relief.

 

Edit: Spoke too soon.  Although I definitely needed that function, it doesn't seem to be making a difference.  But it does at least give me more room to troubleshoot.

 

Edit: For the curious, the problem is apparently a bug with the script extender, which has been privately fixed but remains in the latest public release.

 

Archived

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

  • Recently Browsing   0 members

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