foxyvixen21 Posted January 23, 2014 Posted January 23, 2014 If this isn't the right place for this thread please move it. I am creating a wear and tear like system for Skyrim. The PC will be on a scale from 0 to 10 depending on how much sex they have had. I want to create a timer function after the PC has engaged in sex (RegisterForModEvent("AnimationEnd","Timer") and when the timer reaches 0 the PC will go back down on the scale (Say from 3 to 2). Once that first timer reaches the end another timer will start which will drop the scale from 2 to 1 if the PC doesn't engage in intercourse say for 24 in-game hours for this example. I know SexLab has a LastSexGameTime() function but does SexLab keep track of how many times the user has had sex within a time frame? Because I don't want the scale to move up every time the PC has sex. For scale 2 for example after the PC has sex 3 times it could then move up to scale 3, but the timer will be reset for going back to level 1 Would this be a good way to go about it or is there a simpler way I am missing? Which is the easiest way to create a timer function? and Does SexLab record how many time the PC has had sex within a time limit? If not I can probably create my own.
Guest airdance Posted January 23, 2014 Posted January 23, 2014 Which is the easiest way to create a timer function? you mean like from scratch?, or using the functions available in the skyrim script?
foxyvixen21 Posted January 23, 2014 Author Posted January 23, 2014 If Papyrus already has a timer-like function that will work.
gooser Posted January 23, 2014 Posted January 23, 2014 Maybe an alternative is use Utility.Wait(86400) in a loop and after each Wait, decrease the wear/tear factors? bool shouldContinue = true While shouldContinue Utility.Wait(86400) ; seconds in one day DecreaseWearTear() TestifShouldContinue() ; set shouldContinue to false, when mod disabled in MCM, etc. EndWhile
gooser Posted January 23, 2014 Posted January 23, 2014 This could also probably be a completely separate script, correct? Something that uses those properties you defined for wear/tear and just executes something like the above and sets the property values?
foxyvixen21 Posted January 23, 2014 Author Posted January 23, 2014 I think that could work, if I put at if statement in the while loop I can increase the timer based on where the PC is on the scale RegisterForModEvent("AnimationEnd","Timer" Event Timer While shouldContinue if PCVaginalState == 2 Utility.Wait(86400) ; seconds in one day DecreaseWearTear() elseif PCVaginalState == 3 Utility.Wait(172800) ; seconds in two day DecreaseWearTear() elseif PCVaginalState == 4 .... do stuff EndIf EndWhile End Event
gooser Posted January 23, 2014 Posted January 23, 2014 That sounds right. Another point of reference might be looking at SexLab Hentai Pregnancy or Estrus Chaurus. Both have some kind of countdown, modifying in MCM, of how long it takes to complete the pregnancy (or estrus infestation), and they both also modify the breast and belly (BigBelly) nodes in the skeleton - both expansion (while getting further along in the pregnancy/infestation), and compression (during post-pregnancy, etc). It seems to work really well.
Srende Posted January 23, 2014 Posted January 23, 2014 FYI, Utility.Wait() is REAL time, so you're making it wait for 24 real hours. The one you're looking for is Utility.WaitGameTime() or RegisterForSingleUpdateGameTime(). If you need to wait a long time, registerforsingleupdate would be a nicer solution than wait.
gooser Posted January 23, 2014 Posted January 23, 2014 Actually Foxyvixen found that out and PM'd me the discovery.
Someone92 Posted January 23, 2014 Posted January 23, 2014 Iirc spell effects with a duration vanish when you wait/sleep long enough; if that's the case I would try the following: - Create a faction named "wear'n'tear" or something, give it 10 ranks- Create a magic effect, create a spell, attach the magic effect to the spell and give it a fitting duration (e.g. for a timescale of 20 24 hours would be 4320 seconds)- Properly make the magic effect invisible to the UI so it doesn't clutter the active effects tab in-game- On 'AnimationEnd' increase the current faction rank by one, add the spell- Attach a script to said magic effect that triggers on OnEffectFinish- OnEffectFinish lowers the current faction rank by one - OnEffectFinish reapplies the spell so in another 24h the rank drops again- Finished- In case the actor has sex another time before the spell runs out due to the 'AnimationEnd' code above the "wear'n'tear" is increased by another rank- Also the spell duration is refreshed, it takes once again 24h in-game before "wear'n'tear" drops a rankVery little code needed, like 20 lines or so; easily used by other mods; easily expanded to every actor, not just PC.
foxyvixen21 Posted January 24, 2014 Author Posted January 24, 2014 Iirc spell effects with a duration vanish when you wait/sleep long enough; if that's the case I would try the following: - Create a faction named "wear'n'tear" or something, give it 10 ranks - Create a magic effect, create a spell, attach the magic effect to the spell and give it a fitting duration (e.g. for a timescale of 20 24 hours would be 4320 seconds) - Properly make the magic effect invisible to the UI so it doesn't clutter the active effects tab in-game - On 'AnimationEnd' increase the current faction rank by one, add the spell - Attach a script to said magic effect that triggers on OnEffectFinish - OnEffectFinish lowers the current faction rank by one - Finished - In case the actor has sex another time before the spell runs out due to the 'AnimationEnd' code above the "wear'n'tear" is increased by another rank - Also the spell duration is refreshed, it takes once again 24h in-game before "wear'n'tear" drops a rank Very little code needed, like 20 lines or so; easily used by other mods; easily expanded to every actor, not just PC. This is better then the solution I have started. Just one other question I don't want the effect to increase to the next rank every time the PC has sex. I also want more 'wear and tear' for aggressive animations. Maybe each stage has an amount of 'damage' so rank 2 to 3 there is 50 damage. Non aggressive animations increase it by 10 and aggressive increase it by 20. Rank 3 to 4 could have 80 damage. Would that be possible with what you suggested? Thanks again!
Someone92 Posted January 24, 2014 Posted January 24, 2014 Hm, out of the top of my head: - "float property wear'n'tear_value auto hidden" (or something like that) - OnInit and OnUpdate: registerForSingleUpdate(5.0) (so your code gets periodically called) - OnUpdate: Check "wear'n'tear_value", check "wear'n'tear" faction rank - Check for the faction rank, if "wear'n'tear_value" is too low (below 0) or too high (over 50 for rank 1 and 2, over 80 for rank 3 and 4) - If above increase "wear'n'tear" faction rank by one - New "wear'n'tear_value" is [max "wear'n'tear_value" of current rank - "wear'n'tear_value"] (or set to 0) - If below reduce "wear'n'tear" faction rank by one; add the spell - New "wear'n'tear_value" is ["wear'n'tear_value" - max "wear'n'tear_value" of previous rank] (or set to 0) - OnAnimationEnd: Increase "wear'n'tear_value" by whatever amount; you can check for isAggressive and isVictim to give lovers, rapists and victims different values - OnEffectEnd: Decrease "wear'n'tear_value" by x (or decrease "wear'n'tear" faction rank by 1) - OnEffectEnd: Reapply the spell Setting it up like described in the parentheses may be easier to get it to work. However the little more complex variant has some merits: Other mods can just manipulate "wear'n'tear_value" (that's why it's a property) and e.g. include a potion that reduces it by 1000, healing all but the most severe signs of wear and tear. 24h waiting in-game may reduce "wear'n'tear_value" by 100 and thus directly reduces the "wear'n'tear" faction rank from 2 to 0 (because they together have just a "wear'n'tear_value" of 100) but to reduce "wear'n'tear" faction rank of 10 requires multiple days of rest because its max "wear'n'tear_value" is 1000.
Fotogen Posted January 24, 2014 Posted January 24, 2014 Small note. Faction ranks (faction value) is a number between -128 and 127. Skyrim will not store bigger/smaller numbers. Found that the hard way :/ If you want to store bigger numbers, use Papyrus Util functions (StorageUtil). SL has it builtin. If its just for PC (its just one), then you can just use global variables or quest variables (you'll have atleast one quest anyway for MCM options and to catch SL events).
Recommended Posts
Archived
This topic is now archived and is closed to further replies.