Jump to content

Can I use SexLab's TargetRef in my mod this way?


Recommended Posts

Dialogue based mod. I already have; SexLabFramework property SexLab Auto in my main quest script and I use that in script fragments as well.

 

What I'm trying to achieve:

 

I would like to target an NPC in SexLab (press "N" key and see "SexLAb Target" message) and then use that TargetRef in an animation.

 

So... Target my follower, Meera.   SexLab shows debug message "SexLab Target Selected: Meera"

 

So I know TargetRef has Meera

 

Now I walk up to an NPC and say, "Would you like to have my friend?" <--- I would LOVE to be able to replace "my friend" with TargetRef's name. Can I do that in a dialogue Topic using something like... TargetRef.GetLeveledActorBase().GetName() in the dialogue topic?

 

NPC responds "yes"

 

THEN I'd like to start an animation between the NPC I was just talking to and the TargetRef actor. So... like this?

 

actor[] sexActors = new actor[2]
sexActors[1] = akSpeaker
sexActors[0] = TargetRef    <------(or would that be SexLab.TargetRef?)
sslBaseAnimation[] anims
anims = new sslBaseAnimation[1]
anims[0] = SexLab.GetAnimationByName("3J Straight Breastfeeding")
SexLab.StartSex(sexActors, anims)

Assuming I'm getting close.... I am also assuming I'd have to have an Actor Property for TargetRef in my main quest script.

 

 

Would I need to set the value of that property to "SexLabFramework.." ?
I'm not sure what I need in order to be able to use SexLab's TargetRef this way.
Something like:
 
Actor Property TargetRef Auto (hidden?) 
 
OR
 
Do I need to bind TargetRef and then .... well...the more I (over)think about this the more confused I'm getting. :)
 
Any help appreciated. If it's not abundantly obvious, I'm pretty .... new... to this.
 
 
 
 
 
Link to comment

Basically you want to create an NPC-NPC scene with akSpeaker, and another actor of your choice (your follower, specifically)? You can probably find a way to use SexLab's TargetRef feature, but to my knowledge, it should be better to just use a quest alias, as it won't require extracting the reference from SexLab and you can use it in dialogue in an immersive way.

 

How to: In the quest that handles your dialogue, go to the Quest Alias tab and create a new reference alias. Set the Alias Name to Follower. Set the fill type to Specific Reference, but don't actually set a reference to it, just leave it empty. Enable the Optional and Allow Reserved checkboxes as well. If the Allow Reserved checkbox is greyed out, don't worry about it: just press OK when you finish the other changes, then select the alias in the Quest Aliases list, and do control+shift+R.

 

Now, create a new dialogue that you can have with your follower(s), where they agree to be offered up to other NPCs. (You can use GetInFaction CurrentFollowerFaction == 1 to limit this dialogue to followers only) At the point in dialogue where your follower agrees, add a script to that topic info. You'll need to set a property in this script, of type Reference Alias: name it Alias_Follower. Link this property to the Follower quest alias that you made earlier. Once that's done, just add Alias_Follower.ForceRefTo(akSpeaker) to the script code, and every time this dialogue occurs, the NPC you're speaking to will be stored as a re-usable reference in your quest alias, and you can now do whatever you like with it.

 

So, back to your SexLab animation code. In this script, add a ReferenceAlias property linking to Follower, just like you did earlier, and fill the actors as such:

actor[] sexActors = new actor[2]
sexActors[1] = akSpeaker
sexActors[0] = Alias_Follower.GetActorReference()
sslBaseAnimation[] anims
anims = new sslBaseAnimation[1]
anims[0] = SexLab.GetAnimationByName("3J Straight Breastfeeding")
SexLab.StartSex(sexActors, anims)

;clear the quest alias so it remains empty until you do the dialogue with the follower again
Alias_Follower.Clear()

Done!

 

As for using NPC names dynamically in dialogue, you'll need this: Text Replacement If you did the implementation as above, your follower will already be inside the alias by the time you're talking with akSpeaker, so you just use <Alias=Follower> in the dialogue text, and the game will automatically replace it with the NPC's name. Alternatively, you can use <Alias.ShortName=Follower> if you only want the NPC's first name to be used in the dialogue.

 

Link to comment

