Jump to content

Furniture Alignment Correction for NPC´s (No esp)


Recommended Posts

Furniture Alignment Correction for NPC´s (No esp)

View File

This is a very small script which can be attached to furnitures, to correct the position of NPC´s entering said furnitures.

If you have ever used something from Zap, you should know the problem.

 

this mod ads the script "pamaFurnitureAlignmentHelper"

attach it to any furniture added by a mod, and the problem should be gone.

 

install with mod manager of your choice or drop manually into data folder (Or your own mod Folder if you want to make new furnitures yourself.)

 

The propertys can safely be ignored. only use them for Furnitures which have An Offset to their entry points.

(vast majority of Furnitures don't have one. IF they do, you can find the values for them with nifscope in their respective .nif Files)

 

Full sourceCode:

Spoiler
Scriptname pamaFurnitureAlignmentHelper extends ObjectReference  
{Created by Pamatronic - Can Be attached To furnitures to correct FNIS misalignment}

float property EntryPointOffset_X Auto
float property EntryPointOffset_Y Auto
float property EntryPointOffset_Rotation Auto

Actor Victim
int maxIterator

Event OnActivate(ObjectReference akActionRef)
    if ((akActionRef as actor).getSitState()!=4) || akActionRef != game.getPlayer()
        Victim=akActionref as Actor
        maxIterator=0    
        RegisterForSingleUpdate(0.1)
    endIf
EndEvent

Event OnUpdate()
    if (Victim.getPositionX()!=translateLocal(EntryPointOffset_X, EntryPointOffset_Y, true) || Victim.getPositionY()!=translateLocal(EntryPointOffset_X, EntryPointOffset_Y, false)) && victim.getSitstate()==3 && maxIterator <=15
        debug.notification("not yet Aligned")
        Victim.translateTo(translateLocal(EntryPointOffset_X, EntryPointOffset_Y, true), translateLocal(EntryPointOffset_X, EntryPointOffset_Y, false), Z, self.getAngleX(), self.getAngleY(), self.getAngleZ()+EntryPointOffset_Rotation, 50.0, 0.0)
        RegisterForSingleUpdate(0.5)
    else
        victim=none
    endIf
EndEvent

float Function translateLocal(float OffsetX, float OffsetY, bool XorY)
    ;XorY=true >> calculate x offset / XorY=true >> calculate y offset
    float tmpRotation =self.getAngleZ()+(90.0)

    if XorY
        return X+(math.sin(tmpRotation)*OffsetX)+ (math.cos(tmpRotation)*OffsetY)    
    else
        return Y+(math.sin(tmpRotation)*-(OffsetY))+ (math.cos(tmpRotation)*OffsetX)    
    EndIf
EndFunction

 

 

enjoy!


 

Link to comment

PAMA, I´m very much thankful that you´re so much busy with your stuff and cutting it perfectly well to the different missing aspects of ZAP.

I will now go for a walk and later I will test it....anyway, if it holds what it promisses, you again put ZAP again to another degree of game-fun for

thousands of gamers.

To me it seems again very weird, why in the past such stuff has not been added to all animation-mods, which add new furnitures to skyrim.

?

 

 

Link to comment

If this really work for every furniture (that I am currently don't believe - because of the fixed offset) it should definitely become part of ZAP - but at the end I think this is a work-around for broken entry animations.

A better solution would be to see if the entry animation is broken or something interrupts the animation before it reaches the final stage.

 

One problem could be the timing with offset animations: ZAP restraints are enchanted with an effect which sets the offset animation. There is a condition that should prevent the effect from being active while being in a furniture but in some cases it could happen that the animations overlap - the effect disrupts the furniture entry animation.

 

This is why I remove all ZAP restraints from my NPCs before they enters a furniture - and another reason why I would prefer AA animations for restraints: they don't need scripts and effects...

Link to comment
1 hour ago, zaira said:

If this really work for every furniture (that I am currently don't believe - because of the fixed offset) it should definitely become part of ZAP - but at the end I think this is a work-around for broken entry animations.

A better solution would be to see if the entry animation is broken or something interrupts the animation before it reaches the final stage.

 

One problem could be the timing with offset animations: ZAP restraints are enchanted with an effect which sets the offset animation. There is a condition that should prevent the effect from being active while being in a furniture but in some cases it could happen that the animations overlap - the effect disrupts the furniture entry animation.

 

This is why I remove all ZAP restraints from my NPCs before they enters a furniture - and another reason why I would prefer AA animations for restraints: they don't need scripts and effects...

 

 

I will test ZAP later without FNIS. Maybe that is leading to some new experiences/aspects.

Link to comment
15 hours ago, zaira said:

One problem could be the timing with offset animations: ZAP restraints are enchanted with an effect which sets the offset animation. There is a condition that should prevent the effect from being active while being in a furniture but in some cases it could happen that the animations overlap - the effect disrupts the furniture entry animation.

 

Are you sure Offset Animations can interfere with regular furniture Anims? Maybe I´m just lucky, but i cant for the life of me remember an occasion when this happened ?.

And since the Misalignment will frequently occur, even without any zap restraints equipped, i don't think its connected to them.

 

What i believe to be the reason (speculation incoming) :

Furniture Animations will by nature start while not fully Aligned with the Furniture in question, this is even true for Vanilla Furnitures,

BUT:

Vanilla AnimEvents call some sort of alignment script. (some higher game function).

And FNIS simply cannot replicate this function call, so we are left with only the Animation starting, even when the positions dont match.

 

some Anecdotal evidence (o rather some observations which support that theory):

while making the chopping Block for my deadly Furnitures mod, it was rather notable that the executioner and the Guard would often start their respective idle Animations while still being 1-2 meters off their correct positions. After their Idles started, they would slowly be translated to the correct positions.

 

my script just aims to replicate what the animevent should do. But doing it via papyrus is of course a pretty RoundAbout and inefficient way of doing it.

 

I do hope that Nemesis offers a more satisfying and permanent solution for this problem.

In Fact, the guy who makes Nemesis also made the TK Dogde mod, and there he managed to integrate translate commands into the animevents, so im pretty optimistic here.

 

But as long as we are stuck with FNIS, i do believe this small papyrus based solution is the easiest one.

Link to comment
15 hours ago, t.ara said:

We should try with this script (I did that and set the time higher), so if you raise up the time for wait, that the script is able to pull the NPC to a wished target point, but this point is NOT always the exact STARTING point in congruence with the enter-behavior-which is mostly not a "standing-still for NPCs...beside different other "douche-bag"-NPCs can collide the way, when the NPC came into the furniture.

rather than increasing the wait time, try decreasing the translantion speed (I personally wouldn't go any slower since this is already only half the speed of the regular alignment translation)

 

utility.wait(0.2)
akActionRef.translateTo(X+EntryPointOffset_X, Y+EntryPointOffset_Y, Z+EntryPointOffset_Z, self.getAngleX(), self.getAngleY(), self.getAngleZ()+EntryPointOffset_Rotation, 20.0, 0.0)

 

calling the TranslateTo() command will stop anything dead in their tracks and will therefore eliminate any leftover inertia which would usually cause misalignment.

it will also disable the NPC´s collision while being translated, so this cant be thrown of by another NPC bumping into the first actor.

 

 

I did Add propertys to Adress the offset entry points.

Unfortunately, they have to be entered manually, since there´s no papyrus way to read them from the .nif Files

But since most Furnitures dont have an offset anyway, this shouldnt be much of a Deal.

 

As for the Sexlab comparisions.

I think you are slightly on the Holzweg in this regard.

Sexlab just teleports two actors to the same point (usually the position of the scenes primary actor) and starts a paired animation. I don't really see how i can get anything usefull for a furniture out of this :/

 

Link to comment
2 hours ago, Pamatronic said:

 

Are you sure Offset Animations can interfere with regular furniture Anims? Maybe I´m just lucky, but i cant for the life of me remember an occasion when this happened ?.

And since the Misalignment will frequently occur, even without any zap restraints equipped, i don't think its connected to them.

 

What i believe to be the reason (speculation incoming) :

Furniture Animations will by nature start while not fully Aligned with the Furniture in question, this is even true for Vanilla Furnitures,

BUT:

Vanilla AnimEvents call some sort of alignment script. (some higher game function).

And FNIS simply cannot replicate this function call, so we are left with only the Animation starting, even when the positions dont match.

 

some Anecdotal evidence (o rather some observations which support that theory):

while making the chopping Block for my deadly Furnitures mod, it was rather notable that the executioner and the Guard would often start their respective idle Animations while still being 1-2 meters off their correct positions. After their Idles started, they would slowly be translated to the correct positions.

 

my script just aims to replicate what the animevent should do. But doing it via papyrus is of course a pretty RoundAbout and inefficient way of doing it.

 

I do hope that Nemesis offers a more satisfying and permanent solution for this problem.

In Fact, the guy who makes Nemesis also made the TK Dogde mod, and there he managed to integrate translate commands into the animevents, so im pretty optimistic here.

 

But as long as we are stuck with FNIS, i do believe this small papyrus based solution is the easiest one.

Me, I personally are lucky with this feature as it is visibly pushing the NPC MORE "time" closer to the wanted or desired point where the animation takes part.

I also do not "mix" between offset and furniture-animations-anyway under the skyrim behavior is the stuff rock solid and with FNIS it is simply NOT. Also not for the player.

About nememsis, I will check it AFTER ZAP is done-we can do it together than later and compare results if you like.

It´s simply the way, how the sidechain to the existing animations are technically made. Normally it is NOT possible to add new animations to skyrim by using the official animation behavior because it has to be edited by using the dedicated software - and you need the existing work-files of bethesda to add new stuff. We do not have them and to hack the animation-system seems from the point of view of FNIS a genious example with some restrictions. This restrictions we have now simply in form of the missalignment and some other smaller restrictions/artefacts.

And the script is not harming the player to use the furniture at least-which is not almost the same thing-between player and NPC.

Those offset animations are used for only the arm-poses like carrying a basket while walking or for the torch-anyway try to mount the horse with a torch and look what happens. Even Bethesda forgot to add some details to have a round and proper working gameplay. Or they simply ignored this and thought that no gamer is climbing on the horse by using the torch....if I would have set the behavior-path, I would ALWAYs let overrun a new offset with en existing animation at all. To restrict this is from my point of view more easy, than to merge offsets onto dedicated animations. Lot of modders have proofed new attack animations and put them to the game by using nemesis. There´s still the open question, how the quality of nemesis´s animation-side-chain into skyrim is, or how deep they enter into the structure of the original behavior-files.

I do not have so enormous NPC-missalignment when they use furnitures and what they do I simply accept because it´s a typical feature of a HACKED animation side-chain. Let´s face it and GULP the reality!!!

Link to comment
2 hours ago, Pamatronic said:

rather than increasing the wait time, try decreasing the translantion speed (I personally wouldn't go any slower since this is already only half the speed of the regular alignment translation)

 

utility.wait(0.2)
akActionRef.translateTo(X+EntryPointOffset_X, Y+EntryPointOffset_Y, Z+EntryPointOffset_Z, self.getAngleX(), self.getAngleY(), self.getAngleZ()+EntryPointOffset_Rotation, 20.0, 0.0)

 

calling the TranslateTo() command will stop anything dead in their tracks and will therefore eliminate any leftover inertia which would usually cause misalignment.

it will also disable the NPC´s collision while being translated, so this cant be thrown of by another NPC bumping into the first actor.

 

 

I did Add propertys to Adress the offset entry points.

Unfortunately, they have to be entered manually, since there´s no papyrus way to read them from the .nif Files

But since most Furnitures dont have an offset anyway, this shouldnt be much of a Deal.

 

As for the Sexlab comparisions.

I think you are slightly on the Holzweg in this regard.

Sexlab just teleports two actors to the same point (usually the position of the scenes primary actor) and starts a paired animation. I don't really see how i can get anything usefull for a furniture out of this :/

 

As I mentioned this is NO CRITICS, I only want to share my thought about it. If things are laying different, it´s a pity and a sign that we have too less possibilities.

Critics to papyrus: To me it is also papyrus, which is no professional "language" at all. I mean it´s logical structure of task and commands-if I would create something like that, I would do it much different.

It´s a good thing to be in this case on the HOLZWEG, this is again showing how much RELATIVE the other stuff is adding animations into the game-if you create REAL furnitures, you DEAL with the COMMON game-engine. On the last end, we have created the stuff in the official way and maybe we can compensate some small artefacts by a little trick like this alignment helper. I´m quite satisfied with the existing result-all is fine:-))

 

Again, furnitures have no offset animation-they use IDLES, which normally are edited by using HAT, which cuts the ideal tracking of an idle and melt them together, so that the animation is becoming ROUND and realistic, In such a case you can merge the enter animation (maybe go backwards to a bondage-pole) with the loop phase, The engine is doing the "jumps from one to another if it is not coming by the behavior itself. OFFSETS are for me only arm poses-arms only-not head-not neck....arms:-)...no spine...:-)

 

I do not know if an NPC is straight walking over the entry-point of a furniture-from what I see in game, they do not care about-not under FNIS. They come quite close to the furniture-mostly from aside and then they start their animation of the LOOP/ENTRY...and then they glitch into the furniture. Depending on other collisions it maybe is succedding or not.

What I saw is, that the script is pushing them in a second periode more close to the wanted position.

I´ll add in any case every update you will bring into ZAP 9-absolutely;-))

 

Some more ideas:

From my point of view it´s only possible to make an NPC use a furniture correctly, if you STOP , initialize, and lead the action to the point, which is the point of the furniture-marker.

Like a "T-POSE-recall" (without a t-pose) before the animation begins. Maybe it is helping that the entry-point is always the root-node 000 on the gizmo.

And if such a point is not locate-able....we could create a fanatasy-000?

Or maybe we can shutter the animation into parts-we quantizise the animation and with every shutter, stop-go-stop we have the NPC more and more quiet for a more succesful entry....

I only spread some ideas...You can think about if it´s possible, or if not. And maybe in future we have again a more tight "behavior" for FNIS-furnitures:-)))

 

 

