Jump to content

Need help scripting


Extragorey

Recommended Posts

I'm trying to write a script which automatically grants you the "[Rank] [Magic School]" perk without requiring a perk point when you reach the required level (with the exception of the first "Novice" perk, which you'd still have to buy).

For example, you've bought the Novice Destruction perk and you get 25 destruction. The "Apprentice Destruction" perk would automatically be bought.

The script should also be retro-active; that is, when you install the mod and you're already 78 Destruction, you should automatically get the Apprentice, Adept, and Expert Destruction perks.

So I wrote this script, and thought it was pretty good. Then none of the functions worked! Which is weird for me, since they're mostly just console commands.

So here's the script below. I eventually settled for a script which runs every 5 seconds, because I couldn't find one to run upon levelling a skill.

The first part uses one kind of PerkID, and the rest of the script uses another. I wasn't sure which one it accepted, so I tried both.

 

 

 

Scriptname JulesPerkRankAssign extends Form

{Automatically assigns the appropriate Rank perks upon leveling up in a magic school, updates every 5 seconds}

 

Function JulesUpdateGameTimeFunction()

RegisterForUpdateGameTime(0.00139)

endFunction

 

Event OnUpdateGameTime() ; this event occurs every 5.004 seconds of game time

if player.getav Destruction >= 25 && player.hasperk DestructionApprentice25 == 0 && player.hasperk DestructionNovice00 == 1

player.addperk DestructionApprentice25

