Give player a Power (Script)

Post » Tue Jun 17, 2014 7:17 pm

I want to give a player the ability to use a specific Power.

I tried to make a button to do this but it doesn't work.

The script is:

scriptName defaultDweButtonScript extends objectReferencesound property QSTAstrolabeButtonPressX autoobjectReference property objSelf auto hiddenSPELL Property spell_frenziedregen  Autoevent onCellAttach()	objSelf = self as objectReference	playAnimation("Open")endEventauto state open	event onActivate(objectReference akActivator)		goToState("waiting")		playAnimationAndWait("Trigger01","done")		if QSTAstrolabeButtonPressX			QSTAstrolabeButtonPressX.play(objSelf)		endif			; My Code: Give player Frenzied Regeneration		Game.GetPlayer().AddSpell(spell_frenziedregen, TRUE)		goToState("Open")	endEventendStatestate waitingendState

And the property spell_frenziedregen is set to the power's id in the properties section of the button.

I have put in a debug message to ensure that the script is running at the right line and that was all good so I can only see 2 options:

- The most likely is that AddSpell doesn't work on Powers

- Otherwise it could be that creation kit isn't setting up my property the way it should be.

User avatar
Lloyd Muldowney
 
Posts: 3497
Joined: Wed May 23, 2007 2:08 pm

Return to V - Skyrim