Jump to content

How do I slowly move an object to another object?


VirtualSpace

Recommended Posts

I haven't tried using it before, but maybe PushActorAway.

 

EDIT: Sorry, for some reason I thought you meant move an actor to another actor. According to here

Scripted spells will run on corpses, containers, doors, and furniture, but will simply run through the entire script once, regardless of the duration of the spell. All three blocktypes, ScriptEffectStart, ScriptEffectUpdate, and ScriptEffectFinish will run.

 

That means your spell is going to have to involve using an activator or quest script, since moving something slowly is going to take more than one frame.

 

So your spell script would be something like:

scn Example

Begin ScriptEffectStart

set someactivator.initialize to 1
set someactivator.ref1 to GetSelf
someactivator.MoveTo GetSelf

End

 

Your activator would look something like this:

scn Example2

ref ref1
ref ref2

float distance
float distx
float disty
float distz

short frames
short unitsperframe
short modx
short mody
short modz

Begin GameMode

if initialize == 1
	set distance to ref1.GetDistance ref2
	set frames to 300 ;approximately how many frames it will take for ref1 to get to ref2
	set unitsperframe to ( distance / frames )
	set distx to ref2.GetPosX - ref1.GetPosX
	set disty to ref2.GetPosy - ref1.GetPosY
	set distz to ref2.GetPosZ - ref1.GetPosZ
	set modx to ( distx / frames)
	set mody to ( disty / frames)
	set modz to ( distz / frames)
	set initialize to 2
endif

if initialize == 2
	if (ref1.GetDistance ref2 < unitsperframe)
		set initialize to 0
		Return
	else
		ref1.MoveTo ref1 modx, mody, modz
		Return
	endif
endif

End

 

You'll have to figure out some way to define ref2. Also, it would be more complicated if ref2 is going to be moving around while this happens.

Edited by fg109
Link to comment
Share on other sites

  • Recently Browsing   0 members

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