Debug.MessageBox("Congratulations! You have been awarded the Apprentice Destruction perk for reaching 25 Destruction."

endIf

if player.getav Destruction >= 50 && player.hasperk DestructionAdept50 == 0 && player.hasperk DestructionApprentice25 == 1

player.addperk DestructionAdept50

Debug.MessageBox("Congratulations! You have been awarded the Adept Destruction perk for reaching 50 Destruction."

endIf

if player.getav Destruction >= 75 && player.hasperk DestructionExpert75 == 0 && player.hasperk DestructionAdept50 == 1

player.addperk DestructionExpert75

Debug.MessageBox("Congratulations! You have been awarded the Expert Destruction perk for reaching 75 Destruction."

endIf

if player.getav Destruction >= 100 && player.hasperk DestructionMasterl00 == 0 && player.hasperk DestructionExpert75 == 1

player.addperk DestructionMasterl00

Debug.MessageBox("Congratulations! You have been awarded the Master Destruction perk for reaching 100 Destruction."

endIf

 

 

if player.getav Conjuration >= 25 && player.hasperk 000C44BB == 0 && player.hasperk 000F2CA7 == 1

player.addperk 000C44BB

Debug.MessageBox("Congratulations! You have been awarded the Apprentice Conjuration perk for reaching 25 Conjuration."

endIf

if player.getav Conjuration >= 50 && player.hasperk 000C44BC == 0 && player.hasperk 000C44BB == 1

player.addperk 000C44BC

Debug.MessageBox("Congratulations! You have been awarded the Adept Conjuration perk for reaching 50 Conjuration."

endIf

if player.getav Conjuration >= 75 && player.hasperk 000C44BD == 0 && player.hasperk 000C44BC == 1

player.addperk 000C44BD

Debug.MessageBox("Congratulations! You have been awarded the Expert Conjuration perk for reaching 75 Conjuration."

endIf

if player.getav Conjuration >= 100 && player.hasperk 000C44BE == 0 && player.hasperk 000C44BD == 1

player.addperk 000C44BE

Debug.MessageBox("Congratulations! You have been awarded the Master Conjuration perk for reaching 100 Conjuration."

endIf

 

 

if player.getav Illusion >= 25 && player.hasperk 000C44C3 == 0 && player.hasperk 000F2CA9 == 1

player.addperk 000C44C3

Debug.MessageBox("Congratulations! You have been awarded the Apprentice Illusion perk for reaching 25 Illusion."

endIf

if player.getav Illusion >= 50 && player.hasperk 000C44C4 == 0 && player.hasperk 000C44C3 == 1

player.addperk 000C44C4

Debug.MessageBox("Congratulations! You have been awarded the Adept Illusion perk for reaching 50 Illusion."

endIf

if player.getav Illusion >= 75 && player.hasperk 000C44C5 == 0 && player.hasperk 000C44C4 == 1

player.addperk 000C44C5

Debug.MessageBox("Congratulations! You have been awarded the Expert Illusion perk for reaching 75 Illusion."

endIf

if player.getav Illusion >= 100 && player.hasperk 000C44C6 == 0 && player.hasperk 000C44C5 == 1

player.addperk 000C44C6

Debug.MessageBox("Congratulations! You have been awarded the Master Illusion perk for reaching 100 Illusion."

endIf

 

 

if player.getav Restoration >= 25 && player.hasperk 000C44C7 == 0 && player.hasperk 000F2CAA == 1

player.addperk 000C44C7

Debug.MessageBox("Congratulations! You have been awarded the Apprentice Restoration perk for reaching 25 Restoration."

endIf

if player.getav Restoration >= 50 && player.hasperk 000C44C8 == 0 && player.hasperk 000C44C7 == 1

player.addperk 000C44C8

Debug.MessageBox("Congratulations! You have been awarded the Adept Restoration perk for reaching 50 Restoration."

endIf

if player.getav Restoration >= 75 && player.hasperk 000C44C9 == 0 && player.hasperk 000C44C8 == 1

player.addperk 000C44C9

Debug.MessageBox("Congratulations! You have been awarded the Expert Restoration perk for reaching 75 Restoration."

endIf

if player.getav Restoration >= 100 && player.hasperk 000C44CA == 0 && player.hasperk 000C44C9 == 1

player.addperk 000C44CA

Debug.MessageBox("Congratulations! You have been awarded the Master Restoration perk for reaching 100 Restoration."

endIf

 

 

if player.getav Alteration >= 25 && player.hasperk 000C44B7 == 0 && player.hasperk 000F2CA6 == 1

player.addperk 000C44B7

Debug.MessageBox("Congratulations! You have been awarded the Apprentice Alteration perk for reaching 25 Alteration."

endIf

if player.getav Alteration >= 50 && player.hasperk 000C44B8 == 0 && player.hasperk 000C44B7 == 1

player.addperk 000C44B8

Debug.MessageBox("Congratulations! You have been awarded the Adept Alteration perk for reaching 50 Alteration."

endIf

if player.getav Alteration >= 75 && player.hasperk 000C44B9 == 0 && player.hasperk 000C44B8 == 1

player.addperk 000C44B9

Debug.MessageBox("Congratulations! You have been awarded the Expert Alteration perk for reaching 75 Alteration."

endIf

if player.getav Alteration >= 100 && player.hasperk 000C44BA == 0 && player.hasperk 000C44B9 == 1

player.addperk 000C44BA

Debug.MessageBox("Congratulations! You have been awarded the Master Alteration perk for reaching 100 Alteration."

endIf

 

 

if player.hasperk 000C44C2 == 1 && player.hasperk 000C44BE == 1 && player.hasperk 000C44C6 == 1 && player.hasperk 000C44CA == 1 && player.hasperk 000C44BA == 1

UnregisterForUpdateGameTime()

endIf

endEvent

 

; UnregisterForUpdateGameTime() ; when we're done with it, make sure to unregister

 

; 000F2CA8 DestructionNovice00 Novice Destruction

; 000C44BF DestructionApprentice25 Apprentice Destruction

; 000C44C0 DestructionAdept50 Adept Destruction

; 000C44C1 DestructionExpert75 Expert Destruction

; 000C44C2 DestructionMaster100 Master Destruction

 

; 000F2CA7 ConjurationNovice00 Novice Conjuration

; 000C44BB ConjurationApprentice25 Apprentice Conjuration

; 000C44BC ConjurationAdept50 Adept Conjuration

; 000C44BD ConjurationExpert75 Expert Conjuration

; 000C44BE ConjurationMaster100 Master Conjuration

 

; 000F2CA9 IllusionNovice00 Novice Illusion

; 000C44C3 IllusionApprentice25 Apprentice Illusion

; 000C44C4 IllusionAdept50 Adept Illusion

; 000C44C5 IllusionExpert75 Expert Illusion

; 000C44C6 IllusionMaster100 Master Illusion

 

; 000F2CAA RestorationNovice00 Novice Restoration

; 000C44C7 RestorationApprentice25 Apprentice Restoration

; 000C44C8 RestorationAdept50 Adept Restoration

; 000C44C9 RestorationExpert75 Expert Restoration

; 000C44CA RestorationMaster100 Master Restoration

 

; 000F2CA6 AlterationNovice00 Novice Alteration

; 000C44B7 AlterationApprentice25 Apprentice Alteration

; 000C44B8 AlterationAdept50 Adept Alteration

; 000C44B9 AlterationExpert75 Expert Alteration

; 000C44BA AlterationMaster100 Master Alteration

 

 

 

Any help would be appreciated. And the Creation Kit wiki is pitifully lacking in scripting tutorials.

Link to comment
Share on other sites

I wonder how long it'll take before all the programmers in the modding community become fully savvy with the new scripting language...

 

How are you registering to begin with? who calls this function?

 

Function JulesUpdateGameTimeFunction() 
RegisterForUpdateGameTime(0.00139)
endFunction

 

I think your problem is just that you have the above wrapped up in a function. No one is calling that funciton so you never get registered. Try something like....

 

RegisterForUpdateGameTime(.1)

Event OnUpdateGameTime() ; this event occurs every 5.004 seconds of game time 
if player.getav Destruction >= 25 && player.hasperk DestructionApprentice25 == 0 && player.hasperk DestructionNovice00 == 1
player.addperk DestructionApprentice25
Debug.MessageBox("Congratulations! You have been awarded the Apprentice Destruction perk for reaching 25 Destruction."
endIf
....snip....
UnregisterForUpdateGameTime()
endIf
endEvent

Link to comment
Share on other sites

I think your problem is just that you have the above wrapped up in a function. No one is calling that funciton so you never get registered. Try something like....

 

Thanks for your reply. And yes, that would have been a problem had I actually gotten around to playtesting, so thanks for pointing that out.

However, my problem was that the script wouldn't actually compile because it claimed the "addperk" and "hasperk" functions didn't exist - though they work perfectly fine in the ingame console.

Do you know why this might be?

 

I'm not worried about where to call the script at this point; I'm just trying to get the level & perk detection and perk adding working properly.

If needs be, I can always add the script to a spell effect or something.

Edited by Teh Masterer
Link to comment
Share on other sites

I think your problem is just that you have the above wrapped up in a function. No one is calling that funciton so you never get registered. Try something like....

 

Thanks for your reply. And yes, that would have been a problem had I actually gotten around to playtesting, so thanks for pointing that out.

However, my problem was that the script wouldn't actually compile because it claimed the "addperk" and "hasperk" functions didn't exist - though they work perfectly fine in the ingame console.

Do you know why this might be?

 

I'm not worried about where to call the script at this point; I'm just trying to get the level & perk detection and perk adding working properly.

If needs be, I can always add the script to a spell effect or something.

 

I'm pretty sure Papyrus doesn't support or in any way use console commands.

Papyrus is an object oriented language, which is great.

 

You need to get a reference to the Player Actor.

Which is done like so:

Game.GetPlayer()

 

You can do this:

Game.GetPlayer().AddPerk(DestructionApprentice25)

instead of

player.addperk DestructionApprentice25

 

Docs:

http://www.creationkit.com/AddPerk_-_Actor

http://www.creationkit.com/GetPlayer_-_Game

 

Hope that helps you on your way.

Edited by grey79
Link to comment
Share on other sites

Hope that helps you on your way.

Thank you, it did indeed. Still one more problem, however. The compiler doesn't recognise the skill names or perk names.

Here's my code as it currently stands:

(I had to put RegisterForUpdateGameTime() in an event bracket)

 

 

Scriptname JulesPerkRankAssign extends Form
{Automatically assigns the appropriate Rank perks upon leveling up in a magic schoolor the Lockpicking skill, updates every 5 seconds}

Event OnLoad()
RegisterForUpdateGameTime(0.00139)
endEvent

Event OnUpdateGameTime() ; this event occurs every 5.004 seconds of game time		
if Game.GetPlayer().GetAV(Destruction) >= 25 && Game.GetPlayer().HasPerk(DestructionApprentice25) == 0 && Game.GetPlayer().HasPerk(DestructionNovice00) == 1
	Game.GetPlayer().AddPerk(DestructionApprentice25)
	Debug.MessageBox("Congratulations! You have been awarded the Apprentice Destruction perk for reaching 25 Destruction.")
endIf
if Game.GetPlayer().GetAV(Destruction) >= 50 && Game.GetPlayer().HasPerk(DestructionAdept50) == 0 && Game.GetPlayer().HasPerk(DestructionApprentice25) == 1
	Game.GetPlayer().AddPerk(DestructionAdept50)
	Debug.MessageBox("Congratulations! You have been awarded the Adept Destruction perk for reaching 50 Destruction.")
endIf
if Game.GetPlayer().GetAV(Destruction) >= 75 && Game.GetPlayer().HasPerk(DestructionExpert75) == 0 && Game.GetPlayer().HasPerk(DestructionAdept50) == 1
	Game.GetPlayer().AddPerk(DestructionExpert75)
	Debug.MessageBox("Congratulations! You have been awarded the Expert Destruction perk for reaching 75 Destruction.")
endIf
if Game.GetPlayer().GetAV(Destruction) >= 100 && Game.GetPlayer().HasPerk(DestructionMasterl00) == 0 && Game.GetPlayer().HasPerk(DestructionExpert75) == 1
	Game.GetPlayer().AddPerk(DestructionMasterl00)
	Debug.MessageBox("Congratulations! You have been awarded the Master Destruction perk for reaching 100 Destruction.")
endIf


if Game.GetPlayer().GetAV(Conjuration) >= 25 && Game.GetPlayer().HasPerk(ConjurationApprentice25) == 0 && Game.GetPlayer().HasPerk(ConjurationNovice00) == 1
	Game.GetPlayer().AddPerk(ConjurationApprentice25)
	Debug.MessageBox("Congratulations! You have been awarded the Apprentice Conjuration perk for reaching 25 Conjuration.")
endIf
if Game.GetPlayer().GetAV(Conjuration) >= 50 && Game.GetPlayer().HasPerk(ConjurationAdept50) == 0 && Game.GetPlayer().HasPerk(ConjurationApprentice25) == 1
	Game.GetPlayer().AddPerk(ConjurationAdept50)
	Debug.MessageBox("Congratulations! You have been awarded the Adept Conjuration perk for reaching 50 Conjuration.")
endIf
if Game.GetPlayer().GetAV(Conjuration) >= 75 && Game.GetPlayer().HasPerk(ConjurationExpert75) == 0 && Game.GetPlayer().HasPerk(ConjurationAdept50) == 1
	Game.GetPlayer().AddPerk(ConjurationExpert75)
	Debug.MessageBox("Congratulations! You have been awarded the Expert Conjuration perk for reaching 75 Conjuration.")
endIf
if Game.GetPlayer().GetAV(Conjuration) >= 100 && Game.GetPlayer().HasPerk(ConjurationMaster100) == 0 && Game.GetPlayer().HasPerk(ConjurationExpert75) == 1
	Game.GetPlayer().AddPerk(ConjurationMaster100)
	Debug.MessageBox("Congratulations! You have been awarded the Master Conjuration perk for reaching 100 Conjuration.")
endIf


if Game.GetPlayer().GetAV(Illusion) >= 25 && Game.GetPlayer().HasPerk(IllusionApprentice25) == 0 && Game.GetPlayer().HasPerk(IllusionNovice00) == 1
	Game.GetPlayer().AddPerk(IllusionApprentice25)
	Debug.MessageBox("Congratulations! You have been awarded the Apprentice Illusion perk for reaching 25 Illusion.")
endIf
if Game.GetPlayer().GetAV(Illusion) >= 50 && Game.GetPlayer().HasPerk(IllusionAdept50) == 0 && Game.GetPlayer().HasPerk(IllusionApprentice25) == 1
	Game.GetPlayer().AddPerk(IllusionAdept50)
	Debug.MessageBox("Congratulations! You have been awarded the Adept Illusion perk for reaching 50 Illusion.")
endIf
if Game.GetPlayer().GetAV(Illusion) >= 75 && Game.GetPlayer().HasPerk(IllusionExpert75) == 0 && Game.GetPlayer().HasPerk(IllusionAdept50) == 1
	Game.GetPlayer().AddPerk(IllusionExpert75)
	Debug.MessageBox("Congratulations! You have been awarded the Expert Illusion perk for reaching 75 Illusion.")
endIf
if Game.GetPlayer().GetAV(Illusion) >= 100 && Game.GetPlayer().HasPerk(IllusionMaster100) == 0 && Game.GetPlayer().HasPerk(IllusionExpert75) == 1
	Game.GetPlayer().AddPerk(IllusionMaster100)
	Debug.MessageBox("Congratulations! You have been awarded the Master Illusion perk for reaching 100 Illusion.")
endIf


if Game.GetPlayer().GetAV(Restoration) >= 25 && Game.GetPlayer().HasPerk(RestorationApprentice25) == 0 && Game.GetPlayer().HasPerk(RestorationNovice00) == 1
	Game.GetPlayer().AddPerk(RestorationApprentice25)
	Debug.MessageBox("Congratulations! You have been awarded the Apprentice Restoration perk for reaching 25 Restoration.")
endIf
if Game.GetPlayer().GetAV(Restoration) >= 50 && Game.GetPlayer().HasPerk(RestorationAdept50) == 0 && Game.GetPlayer().HasPerk(RestorationApprentice25) == 1
	Game.GetPlayer().AddPerk(RestorationAdept50)
	Debug.MessageBox("Congratulations! You have been awarded the Adept Restoration perk for reaching 50 Restoration.")
endIf
if Game.GetPlayer().GetAV(Restoration) >= 75 && Game.GetPlayer().HasPerk(RestorationExpert75) == 0 && Game.GetPlayer().HasPerk(RestorationAdept50) == 1
	Game.GetPlayer().AddPerk(RestorationExpert75)
	Debug.MessageBox("Congratulations! You have been awarded the Expert Restoration perk for reaching 75 Restoration.")
endIf
if Game.GetPlayer().GetAV(Restoration) >= 100 && Game.GetPlayer().HasPerk(RestorationMaster100) == 0 && Game.GetPlayer().HasPerk(RestorationExpert75) == 1
	Game.GetPlayer().AddPerk(RestorationMaster100)
	Debug.MessageBox("Congratulations! You have been awarded the Master Restoration perk for reaching 100 Restoration.")
endIf


if Game.GetPlayer().GetAV(Alteration) >= 25 && Game.GetPlayer().HasPerk(AlterationApprentice25) == 0 && Game.GetPlayer().HasPerk(AlterationNovice00) == 1
	Game.GetPlayer().AddPerk(AlterationApprentice25)
	Debug.MessageBox("Congratulations! You have been awarded the Apprentice Alteration perk for reaching 25 Alteration.")
endIf
if Game.GetPlayer().GetAV(Alteration) >= 50 && Game.GetPlayer().HasPerk(AlterationAdept50) == 0 && Game.GetPlayer().HasPerk(AlterationApprentice25) == 1
	Game.GetPlayer().AddPerk(AlterationAdept50)
	Debug.MessageBox("Congratulations! You have been awarded the Adept Alteration perk for reaching 50 Alteration.")
endIf
if Game.GetPlayer().GetAV(Alteration) >= 75 && Game.GetPlayer().HasPerk(AlterationExpert75) == 0 && Game.GetPlayer().HasPerk(AlterationAdept50) == 1
	Game.GetPlayer().AddPerk(AlterationExpert75)
	Debug.MessageBox("Congratulations! You have been awarded the Expert Alteration perk for reaching 75 Alteration.")
endIf
if Game.GetPlayer().GetAV(Alteration) >= 100 && Game.GetPlayer().HasPerk(AlterationMaster100) == 0 && Game.GetPlayer().HasPerk(AlterationExpert75) == 1
	Game.GetPlayer().AddPerk(AlterationMaster100)
	Debug.MessageBox("Congratulations! You have been awarded the Master Alteration perk for reaching 100 Alteration.")
endIf


if Game.GetPlayer().GetAV(Lockpicking) >= 25 && Game.GetPlayer().HasPerk(ApprenticeLocks25) == 0 && Game.GetPlayer().HasPerk(NoviceLocks00) == 1
	Game.GetPlayer().AddPerk(ApprenticeLocks25)
	Debug.MessageBox("Congratulations! You have been awarded the Apprentice Lockpicking perk for reaching 25 Lockpicking.")
endIf
if Game.GetPlayer().GetAV(Lockpicking) >= 50 && Game.GetPlayer().HasPerk(AdeptLocks50) == 0 && Game.GetPlayer().HasPerk(ApprenticeLocks25) == 1
	Game.GetPlayer().AddPerk(AdeptLocks50)
	Debug.MessageBox("Congratulations! You have been awarded the Adept Lockpicking perk for reaching 50 Lockpicking.")
endIf
if Game.GetPlayer().GetAV(Lockpicking) >= 75 && Game.GetPlayer().HasPerk(ExpertLocks75) == 0 && Game.GetPlayer().HasPerk(AdeptLocks50) == 1
	Game.GetPlayer().AddPerk(ExpertLocks75)
	Debug.MessageBox("Congratulations! You have been awarded the Expert Lockpicking perk for reaching 75 Lockpicking.")
endIf
if Game.GetPlayer().GetAV(Lockpicking) >= 100 && Game.GetPlayer().HasPerk(MasterLocks100) == 0 && Game.GetPlayer().HasPerk(ExpertLocks75) == 1
	Game.GetPlayer().AddPerk(MasterLocks100)
	Debug.MessageBox("Congratulations! You have been awarded the Master Lockpicking perk for reaching 100 Lockpicking.")
endIf


if Game.GetPlayer().HasPerk(DestructionMaster100) == 1 && Game.GetPlayer().HasPerk(ConjurationMaster100) == 1 && Game.GetPlayer().HasPerk(IllusionMaster100) == 1 && Game.GetPlayer().HasPerk(RestorationMaster100) == 1 && Game.GetPlayer().HasPerk(AlterationMaster100) == 1 && Game.GetPlayer().HasPerk(MasterLocks100)
	UnregisterForUpdateGameTime()
endIf
endEvent

; UnregisterForUpdateGameTime() ; make sure to unregister

; 000F2CA8 	DestructionNovice00		Novice Destruction
; 000C44BF 	DestructionApprentice25	Apprentice Destruction
; 000C44C0 	DestructionAdept50		Adept Destruction
; 000C44C1 	DestructionExpert75		Expert Destruction
; 000C44C2 	DestructionMaster100	Master Destruction 

; 000F2CA7 	ConjurationNovice00		Novice Conjuration
; 000C44BB 	ConjurationApprentice25	Apprentice Conjuration
; 000C44BC 	ConjurationAdept50		Adept Conjuration
; 000C44BD 	ConjurationExpert75		Expert Conjuration
; 000C44BE 	ConjurationMaster100	Master Conjuration 

; 000F2CA9 	IllusionNovice00		Novice Illusion
; 000C44C3 	IllusionApprentice25	Apprentice Illusion
; 000C44C4 	IllusionAdept50			Adept Illusion
; 000C44C5 	IllusionExpert75		Expert Illusion
; 000C44C6 	IllusionMaster100		Master Illusion 

; 000F2CAA 	RestorationNovice00		Novice Restoration
; 000C44C7 	RestorationApprentice25	Apprentice Restoration
; 000C44C8 	RestorationAdept50		Adept Restoration
; 000C44C9 	RestorationExpert75		Expert Restoration
; 000C44CA 	RestorationMaster100	Master Restoration 

; 000F2CA6 	AlterationNovice00		Novice Alteration
; 000C44B7 	AlterationApprentice25	Apprentice Alteration
; 000C44B8 	AlterationAdept50		Adept Alteration
; 000C44B9 	AlterationExpert75		Expert Alteration
; 000C44BA 	AlterationMaster100		Master Alteration

; 000F392A 	NoviceLocks00			Novice Locks
; 000BE125 	ApprenticeLocks25		Apprentice Locks
; 000C3680 	AdeptLocks50			Adept Locks
; 000C3681 	ExpertLocks75			Expert Locks
; 000C3682 	MasterLocks100			Master Locks 

 

 

When I compile this I get the following errors: "variable Destruction is undefined", "variable DestructionApprentice25 is undefined", "variable DestructionNovice00 is undefined" and so on.

So somehow I need to tell the procedure to grab variable names from the game... Does anyone know how I'd go about doing that?

Link to comment
Share on other sites

The problem is the function is

AddPerk(Perk somePerk)

rather than

AddPerk(string somePerkName)

 

So you need to pass the function a Perk Object, not just the name of the perk

 

Basically you need to definte the perk:

 

Scriptname mm_RingOfSunniesWoe extends ObjectReference  
{Script which controls the rings activation, etc,.}

SPELL Property PerkSunniesWoeSpel  Auto  
Perk property SunniesWoePerk auto

Event OnEquipped(Actor akActor)
if akActor== Game.GetPlayer() && Game.GetPlayer().HasPerk(SunniesWoePerk) == 0
	Game.GetPlayer().AddPerk(SunniesWoePerk)
endif
EndEvent

Event OnUnequipped(Actor akActor)
if akActor== Game.GetPlayer()
	Game.GetPlayer().RemovePerk(SunniesWoePerk)
	Game.GetPlayer().RemoveSpell(PerkSunniesWoeSpel)
endif
EndEvent

 

Not sure if it helps, but on the properties of the script you'll see a list of all your defined properties. Make sure they evaluate to the proper Perk there as well. There's probably a more proper way to do it, but that's how I've done it above on a ring that applies a perk only when you're wearing it.

 

-MM

Edited by MofoMojo
Link to comment
Share on other sites

  • Recently Browsing   0 members

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