Jump to content

Script Help- SPECIAL-based skill advancement


redeyesandlonghair

Recommended Posts

So I wrote up this script for my idea to make skill advancement rate dependent on SPECIAL attributes. The idea is that in the level up screen you put however many points into a skill... then the actual amount that the skill goes up is modified by the governing attribute. Example; Charisma 10, put 1 point into Barter, Barter goes up by 3. Charisma 1, put 1 point into Barter, Barter goes up by 0.30.

 

When I go through the script by eye, it seems like it should do what I want it to do. The problem is, it doesn't actually do that in-game. I tried it out using AdvancePCLevel.

 

My character had 10 Charisma, 9 Endurance, 10 Intelligence. 36 Barter, 42 Big Guns, 48 Medicine. There were no + or - effects on any of those attributes or skills at the time, which is why I focused on them ( the script uses permav anyways, so it wouldn't effect the numbers, it was just visually easier to look at numbers that weren't being affected by anything )

 

I put 3 points into Barter, 6 points into Big Guns, and 5 points into Medicine.

Barter became 78 - increase of 42 points, the expected increase was 9

Big Guns became 98 - increase of 56 points, the expected increase was 16

Medicine became 100 - increase of at least 52, expected increase was 15

 

I quit out of the game without saving, then went back in to do another test.

 

This time I only put 1 point into Barter, which increased Barter to 72.

