Getting a summoned object to follow the player?

Post » Mon Nov 19, 2012 1:25 am

I'm interested in adding some new Illusion spells to the game, and I had the crazy idea of including one that disguises the player (or a target) as a harmless butterfly (because nobody ever suspects the butterfly! Muhahaha).

To do this, I figured I'd give the spell two effects: one that summons the butterfly (probably as a static object), and one that makes the target invisible. The spell would of course be dispelled as soon as the target does anything, just like an invisibility spell.

But I'm gonna go out on a limb here and say that the butterfly static would stay still, which is obviously not ideal.

Is there any way to make the butterfly follow the target around? (I'm leaning towards doing whatever makes the prison cart follow the horse at the beginning of the game, but I'm not really clear on how that works)
User avatar
Manuela Ribeiro Pereira
 
Posts: 3423
Joined: Fri Nov 17, 2006 10:24 pm

Post » Mon Nov 19, 2012 9:32 am

Butterflies are actually activators, not statics. Which isn't to say you couldn't make a static that looked like a butterfly.
Anyway, what you'll want to do is this:

GetReference().TranslateTo(PlayerRef.GetPositionX() + (125*Math.sin(PlayerREF.GetAngleZ())), PlayerRef.GetPositionY() + (125*(Math.cos(PlayerREF.GetAngleZ()))), PlayerRef.GetPositionZ() +90, 0, 0, 0, 1024, 1)

That should put the butterfly where you want it. (Replace GetReference with the butterfly's property obviously)
Then just put it in an OnTranslationComplete event. It will loop and translate to you, and then on complete it will do it again.
And again
and again.

Little trick I came up with that works nicely.
User avatar
Scott Clemmons
 
Posts: 3333
Joined: Sun Sep 16, 2007 5:35 pm

Post » Sun Nov 18, 2012 8:49 pm

wow ... took me 5 minutes to write next to nothing ... old and slow :woot:
User avatar
Rudi Carter
 
Posts: 3365
Joined: Fri Sep 01, 2006 11:09 pm

Post » Mon Nov 19, 2012 9:48 am

Butterflies are actually activators, not statics. Which isn't to say you couldn't make a static that looked like a butterfly.
That's the plan! :D
Anyway, what you'll want to do is this:

GetReference().TranslateTo(PlayerRef.GetPositionX() + (125*Math.sin(PlayerREF.GetAngleZ())), PlayerRef.GetPositionY() + (125*(Math.cos(PlayerREF.GetAngleZ()))), PlayerRef.GetPositionZ() +90, 0, 0, 0, 1024, 1)

That should put the butterfly where you want it. (Replace GetReference with the butterfly's property obviously)
Then just put it in an OnTranslationComplete event. It will loop and translate to you, and then on complete it will do it again.
And again
and again.

Little trick I came up with that works nicely.

And thanks. That's awesome.
User avatar
James Potter
 
Posts: 3418
Joined: Sat Jul 07, 2007 11:40 am


Return to V - Skyrim