Jump to content

Need help with some basic scripting


lokohryu

Recommended Posts

Posted

I've been looking through the creation kit wiki tutorials alongside the sexlab git to implement a simple script that triggers when npcs equip an item, but I've officially burned out on trying to figure this stuff out on my own. Bare in mind this is essentially my first attempt at scripting something so I'm probably either using the wrong functions/properties/ etc or otherwise overlooking something else really obvious to someone that has an idea of what they're doing

 

I went through several iterations using a few different methods, including no if/endif and excluding the player but this is what I'm currently stopping at. All it needs to do is set the sexlab gender to male for females(or everyone, doesn't matter too much for me) that equip the item (Not worried about reverting the change but anyone is welcome to add such code) Explanations of the correct script anatomy would also be extremely appreciated but not required, I realize the knowledge is on the web somewhere but I'm having difficulty finding it.

 

Uploading as a text file since the forum thinks it's a link for some reason, and I guess I can't add links because of my low post count?

gendertestblah.txt

Posted

Your script is extending an ObjectReference.

This means that you can attach it only to items that are placed inside a cell.

 

Did the script compiled without errors? (I think so, but I am asking.)

Did you fill the SexLab property on the script?

 

 

 

Try this code, to be sure that the script is executed:

 

 

ScriptName GENDERCHANGE Extends ObjectReference 
 
Event OnEquipped(Actor akActor)
 Debug.MessageBox("The item is equipped on: " + akActor.getDisplayName())
EndEvent

 

If you receive the message when equipping the object, then 99.99% you did not set the SexLab property.

 

If you DON'T receive the message, then you have to be sure that this script is correctly associated to the object you wish.

--> Maybe you can change the script in a different way: extend an Actor, and attach the script to a ReferenceAlias filled with the plyer.

And use "Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)", and then check if the object is your Armor, before applying the SexLab function.

 

 

If you wish a simple reference to Papyrus you can download the one in my signature.

 

Posted

Finally got it to work, thanks for the help. I did have the properties set incorrectly (didn't realize I needed to apply a value for playerref). I also forgot that Mod Organizer and Creation Kit don't play well together which caused some setbacks. I simplified the code to just this so that I could at list confirm it functions

ScriptName GENDERCHANGE Extends ObjectReference 
SexLabFramework Property SexLab  Auto  

Event OnEquipped(Actor akActor)
	SexLab.TreatAsMale(akActor)
EndEvent

I'll expand it a bit more as I need, and I found your papyrus guide to be a lot more helpful in understanding the basic anatomy of the script. Thanks again!

Archived

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

  • Recently Browsing   0 members

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