Jump to content

A Question of Scripting?


Recommended Posts

So, I had a modding related question, and I wondered if anybody here might be able to help me with it. I found this mod, which in itself is very relevant to my interests.

https://www.loverslab.com/topic/8016-spanking-mod/?page=4&tab=comments#comment-435615

 

And it got me thinking about how it works, and if I could do something similar.

That is, would it be possible for me to create a mod that makes it so when I walk up to an NPC in the game and put my crosshair on them, and press the chosen key, they would instantly play one specific animation? For example, walking up to somebody, pressing the key, and then "Nibbles Spanking" plays?

 

How possible is that? And are there any mods already that can allow something like that? Making a specific animation play when a specific key is pressed?

Link to comment
Scriptname clickToPlayAnim extends ReferenceAlias
	 
SexLabFramework Property SexLab Auto
	 
event OnInit()
   RegisterForCrosshairRef()
   RegisterForKey(2) ; It is the key "1"
endEvent
	 
event OnPlayerLoadGame()
   RegisterForCrosshairRef()
   RegisterForKey(2) ; It is the key "1"
endEvent
	 
Actor underCrossHair
	 
Event OnCrosshairRefChange(ObjectReference ref)
   underCrossHair = ref as Actor
EndEvent
	 
event OnKeyUp(int k, float time)
    if k!=2
    	return
    endIf
    if !underCrosshair || underCrosshair.isInFaction(SexLabAnimatingFaction)
    	return
    endIf
	 
    Actor[] participant = new Actor[1]
    participant[0] = underCrosshair
    sslBaseAnimation[] Anims = new sslBaseAnimation[1]
    Anims[0] = SexLab.GetAnimationByRegistry("NibbleSpankingID") ; Put the right ID here
    SexLab.StartSex(participant, Anims)
endEvent

 

Create a quest, create an alias inside the quest, set it to the player, attach this script.

And enjoy.

 

(Remember to put the correct ID of the anim, and the key code you prefer)

 

Link to comment
55 minutes ago, CPU said:

Scriptname clickToPlayAnim extends ReferenceAlias
	 
SexLabFramework Property SexLab Auto
	 
event OnInit()
   RegisterForCrosshairRef()
   RegisterForKey(2) ; It is the key "1"
endEvent
	 
event OnPlayerLoadGame()
   RegisterForCrosshairRef()
   RegisterForKey(2) ; It is the key "1"
endEvent
	 
Actor underCrossHair
	 
Event OnCrosshairRefChange(ObjectReference ref)
   underCrossHair = ref as Actor
EndEvent
	 
event OnKeyUp(int k, float time)
    if k!=2
    	return
    endIf
    if !underCrosshair || underCrosshair.isInFaction(SexLabAnimatingFaction)
    	return
    endIf
	 
    Actor[] participant = new Actor[1]
    participant[0] = underCrosshair
    sslBaseAnimation[] Anims = new sslBaseAnimation[1]
    Anims[0] = SexLab.GetAnimationByRegistry("NibbleSpankingID") ; Put the right ID here
    SexLab.StartSex(participant, Anims)
endEvent

 

Create a quest, create an alias inside the quest, set it to the player, attach this script.

And enjoy.

 

(Remember to put the correct ID of the anim, and the key code you prefer)

 

Wow!

Thank you! That's all very helpful.

How would I create a quest and attach that to it though? Im very new at modding. Only thing Ive ever really done is add items to shops.

 

In fact, the best way I learn anything is to see it done. I don't suppose I could ask you to create something like this for me, could I? Because I garentee you that if you do, all Ill have to do is open the files and look at them and Ill understand. If its any trouble, no worries, but if it wasnt, ide be really thankful.

 

And hell, if anybody needed a beta tester for anything in the future, I would offer my help with that! 

Link to comment

There's also the matter that I have NO idea what any of those lines of code mean, and that I don't know what is actual a line of code, and what you intend for me to remove and write something else in. For example:

 

    Anims[0] = SexLab.GetAnimationByRegistry("NibbleSpankingID") ; Put the right ID here
    SexLab.StartSex(participant, Anims)

 

Do I put something in between the ( ) where NibbleSpankingID is? Do I leave in the "? Do I leave in the ( )?
Am I supposed to place something in place of (participant, anims)?

I'm looking at the files for that spanking mod, and thats even more confusing, because I don't understand any of the scripts I'm reading. Also, whenever I try to change anything and recompile it, it tells me that compiling failed. So I have NO idea what I'm doing at all. Even when it comes to the basics.

Link to comment

I might suggest that you watch a few tutorials on:

  • Quest Creation
  • Aliases
  • Basic Papyrus Scripting

CPU's code is actually quite nice, but I wouldn't call it code for a beginner scripter. You might need to spend some time learning some of the basics of the above before you try to delve into something like this which is a bit more complex.

 

I'll give you a rundown of what's going on with CPU's script based on my understanding of it:

 

Scriptname clickToPlayAnim extends ReferenceAlias; Script Name, somewhat self explanatory but also notice that it extends 'ReferenceAlias'
- This means that it is attached to an Alias - You would create an Alias in a Quest and then attach the script directly to it.
	 
SexLabFramework Property SexLab Auto - He is calling a property from an external script, SexLabFramework, you can view this script and all
internal functions by opening SexLabFramework.psc - calling a property like this allows you to use any function from SexLabFramework in this
script.
	 
event OnInit() An event that will initialize on Quest start, and I believe on Game Start.
   RegisterForCrosshairRef() Pretty self explanatory, registering for when a Ref is under the CrossHair.
   RegisterForKey(2) ; It is the key "1" Registering for a key, appears key(2) corresponds to the "1" key.
endEvent
	 
event OnPlayerLoadGame() Similar to last function, makes sure it fires on Game Load.
   RegisterForCrosshairRef()
   RegisterForKey(2) ; It is the key "1"
endEvent
	 
Actor underCrossHair An Actor with no specific properties set i.e. - they will be defined later.
	 
Event OnCrosshairRefChange(ObjectReference ref) Now the crosshair event that was registered from before is getting triggered. Note, you have to register for events like this before they will work.
   underCrossHair = ref as Actor Casting the ref under the crosshair as an Actor.
EndEvent
	 
event OnKeyUp(int k, float time) Watches for keyup event, this would trigger for all keys, so the next if condition is added.
    if k!=2 Says, if the key is not equal to 2, it will just return, 'do nothing'. If it is equal to 2, it will keep going.
    	return 
    endIf
    if !underCrosshair || underCrosshair.isInFaction(SexLabAnimatingFaction) if Ref is not under crosshair, or if it is SexLabAnimatingFaction (in middle of sex scene), the code stops.
    	return 
    endIf
	 
    Actor[] participant = new Actor[1] This is grabbing the Actor for a SexLab scene using SexLabFramework syntax.
    participant[0] = underCrosshair Setting SexLab slot to this Actor. - Actor UnderCrossHair from earlier is defined here.
    sslBaseAnimation[] Anims = new sslBaseAnimation[1] Another SexLab script, can see it in sslBaseAnimation.psc - Framework hooks into it calling a string array.
    Anims[0] = SexLab.GetAnimationByRegistry("NibbleSpankingID") ; Put the right ID here SexLabFramework function. You need to add the unique ID of the animation between the ("")
    SexLab.StartSex(participant, Anims) A function in SexLabFramework script to start a sex scene, participant is the Actor previously defined, Anims in the animation previously defined.
endEvent
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