Link to comment
2 hours ago, t.ara said:

What I saw is, that the script is pushing them in a second periode more close to the wanted position.

The "second periode" is a result of the increased wait timer. I´m not so sure why you increased this value, but if you leave it at the default 0.2,

The entire thing looks like a (slighly slower version) of the natural process.

Link to comment
2 hours ago, t.ara said:

From my point of view it´s only possible to make an NPC use a furniture correctly, if you STOP , initialize, and lead the action to the point, which is the point of the furniture-marker.

thats exactly whats happening here. translateTo() stoppst every movement before it moves the actor to the correct position.

Link to comment
2 hours ago, t.ara said:

And if such a point is not locate-able....we could create a fanatasy-000?

I think just adding the offsets manually via the propertys is the most realistic approach.

If you feel really bored, you could add niNodes to the positions of the entry points. NiNodes can be located by papyrus. But this would likely be a much greater workload.

Link to comment
4 hours ago, t.ara said:

This gamebryo-files have this furniture NODE-maybe this node can be also detected by a scripting-command?

I can get the position of the furniture node, yes.

But the actual position of the entry marker is stored as an vector-array, which is attached to this node.

Unfortunately, there's no way for me to read this data with papyrus.

Link to comment
3 hours ago, Pamatronic said:

I can get the position of the furniture node, yes.

But the actual position of the entry marker is stored as an vector-array, which is attached to this node.

Unfortunately, there's no way for me to read this data with papyrus.

So this is again something what is with papyrus not working. It means simply for a working gameplay, this has never been used because animations are working under the animation behavior perfectly well and under FNIS they simply can not reach the overall precission. In this case it will stay unchange-able as long I use FNIS.

Link to comment
  • 8 months later...
  • 1 year later...
22 minutes ago, Pamatronic said:

Its a modders resource. You need the Creation Kit or TESVEdit to attach this script to a furniture.

I have a skyrim with 1000 mods, and learned a bit. If I decided to install creationkit and learn it, how long would it take me to do it? roughly so

Edited by Prest
Link to comment
8 minutes ago, Prest said:

I have a skyrim with 1000 mods, and learned a bit. If I decided to install creationkit and learn it, how long would it take me to do it? roughly so

about 10 seconds (Plus the 2 hours waiting time while the CK loads).

Link to comment
  • 2 weeks later...
10 hours ago, Gudulba said:

does this script help alignment when the NPCs enters the furniture for the first time

probably

 

10 hours ago, Gudulba said:

would it also run when loading a save game and entering a cell with tied up NPCs?

probably not

Link to comment
  • 6 months later...
On 6/16/2020 at 10:59 PM, zaira said:

