Jump to content

Need help learning to skript for a mod


Recommended Posts

So i got the basics of editing in the CK down (at least i havent had any problems when i made a custom follower out of a troll) but for the mod i want to make i need to learn how to create skripts. I know that Sexlab comes with a guide showing how to make scripts combatible with it but i cant find any beginner level guides to the basics of skripting. Any help in this would be greatly appreciated, not just by me but also everyone else on this site that wants to help make mods but are currently unable.

 

 

details on the mod i wish to learn to create:

a plugin for sexlab that will work like Defeated in that it will be triggered via combat. The difference being that where Defeated had you fall to a bleed-out state once your health fell below a certain point, my mod will give a % chance for your character to be disarmed in combat (maybe configurable in MCM where 0% the mod is basically inactive and at 100% you will bisarmed by the first attack that hits you)

after you are disarmed you fall down to the bleed out unable to do anything and the attacker then takes advantage of you. (although i'd prefer to do an animation of the enemy grabbing your wrist, i am leagues away from doing anything like that.

 

 

 

so again any help in this would be appreciated. i just need a some direction on where to begin. thanks :D

Link to comment

The Creation Kit Wiki features a tutorial series for scripting; it's where I started too.

Then, this is a list of all/most commands Papyrus and SKSE currently have; for creating a MCM menu look here, to use SexLab look here (I know you've found that already, just including it for completeness sake).

Many modders also include the source code for their scripts, if so you can usually find these under /scripts/source in their download files; you may be able to learn a lot by looking at how other people's code.

 

About the concrete mod idea:

 

details on the mod i wish to learn to create:

a plugin for sexlab that will work like Defeated in that it will be triggered via combat. The difference being that where Defeated had you fall to a bleed-out state once your health fell below a certain point, my mod will give a % chance for your character to be disarmed in combat (maybe configurable in MCM where 0% the mod is basically inactive and at 100% you will bisarmed by the first attack that hits you)

after you are disarmed you fall down to the bleed out unable to do anything and the attacker then takes advantage of you. (although i'd prefer to do an animation of the enemy grabbing your wrist, i am leagues away from doing anything like that.

 

The easiest way to achieve this is to ask Goubo to make a API / Interface for his mod. Then the only thing you would need to do is to monitor the player (and NPCs too if you wish so) with the "OnHit" event and do a quick calculation and when it returns true start Defeat via the interface and let it handle the rest.

That would require only minimal code and it would make use of every improvement Goubo makes for Defeat.

 

Dynamic rape chance is also I feature I crave for so I would help you I will help you as best as I can.

Link to comment

The Creation Kit Wiki features a tutorial series for scripting; it's where I started too.

Then, this is a list of all/most commands Papyrus and SKSE currently have; for creating a MCM menu look here, to use SexLab look here (I know you've found that already, just including it for completeness sake).

Many modders also include the source code for their scripts, if so you can usually find these under /scripts/source in their download files; you may be able to learn a lot by looking at how other people's code.

 

About the concrete mod idea:

 

details on the mod i wish to learn to create:

a plugin for sexlab that will work like Defeated in that it will be triggered via combat. The difference being that where Defeated had you fall to a bleed-out state once your health fell below a certain point, my mod will give a % chance for your character to be disarmed in combat (maybe configurable in MCM where 0% the mod is basically inactive and at 100% you will bisarmed by the first attack that hits you)

after you are disarmed you fall down to the bleed out unable to do anything and the attacker then takes advantage of you. (although i'd prefer to do an animation of the enemy grabbing your wrist, i am leagues away from doing anything like that.

 

The easiest way to achieve this is to ask Goubo to make a API / Interface for his mod. Then the only thing you would need to do is to monitor the player (and NPCs too if you wish so) with the "OnHit" event and do a quick calculation and when it returns true start Defeat via the interface and let it handle the rest.

That would require only minimal code and it would make use of every improvement Goubo makes for Defeat.

 

Dynamic rape chance is also I feature I crave for so I would help you I will help you as best as I can.

 

wow very detailed help, i was thinking id just get a link to a vid somewhere or something(if anything at all)

ill look into the links you have sent me and start learning tomorrow. as for Goubo i cant be assured he would do so but ill ask as that does sound easier for a beginner. again thanks and i'd love any more tips you have to give as i am extremely new at this

Link to comment

I've written a short script:
 

Scriptname SexLabDefeatAddonextends Quest

;<name of Defeat's interface script> property Defeat auto hidden

event OnHit()
	
	float playerHealth
	float playerStamina
	float playerHealthLost
	float playerStaminaLost
	float chance
	float staminaModifier
	float staminaMultiplier = 2 ; if stamina is full multiply chance with 1 (do nothing), if stamina is empty multiply with 2 (double the rape chance); half stamina would be 1.5 etc.
	
	playerHealth = Game.GetPlayer().GetActorValuePercentage("Health") ;GetActorValuePercentage return a float number between 0 and 1
	playerStamina = Game.GetPlayer().GetActorValuePercentage("Stamina")

        ; in case you want to do this for NPCs you need to somehow get the actor value of said NPC and replace Game.GetPlayer() with it

	playerHealthLost = 1 - playerHealth
	playerStaminaLost = 1 - playerStamina
	
	
	
	chance = playerHealthLost*playerHealthLost
	staminaModifier = 1 + (staminaMultiplier * playerStaminaLost)
	
	if (chance*staminaModifier) > Utility.RandomInt() ; (.RandomInt return a number between 0 and 100 by default)
		;call Goubo's interface
	endIf
	
	Debug.Notification("Chance: " +(chance))
	Debug.Notification("staminaModifier: " +(staminaModifier)) ;prints messages to the upper left, not needed; however useful if you want to find bugs in you script
	
endEvent

All work you have left to do is to find out how to connect the player/NPC getting hit with the getHit event and persuade Goubo to make an interface.

It wouldn't hurt to find out if Papyrus has a powerOf function, then you could change the chance calculation with

(playerHealthLost ^ 1.5) * 10

which makes a nicer curve.

Link to comment

Wow lol a lot of that went over my head (probably because I only just now started looking at those links you gave me) but I did understand generally here and there. I'll look up that poweroff function you mentioned after I've read through the site you've sent some more.

 

Ps nice work on making that so fast, I wasn't expecting so much help =D

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