(Skyrim) How to make a script run every frame

Post » Thu Jun 21, 2012 8:46 pm

How to make a script run every frame - as it did in Oblivion fQuestDelayTime=0.01.

In Skyrim, if update time is less than the 0.25 sec, begins a terrible lag and glitches,
especially for the command setposition

For example - the same script^
=======================
http://www.youtube.com/watch?v=dXhunIEGzPo&list=UUOe0CdXSgsJ8u8_wghxWfvQ&index=1&feature=plcp
User avatar
Ria dell
 
Posts: 3430
Joined: Sun Jun 25, 2006 4:03 pm

Post » Thu Jun 21, 2012 9:41 pm

Post the script? There's bound to be a more resource friendly way to go about it, like using http://www.creationkit.com/TranslateTo_-_ObjectReference or http://www.creationkit.com/TranslateToRef_-_ObjectReference every few seconds.
User avatar
Add Meeh
 
Posts: 3326
Joined: Sat Jan 06, 2007 8:09 am

Post » Thu Jun 21, 2012 8:52 am

Post the script? There's bound to be a more resource friendly way to go about it, like using http://www.creationkit.com/TranslateTo_-_ObjectReference or http://www.creationkit.com/TranslateToRef_-_ObjectReference every few seconds.
It is interesting, I'll try,

but still, the speed of the scripts too low ...
User avatar
Rhysa Hughes
 
Posts: 3438
Joined: Thu Nov 23, 2006 3:00 pm

Post » Thu Jun 21, 2012 10:27 am

Oftentimes it's not the speed of Papyrus or the game-engine, but other mods tying up the threads with cyclic errors. Check your Papyrus log for errors... and test your mod without running any other mod. I've been successful getting a script to fire at about 0.02sec (using strategic counters inside loops with debug messages I was able to 'clock' how fast my system fires), but that's under ideal conditions (no other mods, low detail levels).. and it STILL didn't make the movement smooth because of fading in and out (using moveto).

But I agree, translateTo is a much better way of doing it - you just have to experiment with the distance it travels and the speed. ALL efforts I tried at getting ANYTHING to move frame by frame (like we did in Obliv) failed. TransTo is the only thing that gets it moving smoothly - and it requires less frequent firing time too... especially if the object is moving quite fast (ie: moving further each iteration).

http://www.gamesas.com/topic/1370110-impact-of-system-stress-scripting-errors-on-game-performance/
User avatar
Julie Serebrekoff
 
Posts: 3359
Joined: Sun Dec 24, 2006 4:41 am

Post » Thu Jun 21, 2012 9:26 am

Threading may defeat you ... And as said, not just the threading of your stuff, but the threading of vanilla game actions and of other mods.

Threading removes timing ... basically ... stuff goes off and processes when it can ... Only LATENT functions (read up on them in the wiki) force everything else to wait while their actions are carried out.
User avatar
Ash
 
Posts: 3392
Joined: Tue Jun 13, 2006 8:59 am

Post » Thu Jun 21, 2012 7:21 am

Welllll... I'm not sure that's entirely accurate. I'm under the assumption that latent functions suspend certain things, but not the entire game's scripting functions. I believe it only suspends operations associated with that particular script/quest. It IS something to keep in mind though - as you can use them to force certain things.

If your system is sub-par, yes, threading essentially destroys/removes timing... simply because the system can't keep up. But Papyrus and the threads themselves can run VERY fast and be accurately timed... given you eliminate all 'interference' from errors tying up the finite number of threads and processor time. Of course, there will be a limit as to how fast your individual system CAN fire it, as well as what fps rate you're getting in-game. Less than 30fps WILL cause timing issues - if your script uses a small enough increment.

I actually just found a way to get my Gokstad ship mod sailing smooth with an fps rate as low as 20. Scripting an ACTOR to move smoothly is another story... that's why I had to implement an in-game switch Users can flip to enable that 'low-perf' mode; which sets an activator/static as a vehicle. Removing the actor's movement in the script allows VERY smooth operation; but without the setVehicle, one needs a med-high end system to avoid timing issues (my ship studders uncontrollably). [in regular/high-perf mode, Players can use weapons and magic to attack things while sailing in real-time... but setVehicle doesn't allow weapons, so that's one caveat]
User avatar
Tamara Primo
 
Posts: 3483
Joined: Fri Jul 28, 2006 7:15 am

Post » Thu Jun 21, 2012 7:30 pm

Thanks to all.
1/The system is more or less normal,
4GHz CPU 2 cores, but these actors controls 3 quests with scripts - (different mods) one master and two dependent.

2/Actually, I need to move the five actors on the nonlinear trajectory quickly (spiral)
In any case, I get them to move very slowly:
http://www.youtube.com/watch?v=pVMjDq50ZiE&list=UUOe0CdXSgsJ8u8_wghxWfvQ&index=1&feature=plcp
User avatar
J.P loves
 
Posts: 3487
Joined: Thu Jun 21, 2007 9:03 am

Post » Thu Jun 21, 2012 6:20 pm

I've got some experience with making objects spiral and orbit via scripting. The trick is to calculate the next target point AFTER starting the translation to the current one, and always fire the next translation and calculation using the onTranslationAlmostComplete event. And, obviously, the less floating point work you have to do with sin and cos, the better. I can make object spin around a target fairly quickly this way, though if there's a lot of other stuff going on they'll still stop for a split second in their orbits.
User avatar
courtnay
 
Posts: 3412
Joined: Sun Nov 05, 2006 8:49 pm

Post » Thu Jun 21, 2012 10:23 am

I've got some experience with making objects spiral and orbit via scripting.

Yes, you certainly do. Have you released EM: Whirlwind yet?!!? *taps foot impatiently*

:biggrin:
User avatar
Carlos Rojas
 
Posts: 3391
Joined: Thu Aug 16, 2007 11:19 am

Post » Thu Jun 21, 2012 3:33 pm

Yes, you certainly do. Have you released EM: Whirlwind yet?!!? *taps foot impatiently*

:biggrin:
Hah, actually my orbiting script isn't used for Whirlwind... there are waaaay too many other scripts and targets for the orbiter stuff to work there. No, the orbiters are an idea I've been toying with for a long time without knowing quite what to do with them. Something like this (you can see them orbiting at the beginning): http://www.youtube.com/watch?v=vZtOkcjfw2o
User avatar
Marie Maillos
 
Posts: 3403
Joined: Wed Mar 21, 2007 4:39 pm

Post » Thu Jun 21, 2012 10:27 pm

Hah, actually my orbiting script isn't used for Whirlwind... there are waaaay to many other scripts and targets for the orbiter stuff to work there. No, the orbiters are an idea I've been toying with for a long time without knowing quite what to do with them. Something like this (you can see them orbiting at the beginning): http://www.youtube.com/watch?v=vZtOkcjfw2o

Wow! You come up with some really great effect ideas. This one sorta reminds me of the Shaman LIghtning/Water shields in World of Warcraft. Will continue to check your Nexus profile daily. :)
User avatar
Jani Eayon
 
Posts: 3435
Joined: Sun Mar 25, 2007 12:19 pm


Return to V - Skyrim