Need some help with optimizing my Perk Tome script

Post » Thu Jan 08, 2015 6:09 pm

Hi there!

Would anyone be so kind to help me with this?

This is a script for my Perk Tomes mod which puts books similar to Spell Tomes in the world that allow the player to learn techniques by a more immersive way. I'm redesigning my mod to work with PerMa, but modifying the properties for each tome is pretty tedious work.

I'd like to optimize this script so it will automatically identify (at least) the following variables:

  • OldPerkTomeName (Which is basically the Name String for the tome of the prerequisite perk)
  • PerkSkillName (This is supposed to be the governing skill for the added perk, like Smithing)
  • ReqSkillLevel (Is it possible to extract this information from the prerequisite perk data?)
  • PerkTomeName (If it can be done, I'd *love* the script to know the Name String of the book it's currently run by)
Scriptname PerkTomePrerequisite extends ObjectReference  Perk Property TheNewPerk AutoString Property PerkTomeName AutoString Property OldPerkTomeName AutoString Property PerkSkillName Autoint Property ReqSkillLevel AutoPerk Property PerkPrerequisite AutoBook Property PerkTome AutoEvent OnRead()		if Game.GetPlayer().GetBaseActorValue(PerkSkillName) >= ReqSkillLevel			if Game.GetPlayer().HasPerk(PerkPrerequisite) == True				if Game.GetPlayer().HasPerk(TheNewPerk) == False					Debug.MessageBox("You have learned an advanced " + PerkSkillName + " technique: " + PerkTomeName)					Game.GetPlayer().AddPerk(TheNewPerk)					Game.GetPlayer().RemoveItem(PerkTome, 1)				else					Debug.MessageBox("You already know " + PerkTomeName)				endif			else				Debug.MessageBox("You must learn " + OldPerkTomeName + " first.")			endif		else			Debug.MessageBox("Your " + PerkSkillName + " skill is too low to learn this advanced technique.")		endifEndEvent 

Huge thank you to anyone willing to help!

User avatar
P PoLlo
 
Posts: 3408
Joined: Wed Oct 31, 2007 10:05 am

Return to V - Skyrim