Suggestions for a background script

Post » Thu Oct 11, 2012 10:59 am

So I just had the idea for a mod which will add weather, time, and racially influenced bonuses to magical abilities of the player (maybe NPCs as well, if it doesn't prove too difficult).

Here's what I have planned so far:

Time:Dawn - mysticismDay - alterationDusk - mysticismNight - conjuration (closeness to Oblivion)Weather:clear - restoration + magicka bonus (if day - effect of magnus)cloudyfoggy - illusionovercastrain - restorationthunder - destructionash - destructionblightsnowblizzard - destruction
Nords = extra destruction bonus in blizzardArgonians = extra magicka bonus in rainHigh Elves = extra alteration bonus during the dayDark Elves = extra destruction bonus in ash stormsWood Elves = extra illusion bonus in fogOrcs = noneKhajiit = extra mysticism bonus at dawn and duskBretons = extra restoration bonus in clear weatherImperial = noneRedguard = none

My initial (and really only thought) so far is to handle this with a global script, but I'm worried about how badly scripting this functionality might hit performance. Scripting and clever modding tricks aren't my expertise. So I wanted to ask here: does anyone have suggestions for alternative methods I could use? Or nice clean scripts which get this functionality done with minimal effect on FPS?

And a bonus question is, how difficult or costly (performance-wise) would it be to add this functionality to NPCs?

Thank you very much!
-Melchior
User avatar
Emma Louise Adams
 
Posts: 3527
Joined: Wed Jun 28, 2006 4:15 pm

Post » Thu Oct 11, 2012 1:06 pm

You could make a pretty efficient single global script to do this for the player. Just add a framecounter or timer so you only execute the body of the script every once in a while, perhaps every 30 frames or 1 second or something like that. I think that kind of script would have no noticeable affect on performance.

I don't know about adding it to all NPCs, that sounds like you'd need MWSE functionality, and I don't know about that.
User avatar
Emily Jones
 
Posts: 3425
Joined: Mon Jul 17, 2006 3:33 pm

Post » Thu Oct 11, 2012 8:04 pm

Well that's good news to hear for sure! I was worried about it affecting performance significantly. I'm not familiar with how to implement a framecounter or timer to limit execution of the script though.

I think I'll take a crack at writing the baseline script and then maybe ask about optimizing it with a timer. Be prepared for a messy script!

Bummer about the NPCs though, I wasn't sure about that but now that you mention it I think you're right since I believe a global script has to have a reference "player->" or whatever. Oh well, this is mainly focused on the player anyway, I don't think minorly boosting stats on NPCs would be that noticeable to the player anyway.
User avatar
Kate Murrell
 
Posts: 3537
Joined: Mon Oct 16, 2006 4:02 am

Post » Fri Oct 12, 2012 12:28 am

I'm not familiar with how to implement a framecounter or timer to limit execution of the script though.
Easy as pie:
Begin myscriptshort framecounterset framecounter to framecounter + 1if ( framecounter < 30 )	returnendifset framecounter to 0;;; Body of script goes hereEnd myscript

don't think minorly boosting stats on NPCs would be that noticeable to the player anyway.
That would be my opinion too.
User avatar
Tiff Clark
 
Posts: 3297
Joined: Wed Aug 09, 2006 2:23 am

Post » Thu Oct 11, 2012 11:55 am

Woot! That'll help a lot, this type of script doesn't need to be run that often since weather changes take time and obviously so do time changes o_O

I'll be sure to come back for help if I get stumped.
User avatar
Bird
 
Posts: 3492
Joined: Fri Nov 30, 2007 12:45 am


Return to III - Morrowind