Jump to content

[LE] Move actor to location


Recommended Posts

Before I delve into a rough way of doing this, I'm looking for a clean and clever way of doing it. I'm trying to make a spell that hits an actor then moves said actor above and infront of the PC. My way I'm thinking is when the projectiles hits, it places an activator(I don't know how to position it, help) above and infront of the PC and then the actor is moved to the activator creating the desired effect. The activator will have a self cleaning script fire after 2s.

Any help is appreciated.

 

This moves the actor into the player, it's a more simple way of doing it but it doesn't allow me to move the actor above and infront. I can't open the MoveTo() page, it's the only one that's down for me so I don't know what's possible with it. http://www.creationkit.com/index.php?title=MoveTo_-_ObjectReference

Scriptname AceMoveActorScript extends ActiveMagicEffect  


Event OnEffectStart(Actor akTarget, Actor akCaster)

	
        akTarget.MoveTo(akCaster, 0, 0, 350)

EndEvent

Edit: Looks like MoveTo already has the function to move the actor where I want! But I don't know what the order is or what does what. If anyone has the info just paste it here and it'll be enough for me to do it. This one particular page has been down for a while, at least a month.

 

I revised the script. It puts the actor above the PC but not infront. Playing with the two 0's isn't relative to the direction the caster is facing.

 

Tried this too, it also doesn't take into account the direction the player is facing:

Event OnEffectStart(Actor akTarget, Actor akCaster)

	akTarget.SetPosition(akCaster.GetPositionX()+0, akCaster.GetPositionY()+0, akCaster.GetPositionZ()+350)

EndEvent

By the way, which is better, setposition or moveto?

Edited by Elias555
Link to comment
Share on other sites

Here's what I use to move Inigo to a spot right in front of the player. It also turns him to face player.

float az = PlayerRef.GetAngleZ()
InigoRef.MoveTo(PlayerRef, 80.0*Math.sin(az),  80.0*Math.cos(az), 10.0, 0)
InigoRef.Disable()
InigoRef.SetAngle(0, 0, az + 180)
InigoRef.Enable()

The game will force the character back to ground level if it is too far away. If you're planning to have the character appear higher then drop you might need to place an invisible platform at the spot, move the npc just above it, wait briefly, then disable the platform.

 

If you place a platform using those commands then you should be able to use a simple MoveTo to get the NPC onto it, wait about 0.1 seconds, and then disable the platform. I would use a single persistent object for the platform. You can move and set its angle and enable it to start then disable at the end. That way it can be reused every time.

Link to comment
Share on other sites

That worked perfectly. I was always bad with sin, cos, and tan. I'm usually hesitant to use something I don't understand but I'll give this one a pass. I did try playing with GetAngle but I was using random numbers. Thanks for the help. Also thanks for your work with Rycon!

 

Small addition I didn't perceive was going to be an issue so I didn't ask, but how can I make the target not land on their feet? I tried checking the knock down flags under the explosion which I was banking on working but that just lays the target on the ground and they get stuck in that position. Also tried adding this thinking it would set their angle to upside down but that didn't work either.

	akTarget.SetAngle(180, 180, az - 360)
Edited by Elias555
Link to comment
Share on other sites

  • Recently Browsing   0 members

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