Did you try out SplineTranslateTo()? Given it's name, I assume it's the one to use for non-linear motion, but I haven't looked into it since I haven't had a need to even use TranslateTo().
Thank you, This command(TranslateTo) is suitable for linear motion, but I wanted to use a non-linear (which was very easy to do in TES4) PS In the end I got, but velocity of the actors is very slow, but without jerks.
If you're trying to move things around, you should be using TranslateTo to give longer term goals for the movement and not try to micromanage things frame by frame. The position detecting functions are some of the more expensive ones, so if you have an entire array of things you're trying to monitor and manage then it's no surprise to me that you can't do an update more than about twice a second.
From my results, just gathering the X, Y, Z positions and angles for 5 or 6 actors could take up about 0.4 seconds leaving almost no time for giving new movement instructions.
No, you can't run your scripts every frame, that very idea doesn't make sense with the new Papyrus scripting system. You should NOT be trying to use constant updates. If you really want to constantly monitor something you're better off putting your code into an infinite while loop that tries to run constantly than trying to force really fast updates.
The OnUpdate event is meant for things that run every few minutes (or maybe a frequent as every few seconds) but not for something that needs to run constantly.
Skyrim's scripting system is event based, so with very few exceptions you should be able to find a way to have the game tell you when something interesting has happened rather than using an update every fraction of a second to check for it yourself.
If you really must use the polling technique, then you might find that a loop like this will work better than messing with updates. while true if IsKeyPressed(myKey) InterestingKeyHandlingFunction() endif Utility.Wait(0.02) endwhile
The Wait is important and you should still set it as large as possible to still accomplish your goal. 0.02 the absolute smallest you should consider using. If you're watching for something that can happen in menu mode you'll want to use WaitMenuMode() instead of Wait().
In Oblivion, Morrowind, and the Fallouts scripts were limited to only run one pass during a frame, and if there wasn't enough time available the script might even skip a frame or two. With Skyrim, individual scripts are completely disconnected from the frames-per-second mechanisms. Instead they just get a certain time slice. And every event or function call can potentially create a new copy of the script. So if you register for regular update calls you can end up with 100s or 1000s of copies of your script all running at the same time! It's much better to just let the one copy keep running for as long as it needs to.
Just wondering: I asked on the forum but did not get a clear answer: Is it possible to execute a (Quest) script every frame, (When I put the Update time less 0.4, starting horrible lag and the script is not working properly, but with time more than 0.4 - it works fine) ==== The content of the script: -An array of actors and their coordinates -Mat-function -Moving-actors -CPU 4GHz
I honestly never have noticed the difference in speed, before i thought that since these functions does the same thing, there should be no biggy... maybe just strains the CPU abit :|
10 comments
It is suitable for a single curve (I think)
but not for continuous parametric calculation of the coordinates.
In any case, thank you
This command(TranslateTo) is suitable for linear motion, but I wanted to use a non-linear (which was very easy to do in TES4)
PS In the end I got, but velocity of the actors is very slow, but without jerks.
From my results, just gathering the X, Y, Z positions and angles for 5 or 6 actors could take up about 0.4 seconds leaving almost no time for giving new movement instructions.
No, you can't run your scripts every frame, that very idea doesn't make sense with the new Papyrus scripting system. You should NOT be trying to use constant updates. If you really want to constantly monitor something you're better off putting your code into an infinite while loop that tries to run constantly than trying to force really fast updates.
The OnUpdate event is meant for things that run every few minutes (or maybe a frequent as every few seconds) but not for something that needs to run constantly.
Skyrim's scripting system is event based, so with very few exceptions you should be able to find a way to have the game tell you when something interesting has happened rather than using an update every fraction of a second to check for it yourself.
If you really must use the polling technique, then you might find that a loop like this will work better than messing with updates.
while true
if IsKeyPressed(myKey)
InterestingKeyHandlingFunction()
endif
Utility.Wait(0.02)
endwhile
The Wait is important and you should still set it as large as possible to still accomplish your goal. 0.02 the absolute smallest you should consider using. If you're watching for something that can happen in menu mode you'll want to use WaitMenuMode() instead of Wait().
In Oblivion, Morrowind, and the Fallouts scripts were limited to only run one pass during a frame, and if there wasn't enough time available the script might even skip a frame or two. With Skyrim, individual scripts are completely disconnected from the frames-per-second mechanisms. Instead they just get a certain time slice. And every event or function call can potentially create a new copy of the script. So if you register for regular update calls you can end up with 100s or 1000s of copies of your script all running at the same time! It's much better to just let the one copy keep running for as long as it needs to.
I asked on the forum but did not get a clear answer:
Is it possible to execute a (Quest) script every frame,
(When I put the Update time less 0.4, starting horrible lag and the script is not working properly, but with time more than 0.4 - it works fine)
====
The content of the script:
-An array of actors and their coordinates
-Mat-function
-Moving-actors
-CPU 4GHz