Talk:SetPlayerControls - Actor

From the CreationKit Wiki
Jump to navigation Jump to search

Broken Method?[edit source]

I have tried to use this method, but cannot get it to work at all. At the best, it freezes the targeted NPC. Am I using this wrong? Or is this method broken? Or what else? --Nivek 06:50, 15 February 2012 (EST)

Can you show your script? I have not tried this function but maybe you have some error in the script. Or the function just doesn't work. ;)
Dog 07:20, 15 February 2012 (EST)
Here's the script. I have it attached to a magic effect, and the effect works fine, I tried a Kill command in it and it works. I've also tried disabling AI, removing the target from combat, different orders, many things, but still the same thing happens. --Nivek 18:06, 15 February 2012 (EST)
Scriptname PossessionScript extends ActiveMagicEffect  
	EVENT OnEffectStart(Actor Target, Actor Caster)	
		if Caster.GetPlayerControls()
			Caster.SetPlayerControls(false)
			Target.SetPlayerControls(true)
		endIf

	ENDEVENT

	Event OnEffectFinish(Actor Target, Actor Caster)		
		if Target.GetPlayerControls()
			Target.SetPlayerControls(false)
			Caster.SetPlayerControls(true)
		endIf
		
	ENDEVENT
There has been discussion here[1], concluding that this method does not work until fixed. --Nivek 06:00, 16 February 2012 (EST)