You make it sound so easy! :D

 

Probably be tomorrow before I actually get to do most of this, but I'll give it a shot. :)

 

Thank you very much. TALKING to the "intended target" is far preferable to walking up to them and pressing a key when you're working on dialogue-based interaction. hehehe

 

Appreciate the help. I'll work on this and see where I get.

Link to comment

OK... this all works!  I didn't try the text replacement yet, but the rest worked.

 

NOW I have another question (or 2)... naturally.

 

If I clear the quest alias at the end of the animation where the NPC has the follower.... then that quest alias is empty.

If I forget it's empty and try to run through having an NPC intereact with Alias_Follower, what kinds of problems will that cause?

 

AND... can I safeguard this by making that dialogue dependent upon Alias_Follower NOT being empty? Can I make it a conditional?

 

Can I declare like this?:   ReferenceAlias Property Alias_Follower Auto Conditional

 

AND would that make it show up in the list of conditions available for the info?

Link to comment

If I clear the quest alias at the end of the animation where the NPC has the follower.... then that quest alias is empty.

If I forget it's empty and try to run through having an NPC intereact with Alias_Follower, what kinds of problems will that cause?

 

The SexLab thread will fail to validate, because one of the actors is NONE.

 

 

AND... can I safeguard this by making that dialogue dependent upon Alias_Follower NOT being empty? Can I make it a conditional?

You can, and should!

 

 

Can I declare like this?:   ReferenceAlias Property Alias_Follower Auto Conditional

 

AND would that make it show up in the list of conditions available for the info?

 

Conditionals are generally for integers or floats, and don't really apply here. In this case, where you want to check if an alias is filled or empty, there's a much easier option by simply defining a condition in your dialogue. Set a condition as follows:

 

Condition Function: HasLoaded3D

Comparison: == 1

Run on: Quest Alias

 

Once you've set these three, there will be a dropdown box right in front of the 'Run On' section, that will now be enabled. Select your alias, Follower, there.

 

That's all you need. This condition will serve two functions: Firstly, it will always return false if your alias is empty, because a NONE reference alias can't possibly have 3D loaded, ever. Secondly, it will ensure that even if the alias is currently filled with an actor, the dialogue still won't show if the alias isn't near you. (because maybe you told your follower to wait in another cell, or a similar scenario)

 

 

On a related matter, if you put enough conditions to protect against unintended dialogue access, you might not even need to clear the alias after each use. If the dialogue to use your follower for an animation has the HasLoaded3D condition, plus another one to check if the follower is alive (GetDead != 1), and another one to check if they're still your follower (GetInFaction CurrentFollowerFaction == 1), it should be safe to let the alias remain filled permanently. If at some point down the line you change followers, it's no problem either: you just talk to the new follower with that dialogue where they agree to be offered, and Alias_Follower.ForceRefTo(akSpeaker) will be called again, which overwrites the existing old follower stored in the alias.

Link to comment

The conditions for the conversation this is linked FROM already set the sex of the participants and whether or not they're a follow and in JugsFaction. So the only way to get TO this Topic is to meat those conditions. Adding the conditions as you've suggested should tidy things up quite a bit and avoid issues. 

 

And actually, leaving the alias filled until it's changed wouldn't be a problem. Will that persist? Or will it reset to empty when I quit and come back to the save later?

 

Right now I only have enough dialogue created to test if I would be able to follow directions and get it to work. :)

 

But now that I know how to DO this... I could reuse the concept.  And I see the NPC "warps" to my follower so I'm guessing this is where I'd want to learn how to make a scene so he walks to her instead of warping... 

Having never done a scene.... they're scary... 'cause all the tutorial talk about trigger boxes and stuff. And I don't think I'd even HAVE a trigger box. I don't know. I'll have to look and see if I can figure it out because I ALREADY have a use for a scene I think. Besides this one. Warping just isn't.... pretty. :)

 

So thank you AGAIN.... and now I have dialogue to write to make use of this in a bit more elegant way than my test dialogue. :D

Link to comment

And actually, leaving the alias filled until it's changed wouldn't be a problem. Will that persist? Or will it reset to empty when I quit and come back to the save later?

 

