Jump to content

Can I make anobject follow player?


Recommended Posts

Late at night and this just popped into my head, so not a lot of thought behind it. Can I make an object, moveable static in this case, follow the player? Could I run a AI package on it?

Probably total crap what I'm thinking about but who knows.

Link to comment
Share on other sites

You cannot run an AI package on anything except actors.

What you can do:

A) Make that object an actor.

Example:

Take the wisp creature and either delete the mesh or make it invisible and place the object in its place and create a new Race and actor with that mesh.


B) Make the object "moveable static" and.

Be sure that its 'FadeNode' is at ground level and then move ONLY the mesh + collision just a little over the player's head.

Or in the axis and height that will place the object behind the player (or where ever you want), remember that the object's "Translate Target" > 'Fade Node' will always be at the Player's Node, which is at the player's feet center (ground level).


Now make a script for that object that will run 2 functions.

Example:



Event OnLoad() or on activate if you make it an activator
RegisterForSingleUpdate(1.0)
EndEvent

Event OnUpdate()
Self.TranslateToRef(PlayerREF, 1000)
RegisterForSingleUpdate(1.0)
EndEvent



If you make it an Activator or Activatable by another Script such as a spell which will send an Activate event to the "Movable Static", which is prferable for a number of reasons such as controlling it or activating / deactivating it.

* Or let your imagination go wild...

Example:



Auto State StartTranslate
Event OnActivate(ObjectReference akActionRef)
if (akActionRef == Game.GetPlayer())
GoToState("StopTranslate")
RegisterForSingleUpdate(1.0)
EndIf
EndEvent
EndState


State StopTranslate
Event OnActivate(ObjectReference akActionRef)
if (akActionRef == Game.GetPlayer())
UnregisterForUpdate()
GoToState("StartTranslate")
EndIf
EndEvent
EndState

Event OnUpdate()
Self.TranslateToRef(PlayerREF, 1000) ;The speed needs testing
RegisterForSingleUpdate(1.0)
EndEvent



* Or you can put the "Translate" function on a "While Loop" that is controlled by a global that you can define the ON/OFF state.


Now you have an object that is constantly moving to and with the player.


I hope it helps.


EDIT: a bunch of typos.... stupid keyboard....

Edited by maxarturo
Link to comment
Share on other sites

  • 3 weeks later...
  • Recently Browsing   0 members

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