Snowraptor Posted March 8, 2012 Share Posted March 8, 2012 Scriptname AddTheEvilPerk extends Actor perk property EvilPerk auto Event OnSpellCast(Form akSpell) Spell spellCast = akSpell as spell perk PerkWanted = EvilPerk as perk if spellCast if Game.GetPlayer().HasPerk(PerkWanted) debug.messagebox("detected that perk is known") Else debug.messagebox("this will now add the perk") Game.GetPlayer().AddPerk(PerkWanted) endif else Debug.messagebox("Something is wrong") endIf endEventI have the script attached to the player. When any spell is used the event activates correctly. Then it checks if the player has the PerkWanted perk. If they don't then the perk is added. Somewhere in that process something isn't working. Either HasPerk is always returning a false or AddPerk is adding nothing or both. Link to comment Share on other sites More sharing options...
tunaisafish Posted March 8, 2012 Share Posted March 8, 2012 Put the vars into your debug messages so you can see what they contain debug.messagebox("this will now add the perk: " + PerkWanted) If it's NONE then did you remember to set the property in the CK? Link to comment Share on other sites More sharing options...
Snowraptor Posted March 8, 2012 Author Share Posted March 8, 2012 I had thought setting the property in the script itself was enough, I was wrong it works now. Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts