Lyncor Posted February 14, 2017 Share Posted February 14, 2017 (edited) First up, I wasn't sure whether this belongs in this section or in mod requests, so I apologise if I put it in the wrong place. I've been playing modded Skyrim on and off since it came out. Before that, it was Oblivion. Love 'em both. Along the way, I've learned to do a bunch of things and made a few personal mods of my own - mostly game effect changes, custom merged patches and the like. My primary tool thus far has been TES5Edit. The barrier I haven't cracked yet, though, is scripting. I work as a professional software developer and I'm comfortable reading Papyrus scripts to figure out what they do (and even spot bugs in them), but last time I tried to get a custom script actually running within the game context I got frustrated trying to bind it to a quest in the creation kit and got distracted with other things. I have an idea for a mod that I've wanted to make for quite a while, and I've thought a bunch about the implementation of it. It's a gameplay change that would allow for Magicka, Stamina and Shout Cooldown (maybe even Health!) to be interchangeable resources with configurable "value" ratios and flow directions. Effectively, this would allow for neat mechanics like shouts consuming magicka/stamina - or mages not being able to cast at full throttle after sprinting all of their stamina away. But here's the thing. While I'm totally happy to contribute design/scripting/programming expertise, I'd prefer not to grind through documentation to learn the ins and outs of the creation kit, how to bind scripts to quests, etc. The simple reason is that it's not really my learning style. In my day to day job, I do a lot of pair programming and find it really valuable. There are excellent tools for it, like Screenhero, that I'm well versed in. So my question is: Would anybody like to pair up with me? I'd love to learn from you, and maybe you can learn from me, and maybe we can make something neat together. :laugh: Edited February 14, 2017 by Lyncor Link to comment Share on other sites More sharing options...
simtam Posted February 14, 2017 Share Posted February 14, 2017 Well, I don't know if you noticed that already, that for a language with so much object-oriented flair, Papyrus does not have a "new" operator that would construct new objects. Most scripts are bound to game data though. What kind of game data they match depends on what script they inherit from. Here's the convenient list http://www.creationkit.com/index.php?title=Category:Script_Objects You can start with attaching a script to something simpler than a quest. I'd personally would start with a book, such that reading it (Event OnRead()) causes the notification (Debug.Notification("...")) to show up in the corner of the screen. Link to comment Share on other sites More sharing options...
Lyncor Posted February 14, 2017 Author Share Posted February 14, 2017 Hey, thanks! I appreciate the tip :) My end goal for this would be to have the script run once per (interval) and update the current Magicka / Stamina / Shout Cooldown values of the player according to configurable rules. If it ends up performing well enough, I'd love to have it run on all nearby NPCs too; it's always nice when mods have consistent behaviour in this regard. I guess my next questions are: - What's the best way to have a script like this running in the game context? Is a quest the way to do it or is there a better way?- Is there a commonly accepted value for (interval) that runs well within the engine? I wouldn't want it to be any longer than one second. Link to comment Share on other sites More sharing options...
simtam Posted February 15, 2017 Share Posted February 15, 2017 Have your script use OnUpdate and RegisterForSingleUpdate (rather than RegisterForUpdate). It's good to make a quest, for your own convenience, with Allow Repeated Stages - then you can put any scripting code in quest stage fragments and use it for testing and debugging purposes. Try not to make the delay shorter than what it takes to finish your script routine. A lot of functions that you call in Papyrus will return and resume your script only in the next frame. So, thirty such function calls in a row, and you end up with code that takes from start to completion more than 1 second on a system with less than 30fps. That alone won't stress the system much, though; however if you have every NPC around execute it, then I guess it may clog the engine. You can measure script lag with Convenient Horses mod or any other mod that let you measure the actual time between RegisterForSingleUpdate(0) and subsequent OnUpdate(). Link to comment Share on other sites More sharing options...
Lyncor Posted February 16, 2017 Author Share Posted February 16, 2017 Wonderful, thank you for the advice! :) Link to comment Share on other sites More sharing options...
Recommended Posts