Script function to get player's skill level?

Post » Fri May 27, 2011 1:43 pm

I've scoured the wiki and tons of existing scripts to try and find a script command that allows me to check a players skill level in a certain skill. Does it exist?

I'm trying to create an item (armor) that requires a certain skill level, and also increases a certain skill, but there is no way to add a required skill level in the editor like you can with weapons. So I figured I would have to do it with a script. Unfortunately, I can't even get started on the script because I can't find a command that gets the player's current skill level. Increasing the skill is easy, as you can just add it through an object effect. But I wanted to have this item require a certain skill level before it allows you to equip it.

Thanks for any help.
User avatar
Krystina Proietti
 
Posts: 3388
Joined: Sat Dec 23, 2006 9:02 pm

Post » Fri May 27, 2011 11:34 am

player.getav energyweapons

It's the getav function listed http://geck.gamesas.com/index.php/GetActorValue. A list of actor values can be found http://geck.gamesas.com/index.php/Stats_List. If you end up wanting to change the actor value, use damageav and restoreav, preferably. Also note that there are at least 3 new actor values for New Vegas not listed on that page yet - hunger, dehydration, sleepdeprevation. They're the three hardcoe needs levels.

Your script will end up looking something like this:

scn myArmorScriptref rContainerbegin onequip   set rContainer to getcontainer   if rContainer.getav energyweapons < 75 && rContainer == player       rContainer.unequipitem myArmor     ; where myArmor is the editor ID of your armor       showmessage skillnothighenough    ; optional, flashes a message telling the user what happened    endifend

User avatar
jadie kell
 
Posts: 3497
Joined: Sat Jul 29, 2006 3:54 pm

Post » Fri May 27, 2011 11:22 am

Thank you! I don't know why, but I never thought of using console commands.
User avatar
flora
 
Posts: 3479
Joined: Fri Jun 23, 2006 1:48 am

Post » Fri May 27, 2011 6:35 am

I'm having some trouble setting the skill value back to normal after the player unequips the scripted item. Here is what my script looks like:

scn zScienceGloveScriptshort basevalshort hasbeensetshort newvalshort msgshownbegin GameModeset baseval to player.getPermAV Scienceset hasbeenset to 0if player.getEquipped zScienceGlove01 == 0set msgshown to 0endifif baseval >= 30 && player.getEquipped zScienceGlove01 == 1 && msgshown == 0player.ModAV Lockpick 20 showMessage zScienceGloveMsg02set hasbeenset to 1set msgshown to 1endifif player.GetEquipped zScienceGlove01 == 0 && hasbeenset == 1player.modAV Lockpick -20endifif baseval <=30 && player.GetEquipped zScienceGlove01 == 1 && msgshown == 0showMessage zScienceGloveMsg set msgshown to 1player.unequipItem zScienceGlove01returnendifend


Optimally, this script wouldn't be a GameMode script, but rather an OnEquip script. However, I can't think of a way to check if the item is unequipped or not since the script only runs when the object is equipped. Forgive me if this is a simply matter, I haven't scripted in a very long time. (Not since the Morrowind days...)
User avatar
Tanya Parra
 
Posts: 3435
Joined: Fri Jul 28, 2006 5:15 am

Post » Fri May 27, 2011 9:02 am

Since you're just temporarily increasing a skill, you could probably just do it via an object effect. There are instances where you can't do that, like when you're modifying the speedmult and have to do that hack to make sure the change takes effect, but in this case nothing like that is necessary. As a side note, I notice that in FNV, unlike FO3, agility effects your run speed. I wonder if that means they've fixed the speedmult base effects?
User avatar
Hazel Sian ogden
 
Posts: 3425
Joined: Tue Jul 04, 2006 7:10 am


Return to Fallout: New Vegas