Jump to content

Furniture Alignment Correction for NPC´s (No esp) 4.0.0


2 Screenshots

About This 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
		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)
		maxIterator+=1
		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!

Edited by Pamatronic


What's New in Version 4.0.0

Released

-Fixed offsets not working

-added a more brute-force approach to increase succesrate for NPC´s

-added safeguards to prevent it from clashing with certain other ZaZ scripts.

-Removed Leftover Debug messages

-Added additional Safeguard to prevent excessive papyrus load.



×
×
  • 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