Jump to content

Recommended Posts

Posted

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.

Posted

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?

  • Recently Browsing   0 members

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