Removing a power from the player when a perk is added.

Post » Sun Nov 18, 2012 3:15 pm

I can't seem to figure this one out.

I added a power via a perk that upgrades. When the player purchases the new perk, I'd like it to remove the old power from the list of available spells. I have no idea what even is triggered when a perk is received, so I'm having trouble getting the Game.GetPlayer().RemoveSpell to fire.

Here's the code I'm using now, in which I was attempting, unsuccessfully, to call an OnUpdate event to trigger the removal.

Scriptname CZFoxPerkScript extends Perk  Function WhoCares()RegisterForSingleUpdate(1)EndFunctionEvent OnUpdate()Game.GetPlayer().RemoveSpell(CZSummonDogSpell)EndEventSPELL Property CZSummonDogSpell  Auto  

No idea what else to try, and I'm totally open to suggestions here, as I'm not a newbie at scripting, but I'm also not really experienced or anything.

Thanks.
User avatar
Lily Evans
 
Posts: 3401
Joined: Thu Aug 31, 2006 11:10 am

Post » Sun Nov 18, 2012 11:40 am

you can effectively do this without a script by placing a condition on the power you want to "remove"

HasPerk YourNewPerk == 0

once that perk is bought, the power can no longer be used because the condition will now return false.

IMO it is better to try using conditions first, rather than brute-force via script
User avatar
Crystal Clear
 
Posts: 3552
Joined: Wed Aug 09, 2006 4:42 am

Post » Sun Nov 18, 2012 2:58 pm

you can effectively do this without a script by placing a condition on the power you want to "remove"

HasPerk YourNewPerk == 0

once that perk is bought, the power can no longer be used because the condition will now return false.

IMO it is better to try using conditions first, rather than brute-force via script

I feel dumb now, as this is a much easier way of doing exactly what I wanted to do.

Thanks a ton.
User avatar
Kristina Campbell
 
Posts: 3512
Joined: Sun Oct 15, 2006 7:08 am


Return to V - Skyrim