[SCRIPT HELP] Store Skill & Restore Modified Value

Post » Wed Jun 20, 2012 3:01 am

I am trying to make a script that when the player activate an item, the script takes the skill level they have when activating the object, then resets their level, skills and perks back to default values (15 for most skills, with +5 more in some depending on race, level 1, 100 max health, mana and stamina and 0 perks), and then advances the skills the player had back to where they were before, effectively giving them a chance to change their perks and tweak their health, mana and stamina.

I am not sure how or if I can even take the initial values as a variable, change the value, and still have the script save the original number, though.

If I use

int PlayersCurrentOneHanded = Game.GetPlayer().GetActorValue("onehanded") as int

To declare the variables at the start, can I simply do

Game.AdvanceSkill("OneHanded", PlayersCurrentOneHanded-15)

???
User avatar
Princess Johnson
 
Posts: 3435
Joined: Wed Feb 07, 2007 5:44 pm

Post » Tue Jun 19, 2012 8:31 pm

You could simply add some variables that you would store the values of the old skill levels.

int AlchemyOld;;;;;;AlchemyOld = Game.GetPlayer().GetActorValue("Alchemy");;;;;;Game.GetPlayer().SetActorValue("Alchemy", 15);;;;;;Game.GetPlayer().SetActorValue("Alchemy", AlchemyOld);;;;;;
User avatar
Jesus Duran
 
Posts: 3444
Joined: Wed Aug 15, 2007 12:16 am

Post » Wed Jun 20, 2012 3:33 am

That's kinda what I am doing, but I mean, if the variable is, in essence, another variable, that first variable changes, wouldn't my declared variable also change and thus be useless?

1. Skill Variable is declared as 85
2. Skill is reduced to 15
3. Skill should then be raised by 85-15, but the 85 is now a 15.

Right? Or would it actually save that 85 unless the variable is declared again after it's been changed from the original value?
User avatar
Sweets Sweets
 
Posts: 3339
Joined: Tue Jun 13, 2006 3:26 am

Post » Wed Jun 20, 2012 11:41 am

It will save that 85 unless you assign something else to that variable.
User avatar
Emilie M
 
Posts: 3419
Joined: Fri Mar 16, 2007 9:08 am

Post » Wed Jun 20, 2012 11:48 am

Aw sweet. Thanks.

I do have another question now, though... There doesn't appear to be a SetLevel function in the creation kit. But I do know that there WAS a command that allowed you to execute in-game console commands through scripts, and there IS a console command to set a player's level... I just can't remember the function name.
User avatar
Michelle Smith
 
Posts: 3417
Joined: Wed Nov 15, 2006 2:03 am


Return to V - Skyrim