Jump to content

Lovers/Oblivion modding questions


Sarnaath

Recommended Posts

I recently decided to try my hand at modding (well, mostly scripting) and I chose to try revising LoversSpermSplashEX.  One of the things I'd like to do is to determine if the sex animations have been flagged rape or not.  SpermSplashEX works by registering a callback function with Lovers that triggers on reaching the orgasm stage and then adds a scripted token which applies the shader effect and any attribute penalties, etc.  So, ideally, I want to determine whether the sex has been flagged as raped or not at that point.

None of the tokens in Lovers with PK.esm really jump out at me as something I could check for.  I hope I'm missing something simple, so I'm asking if anyone knows the best way to do this at the orgasm stage.

Bonus Question:  what's the best way to create a timer for a scripted token on an NPC?  GetSecondsPassed works fine when run every frame since it appears to return 1/(current FPS), but what about when the player leaves a cell containing an NPC that has a token script running?  The token scripts will quickly drop to processing to every 15 seconds in my testing.  If the user has chosen a sperm effect duration of 60 seconds, the sperm effects should ideally be gone in 60 seconds regardless of how often the script has been processing.

I want to put in a fail-safe timer so that the token cleans up and removes itself at some point regardless of whether it's script been running every frame or not.  I think I can convert the user's SpermSplashEX duration setting (which is in real life seconds) into game time and monitor GameHour/GameDaysPassed but I'm wondering if there is a better way.

Thanks for the help.

Link to comment

I recently decided to try my hand at modding (well, mostly scripting) and I chose to try revising LoversSpermSplashEX.  One of the things I'd like to do is to determine if the sex animations have been flagged rape or not.  SpermSplashEX works by registering a callback function with Lovers that triggers on reaching the orgasm stage and then adds a scripted token which applies the shader effect and any attribute penalties, etc.  So, ideally, I want to determine whether the sex has been flagged as raped or not at that point.

 

None of the tokens in Lovers with PK.esm really jump out at me as something I could check for.  I hope I'm missing something simple, so I'm asking if anyone knows the best way to do this at the orgasm stage.

 

 

Token xLoversPkrIdentifier (xx00080C) gives an actor's role: 1x count = consensual offensive position, 2x count = consensual defense, 3x count = offensive rapist, 4x count = defensive rape victim.

 

As for the token, wouldn't even being shunted to low processing be okay since GetSecondsPassed is since the last time a given script block has run?

Link to comment

Token xLoversPkrIdentifier (xx00080C) gives an actor's role: 1x count = consensual offensive position, 2x count = consensual defense, 3x count = offensive rapist, 4x count = defensive rape victim.

Awesome! Thanks. Must simpler than how I am currently going about it.

 

As for the token, wouldn't even being shunted to low processing be okay since GetSecondsPassed is since the last time a given script block has run?

That's not how GetSecondsPassed is working in my testing. I put a timer (timer - GetSecondsPassed) in the object script and had the timer value printed to the console each frame. Raped an NPC giving him a sperm effect token and the running object script. This was in the player house in Chorrol (Arborwatch). I was getting values printed out like this: 177.29, 177.273, 177.256, 177.24, 177.223... all decreasing about 0.016 a time (with some rounding). The script should be running once a frame at this point. I have OSR cap my framerate at 60, which I definitely get a small room like the Arborwatch master bedroom. 1/60 = 0.0166666...

 

Then I left the NPC in the house and went out to Chorrol, by the oak tree there with Honditar. The script timer console messages dropped fairly quickly from running every frame to running about every 15 seconds (as far as I could tell with a stopwatch and checking the console for the next timer value update). Once that settled down, I noted the last timer message, closed the console, used the stopwatch to count 1 minute, then checked the console. The new timer value messages: 51.0555, 51.0395, 51.0235, 51.0075. First, there's only 4 updates, which is in line with what you'd expect if the script was only running every 15 seconds. Second, the counter is still only decreasing by 0.016 each time, not ~15 seconds. My framerate in that area of Chorrol is still about 60 fps.

 

