Jump to content

Recommended Posts

Posted

Im working on a spell pack mod, and one of the spells is controlling an npc for 30s.

heres my script:

Scriptname MindControlScript extends ActiveMagicEffect  

Event OnEffectStart(Actor Target, Actor Caster)
   Game.DisablePlayerControls(true, true, true, true, true, true, true)
   Target.EnableAI(False) 
   Target.SetPlayerControls(True)
   Game.SetCameraTarget(Target)
    EndEvent

Event OnEffectFinish(Actor Target, Actor Caster)
   Target.SetPlayerControls(False)
   Target.EnableAI(True) 
   Game.EnablePlayerControls()  
   Game.SetCameraTarget(Game.GetPlayer())
   EndEvent

The camera switches, my player stops moving, but I cant move my new npc body. It just literally freezez in its current pose, no movement at all. Ill just stare at a statue for 30s then everything goes back to normal, the npc continues doing whatever it was doing.

Posted

Few things, you are disabling all player controls of course you can't move.

 

I think for this you needed order:

 

Game.SetCameraTarget(Target)
Target.SetPlayerControls(True)
Target.EnableAI(False)

Target.EnableAI(true)

 

And to disable almost all controls except movement.

 

But I did this about a month ago I don't remember exactly.

Posted

Well my player isnt supposed to move so thats good, but my target npc doesnt move either. Its not just that it doesnt move, it literally freezes in a pose , like a statue.

Also why did you disable then imedietly enable the targets AI?

Anyway Ill try the code you wrote. tnx

Posted

Ok yes you can remove the (false) one so it's:

 

Game.SetCameraTarget(Target)
Target.SetPlayerControls(True)

Target.EnableAI(true)

 

The order is important. If you disable movement control then you will disable movement control and can't move. So you have to do that part some other way. Also you need to make the player follow the target otherwise it won't load cells if you move around with the NPC. One way would be to actually use script to make player follow but I think a better way might be to make the player invisible and disable AI so he will stand like that in freeze pose and use "MoveTo" to teleport player near the NPC every few seconds so cells load properly and you can't see player or hear him move. Not sure I'm just thinking out loud I didn't test any of this maybe I'm giving you bad advice here :D

 

Good luck :)

Posted

I was expecting you'd remove the (true) one. I mean shouldnt the AI be disabled if youre controlling an npc. Maybe thats why it freezes in place. but doesnt the function DisablePlayerControls() only work for the player.

Since you said cells wont load does that mean that while controlling the npc you cant enter interiors either. I was thinking of limiting the distance you could move away from the player to fix that one but the interiors may be a problem.

Ill test the new code now, thanks :thumbsup:

Posted

If AI is disabled you can't move the NPC. Disabling controls does disable player controls because you are the player so it disables your controls! NPC doesn't have a keyboard :P

 

Most of the interior problems can be solved by disabling "activation" controls with disableplayercontrols but that still leaves stuff like caves where you can just walk in. I never tested this so no idea what would happen.

Posted

I just tested the code and this is what i found out:

disabling the AI is what makes them freeze

enabling it makes them stand and talk random stuff, but not move, because setplayercontrols is true

they cant move because I disabled the playercontrols, but enabling them will make my player move with the target

so I need to disable just the players controls but...

here it says that the setplayercontrols(false) function should NOT be used on the player

 

what do i do now?

Posted

Couple of things that come to mind:

 

1. disable AI on player

 

2. paralyze player or any other effect that doesn't allow you to move normally

 

3. set player speed to 0

 

4. make player use an invisible furniture

 

Would also be helpful if you made player invisible during all of this. :)

  • Recently Browsing   0 members

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