Jump to content

Rotate and Manipulate Objects?


mortalman555

Recommended Posts

I would really like to see a mod that allows you to pick up objects and orient them the way you want them. Right now you can pick up items but you can't really seem to spin them the way I would like to. Being able to change an objects orientation on the x, and y axis would greatly improve players abilities to decorate there houses.

 

Also would it be possible to make a papyrus script that would snap an object to grid while in game?

Link to comment
Share on other sites

Decorator Assistant is supposed to be able to do that, but it requires ScriptDragon.

 

I tried to create my own version that just uses the vanilla script functions, but I can't figure out why it doesn't work right. It doesn't snap to grid and movement is skewed. :(

 

Decorators Assistant doesn't work now after the newest patch broke dragonscript. Even before the newest patch it was buggy at best, and basically unusable.

 

I couldn't even get rotate commands or setangle commands to work in the console!

 

Can you post your scripts? Maybe myself or someone else could improve on them, and get them to work?

Link to comment
Share on other sites

The whole thing is done through menus, since there's no way to assign hotkeys without 3rd party plugins.

 

Quest Script:

 

Scriptname fg109DecoratorAssistantQuestScript extends Quest
{Quest holding the DA settings' values}

Spell property DASpell auto
{Spell for decorating and DA settings}

Int property pOffsetX auto
Int property pOffsetY auto
Int property pOffsetZ auto
Int property aOffsetX auto
Int property aOffsetY auto
Int property aOffsetZ auto


Event OnInit()

Game.GetPlayer().AddSpell(DASpell)

EndEvent

 

 

Magic Effect Script:

 

Scriptname fg109DecoratorAssistantMEScript extends ActiveMagicEffect
{Spell for decorating and DA settings}


fg109DecoratorAssistantQuestScript property DAQuest auto
{Quest holding the DA settings' values}

ReferenceAlias property ItemRef auto
{Alias for the object to be moved}

Message property Settings auto
{MessageBox for main Settings menu}

Message property Types auto
{MessageBox for choosing whether to adjust Position or Angle}

Message property Values01 auto
{MessageBox for inputting values 0 to 4}

Message property Values02 auto
{MessageBox for inputting values 5 to 9}

Int pOffsetX
Int pOffsetY
Int pOffsetZ
Int aOffsetX
Int aOffsetY
Int aOffsetZ

Int choice01 = -1
Int choice02 = -1
Int choice03 = -1
Int choice04 = -1

Bool Registered
ObjectReference GrabRef


Event OnEffectStart(Actor akTarget, Actor akCaster)

if (akTarget.IsSneaking())
	CopyValues(True)
	ShowSettings()
	CopyValues(False)
	Dispel()
else
	RegisterForUpdate(0.1)
	Registered = True
endif

EndEvent


Event OnEffectFinish(Actor akTarget, Actor akCaster)

if (Registered)
	UnregisterForUpdate()
endif

EndEvent


Event OnUpdate()

GrabRef = Game.GetPlayerGrabbedRef()
if (GrabRef)
	ItemRef.ForceRefTo(GrabRef)
	GrabRef.BlockActivation()
	GrabRef.Activate(GrabRef)
	Dispel()
endif

EndEvent


Function CopyValues(Bool QuestToSpell)

if (QuestToSpell)
	pOffsetX = DAQuest.pOffsetX
	pOffsetY = DAQuest.pOffsetY
	pOffsetZ = DAQuest.pOffsetZ
	aOffsetX = DAQuest.aOffsetX
	aOffsetY = DAQuest.aOffsetY
	aOffsetZ = DAQuest.aOffsetZ
else
	DAQuest.pOffsetX = pOffsetX
	DAQuest.pOffsetY = pOffsetY
	DAQuest.pOffsetZ = pOffsetZ
	DAQuest.aOffsetX = aOffsetX
	DAQuest.aOffsetY = aOffsetY
	DAQuest.aOffsetZ = aOffsetZ
endif

EndFunction


Function ShowSettings()

while (choice01 != 0)
	choice01 = Settings.Show(pOffsetX, aOffsetX, pOffsetY, aOffsetY, pOffsetZ, aOffsetZ)
	if (choice01 == 4)
		CopyValues(True)
	elseif (choice01 > 0)
		choice02 = -1
		ShowTypes()
	endif
endwhile

EndFunction


Function ShowTypes()

while (choice02 != 0)
	choice02 = Types.Show(AccessValue(choice01, 1), AccessValue(choice01, 2))
	if (choice02 > 0)
		choice03 = -1
		AccessValue(choice01, choice02, true)
		ShowValues01()
	endif
endwhile

EndFunction


Function ShowValues01()

while (choice03 != 0 && choice03 != 6)
	choice03 = Values01.Show(AccessValue(choice01, choice02))
	if (choice03 != 0 && choice03 != 6)
		AccessValue(choice01, choice02, True, choice03 - 1)
	endif
endwhile
if (choice03 == 6)
	choice04 = -1
	ShowValues02()
endif

EndFunction


Function ShowValues02()

while (choice04 != 0 && choice04 != 6)
	choice04 = Values02.Show(AccessValue(choice01, choice02))
	if (choice04 != 0 && choice04 != 6)
		AccessValue(choice01, choice02, True, choice04 + 4)
	endif
endwhile
if (choice04 == 6)
	choice03 = -1
	ShowValues01()
endif

EndFunction


int Function AccessValue(Int iAxis, Int iType, Bool bModify = False, Int iValue = -1)

if (iAxis == 1)
	if (iType == 1)
		if (bModify)
			if (iValue < 0)
				pOffsetX = 0
			else
				pOffsetX = (10 * pOffsetX) + iValue
				if (pOffsetX > 256)
					pOffsetX = 256
				endif
			endif
		endif
		Return pOffsetX
	else
		if (bModify)
			if (iValue < 0)
				aOffsetX = 0
			else
				aOffsetX = (10 * aOffsetX) + iValue
				if (aOffsetX > 180)
					aOffsetX = 180
				endif
			endif
		endif
		Return aOffsetX
	endif
elseif (iAxis == 2)
	if (iType == 1)
		if (bModify)
			if (iValue < 0)
				pOffsetY = 0
			else
				pOffsetY = (10 * pOffsetY) + iValue
				if (pOffsetY > 256)
					pOffsetY = 256
				endif
			endif
		endif
		Return pOffsetY
	else
		if (bModify)
			if (iValue < 0)
				aOffsetY = 0
			else
				aOffsetY = (10 * aOffsetY) + iValue
				if (aOffsetY > 180)
					aOffsetY = 180
				endif
			endif
		endif
		Return aOffsetY
	endif
else
	if (iType == 1)
		if (bModify)
			if (iValue < 0)
				pOffsetZ = 0
			else
				pOffsetZ = (10 * pOffsetZ) + iValue
				if (pOffsetZ > 256)
					pOffsetZ = 256
				endif
			endif
		endif
		Return pOffsetZ
	else
		if (bModify)
			if (iValue < 0)
				aOffsetZ = 0
			else
				aOffsetZ = (10 * aOffsetZ) + iValue
				if (aOffsetZ > 180)
					aOffsetZ = 180
				endif
			endif
		endif
		Return aOffsetZ
	endif
endif

EndFunction

 

 

ReferenceAlias Script:

 

Scriptname fg109DecoratorAssistantRAScript extends ReferenceAlias


fg109DecoratorAssistantQuestScript property DAQuest auto
{Quest holding the settings' values}

Message property BaseMenu auto
{MessageBox for main Movement menu}

Message property PosMenu auto
{MessageBox for choosing movement}

Message property AngleMenu auto
{MessageBox for choosing rotation}

ObjectReference ItemRef
Bool Locked
Int pOffsetX
Int pOffsetY
Int pOffsetZ
Int aOffsetX
Int aOffsetY
Int aOffsetZ
Int choice01
Int choice02
Int choice03


Event OnActivate(ObjectReference akActivateRef)

ItemRef = GetReference()
if (ItemRef != akActivateRef)
	Return
endif
ItemRef.SetMotionType(ItemRef.Motion_KeyFramed, false)
Locked = True
pOffsetX = DAQuest.pOffsetX
pOffsetY = DAQuest.pOffsetY
pOffsetZ = DAQuest.pOffsetZ
aOffsetX = DAQuest.aOffsetX
aOffsetY = DAQuest.aOffsetY
aOffsetZ = DAQuest.aOffsetZ
choice01 = -1
ShowBaseMenu()
ItemRef.BlockActivation(false)
ItemRef = None
Clear()

EndEvent


Function ShowBaseMenu()

while (choice01 != 0)
	choice01 = BaseMenu.Show()
	if (choice01 == 1)
		choice02 = -1
		ShowPosMenu()
	elseif (choice01 == 2)
		choice03 = -1
		ShowAngleMenu()
	elseif (choice01 == 3)
		SnapToGrid()
	elseif (choice01 == 4)
		if (Locked)
			ItemRef.SetMotionType(ItemRef.Motion_Dynamic, false)
		else
			ItemRef.SetMotionType(ItemRef.Motion_KeyFramed, false)
		endif
	endif
endwhile

EndFunction


Function SnapToGrid()

int TempX = (ItemRef.X / pOffsetX) as Int
TempX *= pOffsetX
int TempY = (ItemRef.Y / pOffsetY) as Int
TempY *= pOffsetY
int TempZ = (ItemRef.Z / pOffsetZ) as Int
TempZ *= pOffsetZ
ItemRef.SetPosition(TempX, TempY, TempZ)
TempX = (ItemRef.GetAngleX() / aOffsetX) as Int
TempX *= aOffsetX
TempY = (ItemRef.GetAngleY() / aOffsetY) as Int
TempY *= aOffsetY
TempZ = (ItemRef.GetAngleZ() / aOffsetZ) as Int
TempZ *= aOffsetZ
ItemRef.SetAngle(TempX, TempY, TempZ)

EndFunction


Function ShowPosMenu()

while (choice02 != 0)
	choice02 = PosMenu.Show(ItemRef.X, ItemRef.Y, ItemRef.Z)
	if (choice02 == 1)
		ItemRef.MoveTo(ItemRef, pOffsetX, 0, 0)
	elseif (choice02 == 2)
		ItemRef.MoveTo(ItemRef, -pOffsetX, 0, 0)
	elseif (choice02 == 3)
		ItemRef.MoveTo(ItemRef, 0, pOffsetY, 0)
	elseif (choice02 == 4)
		ItemRef.MoveTo(ItemRef, 0, -pOffsetY, 0)
	elseif (choice02 == 5)
		ItemRef.MoveTo(ItemRef, 0, 0, pOffsetZ)
	elseif (choice02 == 6)
		ItemRef.MoveTo(ItemRef, 0, 0, -pOffsetZ)
	endif
endwhile

EndFunction


Function ShowAngleMenu()

float TempX
float TempY
float TempZ
while (choice03 != 0)
	TempX = ItemRef.GetAngleX()
	TempY = ItemRef.GetAngleY()
	TempZ = ItemRef.GetAngleZ()
	choice03 = AngleMenu.Show(TempX, TempY, TempZ)
	if (choice03 == 1)
		ItemRef.SetAngle(TempX + aOffsetX, TempY, TempZ)
	elseif (choice03 == 2)
		ItemRef.SetAngle(TempX - aOffsetX, TempY, TempZ)
	elseif (choice03 == 3)
		ItemRef.SetAngle(TempX, TempY + aOffsetY, TempZ)
	elseif (choice03 == 4)
		ItemRef.SetAngle(TempX, TempY - aOffsetY, TempZ)
	elseif (choice03 == 5)
		ItemRef.SetAngle(TempX, TempY, TempZ + aOffsetZ)
	elseif (choice03 == 6)
		ItemRef.SetAngle(TempX, TempY, TempZ - aOffsetZ)
	endif
endwhile

EndFunction

 

 

Esp, pex, psc files:

[Removed Link]

 

To change the settings, activate lesser power while sneaking.

To 'decorate' an object, activate lesser power then grab object within 10 seconds (grab by holding down activate key)

 

EDIT: Thought of a way to get it sort of working on my own. Uploaded the file to here.

Edited by fg109
Link to comment
Share on other sites

  • 2 years later...
  • Recently Browsing   0 members

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