Script help needed: Adding multiple perks

Post » Mon Jun 18, 2012 9:34 am

Hey forum,

I've got a problem with my script.
After solving the major headache of Perk Property, I ran into something I can't explain.

My script is supposed to add all basic alchemy perks to the player according to his level.
(So someone with level 60 alchemy, should get alchemist rank 1,2,3 and 4)

Problem: Only the first perk gets added (the one without an if-statement around it) Other addperk commands seem to fail. Although debug messages pop up when placed in the if-statement.

Info:
Debug.MessageBox(playerAlchemy) outputs 100 (my skill is 100, so this is correct)
The if-statement checks seem to work, according to debug messages placed in them.
I have set Alchemy1 to Alchemist00, which has the correct ID (be127)
Alchemy2 to Alchemist20,
Alchemy3 to Alchemist40,
Alchemy4 to Alchemist60,
Alchemy5 to Alchemist80.
I have placed a simple object in the world, which I activate manually.

The script:
Scriptname BBB_Scripttest extends ObjectReference{Test adding perks}Perk Property Alchemy1  AutoPerk Property Alchemy2  AutoPerk Property Alchemy3  AutoPerk Property Alchemy4  AutoPerk Property Alchemy5  AutoEvent OnActivate(ObjectReference akActionRef)int playerAlchemy = Game.GetPlayer().GetActorValue("Alchemy") as int;{Alchemy (Alchemist)}Game.GetPlayer().addperk(Alchemy1)Debug.MessageBox(playerAlchemy)if playerAlchemy >= 20  Game.GetPlayer().addperk(Alchemy2)endifif playerAlchemy >= 40  Game.GetPlayer().addperk(Alchemy3)endifif playerAlchemy >= 60  Game.GetPlayer().addperk(Alchemy4)Endifif playerAlchemy >= 80  Game.GetPlayer().addperk(Alchemy5)endifendEvent

What am I missing here?

Cheers,
Badboyd
User avatar
Claudia Cook
 
Posts: 3450
Joined: Mon Oct 30, 2006 10:22 am

Post » Mon Jun 18, 2012 9:26 pm

Apparantly this version does work.
I now get all 5 Alchemist Perks.

I changed a few capital letters.
Could that be it?

Scriptname BBB_Scripttest extends ObjectReference {Test adding perks}Perk Property Alchemy1  AutoPerk Property Alchemy2  AutoPerk Property Alchemy3  AutoPerk Property Alchemy4  AutoPerk Property Alchemy5  AutoEvent OnActivate(ObjectReference akActionRef)int playerAlchemy = Game.GetPlayer().GetActorValue("Alchemy") as intDebug.MessageBox("Your alchemy skill: " + playerAlchemy);{Alchemy (Alchemist)}Game.GetPlayer().AddPerk(Alchemy1)if playerAlchemy >= 20  Game.GetPlayer().AddPerk(Alchemy2)endIfif playerAlchemy >= 40  Game.GetPlayer().AddPerk(Alchemy3)endIfif playerAlchemy >= 60  Game.GetPlayer().AddPerk(Alchemy4)endIfif playerAlchemy >= 80  Game.GetPlayer().AddPerk(Alchemy5)endIfendEvent
User avatar
OTTO
 
Posts: 3367
Joined: Thu May 17, 2007 6:22 pm


Return to V - Skyrim