Advanced level a second time, 1 more point into Barter, Barter became 73 ( which means in addition to the numbers being inflated the first time, there's also the problem that the script only fires once then has no further effect on subsequent level ups ).

 

Here's the script, any insight into why it's going goofy would be appreciated. It is attached to a Quest with Priority 1, and Delay of 5.

 

scn AAASpecialBasedAdvancementScript

Float FakeBarter
Float FakeBigGuns
Float FakeEnergyWeapons
Float FakeExplosives
Float FakeLockPick
Float FakeMedicine
Float FakeMeleeWeapons
Float FakeRepair
Float FakeScience
Float FakeSmallGuns
Float FakeSneak
Float FakeSpeech
Float FakeUnarmed

Float BarterChange
Float BigGunsChange
Float EnergyWeaponsChange
Float ExplosivesChange
Float LockPickChange
Float MedicineChange
Float MeleeWeaponsChange
Float RepairChange
Float ScienceChange
Float SmallGunsChange
Float SneakChange
Float SpeechChange
Float UnarmedChange

Float StrengthFactor
Float PerceptionFactor
Float EnduranceFactor
Float CharismaFactor
Float IntelligenceFactor
Float AgilityFactor

Float Oldbarter
Float OldBigGuns
Float OldEnergyWeapons
Float OldExplosives
Float OldLockPick
Float OldMedicine
Float OldMeleeWeapons
Float OldRepair
Float OldScience
Float OldSmallGuns
Float OldSneak
Float OldSpeech
Float OldUnarmed

Float OldLevel

Int StageSwitch
Int FirstBoot

Begin GameMode

Con_SetGameSetting iLevelUpSkillPointsInterval 0
Con_SetGameSetting iLevelUpSkillPointsBase 7

If FirstBoot == 0
Set FirstBoot to 1
Set FakeBarter to Player.GetPermAv Barter
Set FakeBigGuns to Player.GetPermAv BigGuns
Set FakeEnergyWeapons to Player.GetPermAv EnergyWeapons
Set FakeExplosives to Player.GetPermAv Explosives
Set FakeLockPick to Player.GetPermAv LockPick
Set FakeMedicine to Player.GetPermAv Medicine
Set FakeMeleeWeapons to Player.GetPermAv MeleeWeapons
Set FakeRepair to Player.GetPermAv Repair
Set FakeScience to Player.GetPermAv Science
Set FakeSmallGuns to Player.GetPermAv SmallGuns
Set FakeSneak to Player.GetPermAv Sneak
Set FakeSpeech to Player.GetPermAv Speech
Set FakeUnarmed to Player.GetPermAv Unarmed
EndIf

If StageSwitch == 0
Set OldBarter to Player.GetPermAv Barter
Set OldBigGuns to Player.GetPermAv BigGuns
Set OldEnergyWeapons to Player.GetPermAv EnergyWeapons
Set OldExplosives to Player.GetPermAv Explosives
Set OldLockPick to Player.GetPermAv LockPick
Set OldMedicine to Player.GetPermAv Medicine
Set OldMeleeWeapons to Player.GetPermAv MeleeWeapons
Set OldRepair to Player.GetAv Repair
Set OldScience to Player.GetAv Science
Set OldSmallGuns to Player.GetAv SmallGuns
Set OldSneak to Player.GetAv Sneak
Set OldSpeech to Player.GetAv Speech
Set OldUnarmed to Player.GetAv Unarmed
Set OldLevel to Player.GetLevel
Set StageSwitch to 1
EndIf

If Player.GetLevel > OldLevel
Set BarterChange to ( Player.GetPermAv Barter - OldBarter )
Set BigGunsChange to ( Player.GetPermAv BigGuns - OldBigGuns )
Set EnergyWeaponsChange to ( Player.GetPermAv EnergyWeapons - OldEnergyWeapons )
Set ExplosivesChange to ( Player.GetPermAv Explosives - OldExplosives )
Set LockPickChange to ( Player.GetPermAv LockPick - OldLockPick )
Set MedicineChange to ( Player.GetPermAv Medicine - OldMedicine )
Set MeleeWeaponsChange to ( Player.GetPermAv MeleeWeapons - OldMeleeWeapons )
Set RepairChange to ( Player.GetPermAv Repair - OldRepair )
Set ScienceChange to ( Player.GetPermAv Science - OldScience )
Set SmallGunsChange to ( Player.GetPermAv SmallGuns - OldSmallGuns )
Set SneakChange to ( Player.GetPermAv Sneak - OldSneak )
Set SpeechChange to ( Player.GetPermAv Speech - OldSpeech )
Set UnarmedChange to ( Player.GetPermAv Unarmed - OldUnarmed )

Set StrengthFactor to ( Player.GetPermAv Strength * 0.3 )
Set PerceptionFactor to ( Player.GetPermAv Perception * 0.3 )
Set EnduranceFactor to ( Player.GetPermAv Endurance * 0.3 )
Set CharismaFactor to ( Player.GetPermAv Charisma * 0.3 )
Set IntelligenceFactor to ( Player.GetPermAv Intelligence * 0.3 )
Set AgilityFactor to ( Player.GetPermAv Agility * 0.3 )

Set FakeBarter to ( FakeBarter + ( BarterChange * CharismaFactor ) )
Set FakeBigGuns to ( FakeBigGuns + ( BigGunsChange * EnduranceFactor ) )
Set FakeEnergyWeapons to ( FakeEnergyWeapons + ( EnergyWeaponsChange * PerceptionFactor ) )
Set FakeExplosives to ( FakeExplosives + ( ExplosivesChange * PerceptionFactor ) )
Set FakeLockPick to ( FakeLockPick + ( LockPickChange * PerceptionFactor ) )
Set FakeMedicine to ( FakeMedicine + ( MedicineChange * IntelligenceFactor ) )
Set FakeMeleeWeapons to ( FakeMeleeWeapons + ( MeleeWeaponsChange * StrengthFactor ) )
Set FakeRepair to ( FakeRepair + ( RepairChange * IntelligenceFactor ) )
Set FakeScience to ( FakeScience + ( ScienceChange * IntelligenceFactor ) )
Set FakeSmallGuns to ( FakeSmallGuns + ( SmallGunsChange * AgilityFactor ) )
Set FakeSneak to ( FakeSneak + ( SneakChange * AgilityFactor ) )
Set FakeSpeech to ( FakeSpeech + ( SpeechChange * CharismaFactor ) )
Set FakeUnarmed to ( FakeUnarmed + ( UnarmedChange * EnduranceFactor ) )

Player.SetAv Barter FakeBarter
Player.SetAv BigGuns FakeBigGuns
Player.SetAv EnergyWeapons FakeEnergyWeapons
Player.SetAv Explosives FakeExplosives
Player.SetAv LockPick FakeLockPick
Player.SetAv Medicine FakeMedicine
Player.SetAv MeleeWeapons FakeMeleeWeapons
Player.SetAV Repair FakeRepair
Player.SetAv Science FakeScience
Player.SetAv SmallGuns FakeSmallGuns
Player.SetAv Sneak FakeSneak
Player.SetAv Speech FakeSpeech
Player.SetAv Unarmed FakeUnarmed

Set OldLevel to Player.Getlevel
Set StageSwitch to 0
EndIf

End

Link to comment
Share on other sites

well could be rounding problem

fose have two functions ceil and floor to help on that

you could do a quest script that runs when you are on menumode to not add lag during the game

 

 

other idea

there are mods that make the skill limit be 1000 instead of 100

so when get on skill window

fakebarter * 10

 

then add 3 points for each point add if level 1 special

and 30 if level 10 special

 

when close the window

fakebarter / 10

Edited by betto212
Link to comment
Share on other sites

This is just a guess, I didn't notice anything that seemed like it would cause the errors you've been getting, but here goes...

 

scn AAASpecialBasedAdvancementScript

Float FakeBarter
Float FakeBigGuns
Float FakeEnergyWeapons
Float FakeExplosives
Float FakeLockPick
Float FakeMedicine
Float FakeMeleeWeapons
Float FakeRepair
Float FakeScience
Float FakeSmallGuns
Float FakeSneak
Float FakeSpeech
Float FakeUnarmed

Float BarterChange
Float BigGunsChange
Float EnergyWeaponsChange
Float ExplosivesChange
Float LockPickChange
Float MedicineChange
Float MeleeWeaponsChange
Float RepairChange
Float ScienceChange
Float SmallGunsChange
Float SneakChange
Float SpeechChange
Float UnarmedChange

Float StrengthFactor
Float PerceptionFactor
Float EnduranceFactor
Float CharismaFactor
Float IntelligenceFactor
Float AgilityFactor

Float Oldbarter
Float OldBigGuns
Float OldEnergyWeapons
Float OldExplosives
Float OldLockPick
Float OldMedicine
Float OldMeleeWeapons
Float OldRepair
Float OldScience
Float OldSmallGuns
Float OldSneak
Float OldSpeech
Float OldUnarmed

Float OldLevel

Int FirstBoot

Begin GameMode

Con_SetGameSetting iLevelUpSkillPointsInterval 0
Con_SetGameSetting iLevelUpSkillPointsBase 7

If FirstBoot == 0
       Set FirstBoot to 1
       Set FakeBarter to Player.GetPermAv Barter
       Set FakeBigGuns to Player.GetPermAv BigGuns
       Set FakeEnergyWeapons to Player.GetPermAv EnergyWeapons
       Set FakeExplosives to Player.GetPermAv Explosives
       Set FakeLockPick to Player.GetPermAv LockPick
       Set FakeMedicine to Player.GetPermAv Medicine
       Set FakeMeleeWeapons to Player.GetPermAv MeleeWeapons
       Set FakeRepair to Player.GetPermAv Repair
       Set FakeScience to Player.GetPermAv Science
       Set FakeSmallGuns to Player.GetPermAv SmallGuns
       Set FakeSneak to Player.GetPermAv Sneak
       Set FakeSpeech to Player.GetPermAv Speech
       Set FakeUnarmed to Player.GetPermAv Unarmed

       Set OldLevel to Player.Getlevel
EndIf

If Player.GetLevel > OldLevel
       Set BarterChange to ( Player.GetPermAv Barter - OldBarter )
       Set BigGunsChange to ( Player.GetPermAv BigGuns - OldBigGuns )
       Set EnergyWeaponsChange to ( Player.GetPermAv EnergyWeapons - OldEnergyWeapons )
       Set ExplosivesChange to ( Player.GetPermAv Explosives - OldExplosives )
       Set LockPickChange to ( Player.GetPermAv LockPick - OldLockPick )
       Set MedicineChange to ( Player.GetPermAv Medicine - OldMedicine )
       Set MeleeWeaponsChange to ( Player.GetPermAv MeleeWeapons - OldMeleeWeapons )
       Set RepairChange to ( Player.GetPermAv Repair - OldRepair )
       Set ScienceChange to ( Player.GetPermAv Science - OldScience )
       Set SmallGunsChange to ( Player.GetPermAv SmallGuns - OldSmallGuns )
       Set SneakChange to ( Player.GetPermAv Sneak - OldSneak )
       Set SpeechChange to ( Player.GetPermAv Speech - OldSpeech )
       Set UnarmedChange to ( Player.GetPermAv Unarmed - OldUnarmed )

       Set StrengthFactor to ( Player.GetPermAv Strength * 0.3 )
       Set PerceptionFactor to ( Player.GetPermAv Perception * 0.3 )
       Set EnduranceFactor to ( Player.GetPermAv Endurance * 0.3 )
       Set CharismaFactor to ( Player.GetPermAv Charisma * 0.3 )
       Set IntelligenceFactor to ( Player.GetPermAv Intelligence * 0.3 )
       Set AgilityFactor to ( Player.GetPermAv Agility * 0.3 )

       Set FakeBarter to ( FakeBarter + ( BarterChange * CharismaFactor ) )
       Set FakeBigGuns to ( FakeBigGuns + ( BigGunsChange * EnduranceFactor ) )
       Set FakeEnergyWeapons to ( FakeEnergyWeapons + ( EnergyWeaponsChange * PerceptionFactor ) )
       Set FakeExplosives to ( FakeExplosives + ( ExplosivesChange * PerceptionFactor ) )
       Set FakeLockPick to ( FakeLockPick + ( LockPickChange * PerceptionFactor ) )
       Set FakeMedicine to ( FakeMedicine + ( MedicineChange * IntelligenceFactor ) )
       Set FakeMeleeWeapons to ( FakeMeleeWeapons + ( MeleeWeaponsChange * StrengthFactor ) )
       Set FakeRepair to ( FakeRepair + ( RepairChange * IntelligenceFactor ) )
       Set FakeScience to ( FakeScience + ( ScienceChange * IntelligenceFactor ) )
       Set FakeSmallGuns to ( FakeSmallGuns + ( SmallGunsChange * AgilityFactor ) )
       Set FakeSneak to ( FakeSneak + ( SneakChange * AgilityFactor ) )
       Set FakeSpeech to ( FakeSpeech + ( SpeechChange * CharismaFactor ) )
       Set FakeUnarmed to ( FakeUnarmed + ( UnarmedChange * EnduranceFactor ) )

       Player.SetAv Barter FakeBarter
       Player.SetAv BigGuns FakeBigGuns
       Player.SetAv EnergyWeapons FakeEnergyWeapons
       Player.SetAv Explosives FakeExplosives
       Player.SetAv LockPick FakeLockPick
       Player.SetAv Medicine FakeMedicine
       Player.SetAv MeleeWeapons FakeMeleeWeapons
       Player.SetAV Repair FakeRepair
       Player.SetAv Science FakeScience
       Player.SetAv SmallGuns FakeSmallGuns
       Player.SetAv Sneak FakeSneak
       Player.SetAv Speech FakeSpeech
       Player.SetAv Unarmed FakeUnarmed

       Set OldLevel to Player.Getlevel

       Set OldBarter to Player.GetPermAv Barter
       Set OldBigGuns to Player.GetPermAv BigGuns
       Set OldEnergyWeapons to Player.GetPermAv EnergyWeapons
       Set OldExplosives to Player.GetPermAv Explosives
       Set OldLockPick to Player.GetPermAv LockPick
       Set OldMedicine to Player.GetPermAv Medicine
       Set OldMeleeWeapons to Player.GetPermAv MeleeWeapons
       Set OldRepair to Player.GetAv Repair
       Set OldScience to Player.GetAv Science
       Set OldSmallGuns to Player.GetAv SmallGuns
       Set OldSneak to Player.GetAv Sneak
       Set OldSpeech to Player.GetAv Speech
       Set OldUnarmed to Player.GetAv Unarmed
EndIf

End

 

No idea if that'll do anything noticably different. It might be worth trying to narrow down the error by making a simpler version that just adds a fixed number to a particular skill each level up, or print up a message each level up, and check what happens. or maybe just add a message to this script saying something like SKILL changed from NUMBER to NUMBER.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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