Jump to content

[LE] Magic Effect Papyrus Script to Disable Certain Player Controls


demnish

Recommended Posts

SOLVED
Here is the script if anyone needs it.
It is to be used to prevent certain player controls during spell duration: (Just remove the SetActorValues if you don't need them)

Scriptname zeebTestPowerScript extends ActiveMagicEffect  

Bool Property Movement = false auto
Bool Property Fighting = false auto
Bool Property CamSwitch = false auto
Bool Property Looking = false auto
Bool Property Sneaking = false auto
Bool Property Menu = false auto
Bool Property Activate = false auto
Bool Property JournalTabs = false auto

EVENT OnEffectStart(Actor akTarget, Actor akCaster)	
	Game.DisablePlayerControls(Movement, Fighting, CamSwitch, Looking, Sneaking, Menu, Activate, JournalTabs)
	Game.GetPlayer().SetActorValue("WaterWalking", 1)
	Game.GetPlayer().SetActorValue("Invisibility", 1)
	Game.GetPlayer().SetActorValue("MovementNoiseMult", 0)
ENDEVENT

EVENT OnEffectFinish(Actor akTarget, Actor akCaster)
	Game.EnablePlayerControls(true, true, true, true, true, true, true, true)
	Game.GetPlayer().SetActorValue("WaterWalking", 0)
	Game.GetPlayer().SetActorValue("Invisibility", 0)
	Game.GetPlayer().SetActorValue("MovementNoiseMult", 1)
ENDEVENT

Thanks to Rasikko for helping out! :smile:

Edited by demnish
Link to comment
Share on other sites

Setting the actor value invisibility to 1 is the same as the archetype, just without the deactivation on activation.

 

Check "Recover" so that when the effect ends, any changes are reverted.

Thank you for your answer!

 

EDIT:

F my life, I've been looking for EnablePlayerControls but didn't find it, now when I was looking through a random function, there it is at the bottom.

Seems that my script now works as intended!

 

Thanks Rasikko :D

 

 

I'll post here again if I encounter any further problems with this script.

Edited by demnish
Link to comment
Share on other sites

  • Recently Browsing   0 members

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