Jump to content

Calling actors in CK


Recommended Posts

Hello. So I am making my first mod which will include the player talking to Serana and being able to recieve a handjob. For now I am just trying to initiate a random sex scene, but I am having problems actually calling Serana from inside the script. (Simply don't know how) Here is what i've got:

 

 

 

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 2
Scriptname MADESeranaHJScript Extends TopicInfo Hidden


;BEGIN FRAGMENT Fragment_1
Function Fragment_1(ObjectReference akSpeakerRef)
Actor akSpeaker = akSpeakerRef as Actor
;BEGIN CODE
;Handjob
;END CODE
EndFunction
;END FRAGMENT


;END FRAGMENT CODE - Do not edit anything between this and the begin comment


SexLabFramework Property SexLab  Auto  


function BeginHandjob()


    ; // Create our actor array using our chosen actor references
    actor[] sexActors = new actor[2]
    sexActors[0] = GetDialogueTarget()
    sexActors[1] = Game.GetPlayer()


    ; // Initialize our animation array as empty, so SexLab will pick the animations based on defaults
    sslBaseAnimation[] anims


    ; // "Buisness Time"
    SexLab.StartSex(sexActors, anims)


endFunction

 

 

 

And this is the error I am recieving:

 

 

 

Starting 1 compile threads for 1 files...
Compiling "MADESeranaHJScript"...
C:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\MADESeranaHJScript.psc(22,19): GetDialogueTarget is not a function or does not exist
No output generated for MADESeranaHJScript, compilation failed.

 

 

 

Link to comment

1. Would you kindly stop bumping your thread so often? Someone will eventually notice it.

 

2. The problem seems to be your use of GetDialogueTarget(). First, you need to run it on an actor [like so: an_Actor.GetDialogueTarget()], and it will return the actor an_Actor is in dialogue with, except when an_Actor is the player, in which case it will return none. Second, it's not the most appropriate method to get Serana here. I haven't tampered with dialogue fragments, so I may be wrong, but from the looks of it, it already provides you with the actor the Topic Info is attached to:

Actor akSpeaker = akSpeakerRef as Actor

So I'd suggest trying the following:

sexActors[0] = akSpeaker

Let me know if I'm correct.

 

Link to comment

1. Would you kindly stop bumping your thread so often? Someone will eventually notice it.

 

2. The problem seems to be your use of GetDialogueTarget(). First, you need to run it on an actor [like so: an_Actor.GetDialogueTarget()], and it will return the actor an_Actor is in dialogue with, except when an_Actor is the player, in which case it will return none. Second, it's not the most appropriate method to get Serana here. I haven't tampered with dialogue fragments, so I may be wrong, but from the looks of it, it already provides you with the actor the Topic Info is attached to:

Actor akSpeaker = akSpeakerRef as Actor

So I'd suggest trying the following:

sexActors[0] = akSpeaker

Let me know if I'm correct.

 

Sorry about the bumping and thank you for your reply. I tried compiling the code you provided but it gave me a another error:

 

Error:

 

 

 

C:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\MADESeranaHJScript.psc(20,22): variable akSpeakerRef is undefined
C:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\MADESeranaHJScript.psc(20,35): cannot cast a none to a actor, types are incompatible

 

 

 

Current Code:

 

 

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 2
Scriptname MADESeranaHJScript Extends TopicInfo Hidden

;BEGIN FRAGMENT Fragment_1
Function Fragment_1(ObjectReference akSpeakerRef)
Actor akSpeaker = akSpeakerRef as Actor
;BEGIN CODE
;Handjob
;END CODE
EndFunction
;END FRAGMENT

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

SexLabFramework Property SexLab  Auto  

function BeginHandjob()
    
    Actor akSpeaker = akSpeakerRef as Actor

    ; // Create our actor array using our chosen actor references
    actor[] sexActors = new actor[2]
    sexActors[0] = akSpeaker 
    sexActors[1] = SexLab.PlayerRef 

    ; // Initialize our animation array as empty, so SexLab will pick the animations based on defaults
    sslBaseAnimation[] anims

    ; // "Buisness Time"
    SexLab.StartSex(sexActors, anims)

endFunction

 

 

Link to comment

Do not include

Actor akSpeaker = akSpeakerRef as Actor

in your own function. Doing so overrides the variables passed by Fragment_1: Fragment_1's akSpeaker and akSpeakerRef, which point to the actor the Topic Info is attached to and its ingame instance respectively, are replaced with the ones you declare in BeginHandjob(). Since akSpeakerRef hasn't even been defined in your function (you haven't let the compiler know you were going to need an ObjectReference named akSpeakerRef), it is treated as a none, which in turn means that akSpeaker becomes a none in your function, not an actor.

 

So simply delete that line in BeginHandjob() and it should work.

Link to comment

Do not include

Actor akSpeaker = akSpeakerRef as Actor

in your own function. Doing so overrides the variables passed by Fragment_1: Fragment_1's akSpeaker and akSpeakerRef, which point to the actor the Topic Info is attached to and its ingame instance respectively, are replaced with the ones you declare in BeginHandjob(). Since akSpeakerRef hasn't even been defined in your function (you haven't let the compiler know you were going to need an ObjectReference named akSpeakerRef), it is treated as a none, which in turn means that akSpeaker becomes a none in your function, not an actor.

 

So simply delete that line in BeginHandjob() and it should work.

 

Okay. So I deleted the misunderstood line. But still. Error.

 

Error:

 

 

 

C:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\TIF__0400CE2D.psc(22,19): variable akSpeaker is undefined

 

 

 

Current code:

 

 

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 1
Scriptname TIF__0400CE2D Extends TopicInfo Hidden

;BEGIN FRAGMENT Fragment_0
Function Fragment_0(ObjectReference akSpeakerRef)
Actor akSpeaker = akSpeakerRef as Actor
;BEGIN CODE
;he
;END CODE
EndFunction
;END FRAGMENT

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

SexLabFramework Property SexLab  Auto 

function BeginHandjob()

    ; // Create our actor array using our chosen actor references
    actor[] sexActors = new actor[2]
    sexActors[0] = akSpeaker 
    sexActors[1] = SexLab.PlayerRef 

    ; // Initialize our animation array as empty, so SexLab will pick the animations based on defaults
    sslBaseAnimation[] anims

    ; // "Buisness Time"
    SexLab.StartSex(sexActors, anims)

endFunction

 

 

Link to comment

Getting there. You've got two choices now:

 

1.Either you add Actor akSpeaker as a parameter for your function [Function BeginHandjob(Actor akSpeaker)......EndFunction] and your function will recognize akSpeaker within its own block (bearing in mind that BeginHandJob's akSpeaker and Fragment_1's akSpeaker are different variables, so you'll need to make sure the actor parameter you give BeginHandjob when you call it in the fragment is Fragment_1's akSpeaker). Your code then becomes:

 

 

SexLabFramework Property SexLab Auto

BeginHandjob(akSpeaker)

Function BeginHandjob(Actor akSpeaker)
[etc.]

 

 

2.Or you delete the "Function" and "EndFunction" lines.

 

Having a function in a fragment is only worth it if it is a function you use often in the same fragment, or in other scripts or in other script fragments (and in that case it is more practical to store it in another script, not in a script fragment). That's exactly what you're doing when you declare the SexLabFramework (SexLabFramework Property SexLab Auto) and use its StartSex() function (SexLab.StartSex(.....)).

Link to comment

Getting there. You've got two choices now:

 

1.Either you add Actor akSpeaker as a parameter for your function [Function BeginHandjob(Actor akSpeaker)......EndFunction] and your function will recognize akSpeaker within its own block (bearing in mind that BeginHandJob's akSpeaker and Fragment_1's akSpeaker are different variables, so you'll need to make sure the actor parameter you give BeginHandjob when you call it in the fragment is Fragment_1's akSpeaker). Your code then becomes:

 

 

SexLabFramework Property SexLab Auto

BeginHandjob(akSpeaker)

Function BeginHandjob(Actor akSpeaker)
[etc.]

 

 

2.Or you delete the "Function" and "EndFunction" lines.

 

Having a function in a fragment is only worth it if it is a function you use often in the same fragment, or in other scripts or in other script fragments (and in that case it is more practical to store it in another script, not in a script fragment). That's exactly what you're doing when you declare the SexLabFramework (SexLabFramework Property SexLab Auto) and use its StartSex() function (SexLab.StartSex(.....)).

 

Alright. I did as you suggested. I deleted the function lines and Also tried the other method. Both gave back errors. I really appricate you helping me through this, just to let you know. This is the error I am now getting without the Function:

 

Error:

 

 

C:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\TIF__0400CE2D.psc(19,24): no viable alternative at input 'new'
C:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\TIF__0400CE2D.psc(19,33): required (...)+ loop did not match anything at input '['
C:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\TIF__0400CE2D.psc(19,12): Unknown user flag actor
C:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\TIF__0400CE2D.psc(27,9): no viable alternative at input '.'

 

 

Current code:

 

 

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 1
Scriptname TIF__0400CE2D Extends TopicInfo Hidden

;BEGIN FRAGMENT Fragment_0
Function Fragment_0(ObjectReference akSpeakerRef)
Actor akSpeaker = akSpeakerRef as Actor
;BEGIN CODE
;he
;END CODE
EndFunction
;END FRAGMENT

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

SexLabFramework Property SexLab  Auto 

    ; // Create our actor array using our chosen actor references
    actor[] sexActors = new actor[2]
    sexActors[0] = akSpeaker 
    sexActors[1] = SexLab.PlayerRef 

    ; // Initialize our animation array as empty, so SexLab will pick the animations based on defaults
    sslBaseAnimation[] anims

    ; // "Buisness Time"
   SexLab.StartSex(sexActors, anims)

 

 

Link to comment

It looks like there's a character the compiler doesn't like in the line "SexLabFramework Property SexLab Auto". What did you type to separate "SexLab" from "Auto"? Space or Tab?

 

My educated guess is: the compiler doesn't see the "Auto" flag as a separate word from "SexLab" and so treats the next word that isn't part of a comment, "actor", as a flag [(19,12): Unknown user flag actor], which throws everything out of whack. sexActors is not considered as an actor array, so the newly created actor array can't be assigned to anything [no viable alternative at input 'new'], even more so when "actor[]" is not considered as an actor array at all, but as as flag (required (...)+ loop did not match anything at input '['). And as the compiler doesn't see "SexLab" but "SexLabsomethingelse", it doesn't know what to do about "SexLab.StartSex" in the final line (no viable alternative at input '.')

 

So my tentative troubleshooting advice would be to re-type the SexLabFramework declaration - and pray that a better modder than me swoops in with the solution because I'm grasping at straws here ;).

Link to comment

It looks like there's a character the compiler doesn't like in the line "SexLabFramework Property SexLab Auto". What did you type to separate "SexLab" from "Auto"? Space or Tab?

 

My educated guess is: the compiler doesn't see the "Auto" flag as a separate word from "SexLab" and so treats the next word that isn't part of a comment, "actor", as a flag [(19,12): Unknown user flag actor], which throws everything out of whack. sexActors is not considered as an actor array, so the newly created actor array can't be assigned to anything [no viable alternative at input 'new'], even more so when "actor[]" is not considered as an actor array at all, but as as flag (required (...)+ loop did not match anything at input '['). And as the compiler doesn't see "SexLab" but "SexLabsomethingelse", it doesn't know what to do about "SexLab.StartSex" in the final line (no viable alternative at input '.')

 

So my tentative troubleshooting advice would be to re-type the SexLabFramework declaration - and pray that a better modder than me swoops in with the solution because I'm grasping at straws here ;).

 

This unfortunatelly did not solve the error. BUT I figured out what did ;) I accidentally placed the script itself under the part where you insert the fragment. I fixed the error simply by moving the code. So now it compiles. But ingame no sex appears when the code is ran.

 

Current code:

 

 

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 1
Scriptname TIF__0400CE2D Extends TopicInfo Hidden

;BEGIN FRAGMENT Fragment_0
Function Fragment_0(ObjectReference akSpeakerRef)
Actor akSpeaker = akSpeakerRef as Actor
;BEGIN CODE

; Create our actor array using our chosen actor references 
actor[] sexActors = new actor[2]
sexActors[0] = akSpeaker 
sexActors[1] = SexLab.PlayerRef 

; Initialize our animation array as empty, so SexLab will pick the animations based on defaults
sslBaseAnimation[] anims

; "Buisness Time"
SexLab.StartSex(sexActors, anims)

;END CODE
EndFunction
;END FRAGMENT

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

SexLabFramework Property SexLab Auto 

 

 

Link to comment

as far as I'm aware there's no need to define akSpeaker at all, it's a topic info fragment so it's already defined automatically. Same goes for akSpeakerRef

 

So I should delete the line?:

Actor akSpeaker = akSpeakerRef as Actor

I got an akSpeaker is undefined error when doing so. Instead of akSpeaker. Would it be possible to tell the script that it should be Serana in perticular? 

Link to comment

It should be if you declare an actor property in your script that you have point to Serana when you define properties in the property window of the script. You would then directly assign that property to sexActors[0]. For instance

Actor Property Serana Auto    ;if you replace Serana with DLC1Serana, the CK will even be able to autofill
;snip
sexActors[0] = Serana

Serana will be from now on hardcoded to give the player a handjob whenever that line of dialogue is selected, even if you attach it to another NPC.

Link to comment

It should be if you declare an actor property in your script that you have point to Serana when you define properties in the property window of the script. You would then directly assign that property to sexActors[0]. For instance

Actor Property Serana Auto    ;if you replace Serana with DLC1Serana, the CK will even be able to autofill
;snip
sexActors[0] = Serana

Serana will be from now on hardcoded to give the player a handjob whenever that line of dialogue is selected, even if you attach it to another NPC.

 

Okay so I tried this. It compiled without errors. But still no sex starts ingame. This the the entire code:

 

Current code:

 

 

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 1
Scriptname TIF__0400CE2D Extends TopicInfo Hidden

;BEGIN FRAGMENT Fragment_0
Function Fragment_0(ObjectReference akSpeakerRef)
Actor akSpeaker = akSpeakerRef as Actor
;BEGIN CODE
; Create our actor array using our chosen actor references 
actor[] sexActors = new actor[2]
sexActors[0] = DLC1Serana
sexActors[1] = Game.GetPlayer()

; Initialize our animation array as empty, so SexLab will pick the animations based on defaults
sslBaseAnimation[] anims

; "Buisness Time"
SexLab.StartSex(sexActors, anims)
;END CODE
EndFunction
;END FRAGMENT

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

SexLabFramework Property SexLab Auto
Actor Property DLC1Serana Auto

 

 

Link to comment

The code is sound, and it matches the SexLab-related Topic Info fragments I've seen, so i don't think the script itself is the problem. Probably something on the CK's or your install's end. Let's see if it's your install first: can other SexLab plugins start animations? If that's the case, then you've probably missed a few steps in the CK. If not, you need to troubleshoot SexLab first.

Link to comment

The code is sound, and it matches the SexLab-related Topic Info fragments I've seen, so i don't think the script itself is the problem. Probably something on the CK's or your install's end. Let's see if it's your install first: can other SexLab plugins start animations? If that's the case, then you've probably missed a few steps in the CK. If not, you need to troubleshoot SexLab first.

 

Other SexLab plugins works fine. Not sure what steps in the ck you are referring to. Could you go a bit more in depth with that?

Link to comment

Exactly like so. Next (this might have no bearing on the problem whatsoever, since your dialogue works, but it's good practice anyway to avoid the dialogue bug): is your custom quest a start game enabled quest? If so, did you generate a SEQ file (using TESVEdit for instance)?

 

These are all the CK hiccups I can think of, sorry, but I can suggest a final test: does Matchmaker work with Serana in your game? Some players have reported that she doesn't respond to custom scripts well, like other heavily scripted companions, so that might be the root of it all. I can't speak from experience as I haven't even met Serana in my SexLab playthrough.

Link to comment

Exactly like so. Next (this might have no bearing on the problem whatsoever, since your dialogue works, but it's good practice anyway to avoid the dialogue bug): is your custom quest a start game enabled quest? If so, did you generate a SEQ file (using TESVEdit for instance)?

 

These are all the CK hiccups I can think of, sorry, but I can suggest a final test: does Matchmaker work with Serana in your game? Some players have reported that she doesn't respond to custom scripts well, like other heavily scripted companions, so that might be the root of it all. I can't speak from experience as I haven't even met Serana in my SexLab playthrough.

 

I have generated the SEQ file and Serana does work with matchmaker. I might try using another npc just to test it out. I will report back when I have tried.

 

EDIT: Nope still nothing.

Link to comment

One thing you could try to see if your script is fired at all, is adding this to it (which should display a notification in the upper-left corner), writing whatever you wish in between the quotes, and recompiling:

 

Debug.Notification("Your Text Here")

 

If nothing happens, maybe check if the pex file that matches your script is in the data/scripts folder.

Link to comment

One thing you could try to see if your script is fired at all, is adding this to it (which should display a notification in the upper-left corner), writing whatever you wish in between the quotes, and recompiling:

 

Debug.Notification("Your Text Here")

 

If nothing happens, maybe check if the pex file that matches your script is in the data/scripts folder.

 

I tried this and the message does get displayed.

Link to comment

Archived

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

  • Recently Browsing   0 members

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