If this really work for every furniture (that I am currently don't believe - because of the fixed offset) it should definitely become part of ZAP - but at the end I think this is a work-around for broken entry animations.

A better solution would be to see if the entry animation is broken or something interrupts the animation before it reaches the final stage.

 

One problem could be the timing with offset animations: ZAP restraints are enchanted with an effect which sets the offset animation. There is a condition that should prevent the effect from being active while being in a furniture but in some cases it could happen that the animations overlap - the effect disrupts the furniture entry animation.

 

This is why I remove all ZAP restraints from my NPCs before they enters a furniture - and another reason why I would prefer AA animations for restraints: they don't need scripts and effects...

This is all not a problem of ZAP, this is one problem of FNIS, aside of some others, how it brings in the stuff into the skyrim-behavior-graph.

And this is no guess, this is tested and checked.

This can only being solved by making changes inside of FNIS.

Or alternatively you use NEMESIS. But this way is more HARDER and it affords more knowledge about the animation-behavior-structure of the game. By this method we maybe can add 20-40 furnitures at all-but those would be rock solid and skyrim-compatible.

 

And more harder is to use NO other third party hack for animation-integration and do it manually all alone which is the most professional way. But then your creations become incompatible to all other users-means that way is only for a private-skyrim-modding interesting because you can not use FNIS and NEMESIS anymore.

 

The most easy way is how I mentioned lot of month ago to use simply single idles and and let those run by a tiny script with an activator, like it is working in ZAP 9 (there are two examples available) and inside of DD. This technique is very easy and can be used in every mod at once without lot of knowledge.

 

That ´s it.

 

Link to comment
9 hours ago, t.ara said:

This is not another try of solution by scripting for a problem, which (again /also) is under the hood of FNIS.

This script can not solve the problems.

 

Its a serviceable workaround.
While its true that the root of the problem lies within FNIS, as long as no one fixes that, theres no harm in trying different solutions.
And Since no one has ever complained about misalignment with my devices (which use integrated variants of this script), I feel relatively confident in saying that it does its job quite well.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use