Aliases maintain their fill content until cleared or overwritten, and will survive save/load cycles. The only situations where an alias gets reset is if you explicitly clear it, or if the parent quest of the alias is stopped or reset.

 

As for scenes, I'm afraid I haven't done much at all with those. I assume you'll need to create a ForceGreet package that targets your Follower Alias, and starts the SexLab thread once the greet occurs.

Link to comment

Hmmm.... working on text replacement.

 

In a Topic text, I used:

 

<Alias=Follower> and it didn't work.

 

Topic Text (this is my player speaking):

Well... actually... it's <Alias=Follower> that needs milking.

 

And what displayed on screen was:

Well.. actually... it's '[...]' that needs milking.

 

And in the info where I used it, it actually displays <Alias=Follower> and not the follower's name.

 

Reading the wiki link that you gave me, it says:

If the resulting text is '[...]', then that means the alias wasn't filled.

 

Now... the alias WAS filled because the animation worked. HOWEVER... the animation is using Alias_Follower and not Follower.

 

Reading further in that wiki page it says:

 

Text replacement tags can be used in the following text fields:

  • Quest stage Log Entry
  • Quest objective Display Text
  • Topic prompts (but not Topic Info)
  • Messages - Title and Message Text
  • Book text

 

 

 

At the beginning of that wiki page, it also says this:

 

  • In order to use this, you need to mark the specified alias as "Stores Text" (this indicates to the quest that the alias name needs to be saved onto the quest instance data).

 

 

 

SOoooo...

I'm not sure what to do next. It would be NICE if the follower could be referred to by name, but I suppose it's not essential. 

 

I'm going to edit the dialogues for now until I see if I can get this working, but not being able to replace text in a Topic Info kinda makes it... less promising. :)

 

Link to comment

Tried a couple things, still not working.

 

Tried putting <Alias=Follower> into the Topic Prompt instead of the Topic Text. - nope

Changed <Alias=Follower> to <Alias=Alias_Follower> -- nope

 

Do I need to define that Alias in the main quest script?

Link to comment

Wait a second...

 

If I set that Alias in the dialogue where I'm putting the follower into Alias_Follower. 

 

Do I need to have :

 

ReferenceAlias Property Alias_Follower Auto

 

in every script where I use Alias_Follower after that?

I mean... am I "resetting" something in that alias every time I "redefine" it?

 

That doesn't SEEM to be happening because the topic that has the script for starting the animation works. So it doesn't APPEAR as though I'm resetting anything. If I was emptying that reference then the animation wouldn't work.

 

 

In the conditions for an info I check that HasLoaded3D runs against the Alias called "Follower" and that seems to be working.

 

I'm confused again...

 

 

Link to comment

Now... the alias WAS filled because the animation worked. HOWEVER... the animation is using Alias_Follower and not Follower.

 

Those two are one and the same. Follower is the alias itself, and Alias_Follower is a ReferenceAlias property that links to Follower. No matter which one you use, you're still accessing the content of Follower; the only difference is one is a direct reference (which you normally use in the CK), the other is a property reference (which you normally use in scripts).

 

As for the other things, it does look like:

 

  1. You need to enable the 'Stores Text' checkbox in your Follower quest alias. (after you make this change, make sure you re-fill the alias by talking to your follower again, otherwise it won't work)
  2. You can only add <Alias=Follower> in text that the player speaks, it won't work for NPC responses.
Link to comment

OK, thanks. I'll try those changes and see what I get. I was afraid to check that "Stores Text" box because I wasn't sure what it did and didn't want to break anything.

 

ALSO.... an issue I've found.

I put an NPC into that follower Alias through dialogue. This works.

 

I use HasLoaded3D on the Follower alias to make sure the dialogue only show up if that alias is filled and the NPC in it, is nearby. 

 

Problem:

 

I put Eryniel into the Follower alias.

 

In dialogue, I get the option to ask her if she'd like to milk my friend.

 

But she IS the friend! :)

How would I gracefully handle this? That dialogue option shouldn't show up if I'm talking to the NPC who is in the alias.

When I add them to the alias, could I also add them to a faction like... JugsAliasFaction and then just add InFaction JugsAliasFaction != 1 ?

I'd have to figure out how to get any PREVIOUS npc OUT of that faction though, when I put a new one INTO it.... sheeesh.... :)

 

