Jump to content

Issues with AddPerk and/or HasPerk


Snowraptor

Recommended Posts

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
endEvent

I 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

  • Recently Browsing   0 members

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