Then I quit, changed OSR to cap my framerate at 40 fps and repeated the same test: 173.411 (message before test), 173.386, 173.361, 173.336, 173.311. This time the decrease is 0.025 = 1/40.

 

So, I concluded that GetSecondsPassed actually returns 1/(current FPS) and thus works reliably only when called in scripts running every frame. At least for scripts attached to objects in an actor's inventory. I tried googling to see if anyone else has had similar results, but came up with nothing.

 

In any event, if I set the failsafe timer to remove the token after, say, 2 minutes, and leave the NPC in Arborwatch go hang out with Honditar for 5 minutes, and come back, the NPC still has the token (I can check his inventory with MCS) and shader effect. It's not working like I want it to. I need another method to check real time duration.

 

EDIT: this is for an object script. NOT a quest script. I assume the game engine handles GetSecondsPassed differently for quest scripts since you can specify how often they run. All I can say is that in this particular situation, it's not working as described.

 

EDIT2: or maybe not.  I recognize haama from the CS wiki site.

Link to comment

Since you are getting variable rates with GetSecondsPassed (when leaving the cell),
then using a comparison to GameHour might be the safest.
Just convert players input to game-time, as you mentioned earlier.
One real minute = 30 minutes game time.
So when begining the effect, set (float) timecheck to GameHour+00.50 [if player chooses 60 sec.].
When timecheck is lessthan or equal to GameHour, end effect and clean up.

It may not catch spot on 60 sec. but should be close.

Mem

Link to comment

According to the wiki, and I've never seen any reason to disbelieve it, GetSecondsPassed

 

'Returns the number of seconds passed since the last frame in which the current script was processed'

 

It does not matter what type of script it is. If it says Begin GameMode, GetSecondsPassed behaves this way. Fine control in scripts would be impossible if it didn't.

Link to comment

The tests I did above were in GameMode.  When not running every frame Gamesecondspassed is not returning the seconds passed since the last frame in which the current script was processed.  I haven't seen it return anything greater than a fraction of a second, even if the script is obviously running every 15 seconds or so.  And according to the wiki here, in the script should run whenever the actor is processed, which can be quite infrequent when not in the same cell as the PC.

 

I'll convert to game time and calculate the game day and game hour in which to terminate the token.

 

Thanks for the help!

Link to comment

I don't fully understand what you need in the getsecondspassed

 

but for a smoother get seconds passed

 

something like this will help, this will allow a more even timing, I don't use it much, but it can be helpful to know

set timer to timer + 1 * getsecondspassed

or

set timer to timer - 1 * getsecondspassed

this will be more steady no matter what the FPS of the player is.

 

  Maybe something that can help you.

 

I use it mostly for movement of item's like for a reciprication action in a moving object like this

set znew to me.GetPos z + zspeed * getsecondspassed

This keeps the movement of the object fluid, and not jerky.

 

As to the NPC Script, as long as the NPC is not flagged No low level processing, then there scripts should run all the time. But NPC scripts can be flacky.. I have found them to not be real trustworthy.

Link to comment

(edit: Sorry for the wall of text. Sometimes I get rather verbose.)

 

Well, SpermSplashEx works by putting a token in the actor's inventory. The script on the token applies various effects which last for whatever duration the user has set in the settings spell. The original mod uses GetSecondsPassed to count down the duration and then stop the shader effect and remove the token when the timer reaches zero.

 

If the timer doesn't work right, NPCs left covered in cum could still be covered once the player returns, despite the user's duration setting. They'll think the mod is broken. Even if the NPC has "No Low Level Processing" checked, I need a way to determine if sufficient time has passed so that the script can stop the effects and remove the token as soon as the PC loads the cell.

 

I'm not sure what you mean by "As to the NPC Script, as long as the NPC is not flagged No low level processing, then there scripts should run all the time." To mean "run all the time" sounds like run every frame. According to the CS Wiki here, actors are processed down to every 2 minutes once out of scope if No Low Level Processing has not been checked. (Perhaps I am misinterpreting your statement though.)

 

That all is fine, but the CS Wiki description of GetSecondsPassed is "Returns the number of seconds passed since the last frame in which the current script was processed." That description seems to suggest (at least to me) that the engine gives every script which calls GetSecondsPassed it's own timer variable which keeps track of how much time has passed since the last time that script was run allowing you to accurately measure time elapsed. But it's not working that way for me on these scripts.

 

In my testing, when the NPC drops to medium level processing, the timer is not updated accordingly. It's only decremented by the time since the last frame, not since the last frame the object script was run. It's not behaving like it's description implies. Note, this is an object script on a token in an actor's inventory, not a quest script. I asked about GetSecondsPassed on the Bethesda forums and got conflicting views on whether GetSecondsPassed is reliable even on quest scripts. I haven't used GetSecondsPassed in a quest script so I don't know.

 

But anyways, I don't think adding 1 to the timer equation will help. That will essentially turn it into a frame and time counter and won't help accurately determining how much time has passed since the token was added to the actor. But it's an interesting technique that could certainly come in handy in a different application. I will have to remember it.

 

Currently I set up a fail-safe timer converted to game hours. I check to see if that rolls into the next day and adjust accordingly. The timer compares GameHour and GameDaysPassed to the fail-safe calculated game hour and days passed and triggers removal once beyond the fail-safe limits. This seems to be working.

Link to comment

  All i ment was if they have a check mark in the "no low level processing" they will stop all script actions, and packages if the Player is not in the same cell with them.

 

   If the Check mark is not there then they will continue the scripts and packages when the Play is or is not present.

 

  It is a way of saving FPS and is always a good idea to flag NPC's that never leave there cell, and have no scripts or Packages that have to be running with the "No Low Level Processing" check.

   But not a good Idea if you need the scripts on the to stay running or packages they have on them to still process.

 

  as to packages they tend to change normally at the top of the Hour, scripts, I think yes there is some latency involved in NPC script's but if they are marked as quest, or essential there is a difference, but as to the 2 min thing, I don't think that is set in stone, I think any idle time that the game gets it will look and check them, however some things do take Priority.

 

   A faster system will of course check things more often, and keep things more up to date.

Link to comment

I have a new question.  I want to create a text or .ini file for users to customize and then import that data into an array.  I kind of assumed I could do that with RunBatchScript, but I was very wrong (or I did it incorrectly).  In looking for an alternative method, I found this script which uses Pluggy functions to read a text file into a Pluggy string and eventually parse it into an OBSE array. 

 

I've adapted that script to work with my mod, but then that CS Wiki page was created in 2010 and I wonder if there could be an easier way to accomplish what I want.  So, before I go down this road any further, are there any other options to a import user customized file into an OBSE stringmap array?  I don't see anything in the OBSE documentation page, but then every time I scour that page I find something new so I could easily be missing something.

 

I just need a list of creatures and races set to integer values.  Preferably users could add custom races and creatures which could be imported into my mod.  Actually, that's really important to me. I definitely want users to be able to add custom races if at all possible, without me having to update the mod.

 

Thanks for any ideas.

Link to comment

'Easier' way? There is a way to doing so without pluggy or other dependency crap, of course.

 

Create a repeatable quest. It should contain several quest stages and each stage should call one of your compile fuctions.

User variables in the ini file would better be strings. Strings are easy to control, splitting or replacing etc.

From there, read the ini file using RunBatchScript. Your compile functions will write the array, one entry by one.

In the ini file for example,

set someQuest.sVar to sv_construct "1|2|3|4|5"
Then you read that entry and you can split into an array.

Let someArray := sv_split someQuest.sVar "|"
;    -> [1,2,3,4,5]
Kinda simple idea.

 

 

There are lots of examples out there. Break Armor, TamagoSetbody, Setbody(blockhead), etc they all are doing this to read user data and build an array from it.

Link to comment

Thanks for the examples.  I've got the basic concept down.  Much simpler than what I was doing before and not something I would have thought up on my own.  I'll set it up kind of like how HiyokoClub and LoversChorus do with individual entries on separate lines or sections.  That way it will be easy supply an ini prefilled with vanilla creatures and races, and probably MBP races too.  Then I can comment out entries that aren't (my) default and leave it to users to uncomment and change, and/or add new races, if they choose.

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