Jump to content

A script to take control of an npc?


Surjamte

Recommended Posts

Hey, I am trying to do this:

 

1. Player presses a button/activates and activator

2. The control switches to an npc. (That can be controlled and moved just like you would normally move your character).

 

To do this am trying to use this function: SetPlayerControls(true)

 

I tried this script for example:

 

Scriptname SGENSwitchPlayerControlScript extends Actor
Actor Property ControlTarget Auto
Event OnActivate(ObjectReference akActionRef)
ControlTarget.SetPlayerControls(true)
endevent
But nothing happened. Anyone know how to make something like this work?
Link to comment
Share on other sites

Is the script being used by the button? If so, try extending the script from an ObjectReference instead, like so:

Scriptname SGENSwitchPlayerControlScript extends ObjectReference
{Button activates control of NPC}

Actor Property ControlTarget Auto  
 
Event OnActivate(ObjectReference akActionRef)
    ControlTarget.SetPlayerControls(true)
endevent

You may also want to disable movement controls on the Player actor themselves since you may end up moving both the Player actor and the NPC at the same time (unless that is intended).

Link to comment
Share on other sites

  • Recently Browsing   0 members

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