Or... some other way to conditionally exclude the person IN the alias? 

 

 

Link to comment

OK, well... I checked the "Stores Text" box in the alias. 

I used <Alias=Follower> in the Prompt line for a topic.

 

Entered game, redid the talking to her to refill the alias. And.... nada.

 

Didn't work. I'm still getting the "...it's my friend, '[...]', that needs milking."

 

 

Link to comment

Problem:

 

I put Eryniel into the Follower alias.

 

In dialogue, I get the option to ask her if she'd like to milk my friend.

 

But she IS the friend! :)

How would I gracefully handle this? That dialogue option shouldn't show up if I'm talking to the NPC who is in the alias.

When I add them to the alias, could I also add them to a faction like... JugsAliasFaction and then just add InFaction JugsAliasFaction != 1 ?

I'd have to figure out how to get any PREVIOUS npc OUT of that faction though, when I put a new one INTO it.... sheeesh.... :)

 

Or... some other way to conditionally exclude the person IN the alias? 

Use the condition: GetIsAliasRef [Follower] != 1

 

 

OK, well... I checked the "Stores Text" box in the alias. 

I used <Alias=Follower> in the Prompt line for a topic.

 

Entered game, redid the talking to her to refill the alias. And.... nada.

 

Didn't work. I'm still getting the "...it's my friend, '[...]', that needs milking."

 

Hm, not sure if the entire quest needs to be reset for the Stores Text flag to apply, or if we're forgetting something. Might do some experimenting with it when I have some free time.

Link to comment

hmmm... ok... no it didn't. Getting the '[...]' again... I'm going to try clearing the alias before putting a maid into it and see if that helps.

 

**EDIT ** nope... clearing the reference, then utility.wait(1.0) and then setting the reference... didn't work.

Still getting [...] instead of the referenced actor's name.

 

** EDIT AGAIN **

Ok, I'm on to something...

 

drop to console

 

help jugs <---to find ID

 

stopquest 62000D62

exit console

back into console

startquest 62000D62

exit console

 

** at this point, my dialogues weren't showing up... weird... so,,,

 

go into console

resetquest 62000D62

exit console

 

Dialogues showing, and text replacement working.

 

So I figured I'd save, exit game, reload and see about persistence.

 

Upon reloading...

SQV showed REF 'FOLLOWER' -> NONE so that AliasRef isn't staying "populated".

 

Walked up to a follower, dialogue to put her in the alias, and SQV showed that REF 'FOLLOWER' -> Follower's_ID

so... it filled the reference through dialogue.

 

Chatted up a guard and asked him to milk her and the text replacement worked and used her name correctly.

 

Went to a different follower, chatted her up to put her in the alias.

SQV showed the reference change to her ID

 

Got another follower to milk her and text replacement worked.

 

SO.... so far... stop/start/reset quest got it working.

The Alias does not appear to stay "filled" when saving/reloading

 

Other than that, it's working. :)

 

 

 

Link to comment

Huh, that's not supposed to happen I think. I just did an identical test with SexLab Solutions and the alias stays filled through save/load. I'm using the exact same method (ForceRefTo) to fill it, too...

 

Just to make sure that the quest resetting isn't causing any issues with the alias, can you try an older save where the alias Follower hadn't been defined yet, and see if the alias can keep its value through a load?

Link to comment

Hmmm....

 

I'll have to hunt for a save that hasn't seen that mod yet and won't take a lot of dickin' around to run everything ....

 

Meanwhile... I noticed I have: ReferenceAlias Property Alias_Follower Auto

 

...in my main quest script. Since I created the alias in the quest tab, do I need that line in my main quest script? Am I possibly ... resetting... something?

Link to comment

Hmmm....

 

I'll have to hunt for a save that hasn't seen that mod yet and won't take a lot of dickin' around to run everything ....

 

Meanwhile... I noticed I have: ReferenceAlias Property Alias_Follower Auto

 

...in my main quest script. Since I created the alias in the quest tab, do I need that line in my main quest script? Am I possibly ... resetting... something?

 

Doubt it. If it's just a property definition and you're not doing anything with it (namely, forcing it to a new reference or clearing it) there's no reason why it should empty on its own.

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use