Jump to content

Need help with a script


TDrew

Recommended Posts

Okay, so the deal is this: I want this script to give the player this perk I made called 'boneperk' when they equip an item... I have been trying for hours and no luck though. Here is my script:

 

Scriptname BonePerkScript extends ObjectReference  

Event OnEquipped(Actor akActor)
akActor.AddPerk(BonePerk)
Debug.Notification("Bone Harvesting Enabled")
EndEvent

Event OnUnEquipped(Actor akActor)
akActor.RemovePerk(BonePerk)
Debug.Notification("Bone Harvesting Disabled")
EndEvent

Perk property BonePerk auto

 

Ive tested it every way I can think to... the perk itself functions if I add it via console, the script compiles properly and displays the text notification whenever the item its attached to is equipped or unequipped... I just cant figure out why the script wont give the perk to the player!

 

Im a complete scripting noob, so please, If you've got any ideas about what is going wrong please let me know.

Link to comment
Share on other sites

try to call akActor the player or simply remove akActor and change to Game.GetPlayer()

 

I just tried this:

 

Scriptname BonePerkScript extends ObjectReference  

Event OnEquipped(Actor akActor)
akActor == Game.GetPlayer()
Game.GetPlayer().AddPerk(BonePerk)
Debug.Notification("Bone Harvesting Enabled")
EndEvent

Event OnUnEquipped(Actor akActor)
akActor == Game.GetPlayer()
Game.GetPlayer().RemovePerk(BonePerk)
Debug.Notification("Bone Harvesting Disabled")
EndEvent

Perk property BonePerk auto

 

...no change.

Link to comment
Share on other sites

Scriptname BonePerkScript extends ObjectReference  

Event OnEquipped(Actor akActor)
if akActor == Game.GetPlayer()
Game.GetPlayer().AddPerk(BonePerk)
Debug.Notification("Bone Harvesting Enabled")
endif
EndEvent

Event OnUnEquipped(Actor akActor)
if akActor == Game.GetPlayer()
Game.GetPlayer().RemovePerk(BonePerk)
Debug.Notification("Bone Harvesting Disabled")
 endif
EndEvent

Perk property BonePerk auto

 

try that

Link to comment
Share on other sites

Your original script is best and should work. Did you give "boneperk" a value in the properties window of the objectg you are applying this script to?

 

Do you get any errors? If so then what and what does it say?

Link to comment
Share on other sites

Ive tried 'if' arguments; it doesnt help.

 

Korodic you are right, my original script looks correct, I should not have to define akActor as the player, according to everything I have read akActor will always be assumed to be the player by default.

 

Okay, so boneperk didnt have a property value assigned, and I assigned it to 'boneperk' the perk.

 

Still nothing.

 

I get no errors, like I said, the script compiles just fine.

 

It has to be something else entirely... what am I missing?

Link to comment
Share on other sites

Yes, I have been modding long enough to be wary of that particular mistake.

 

Anyway, dont bother trying to come up with a solution, I just figured out a work-around that doesnt involve scripts.

 

This little foray into Papyrus has been frustrating and unproductive; Im not going to waste another second on scripting now or in the future.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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