Jump to content

Script Help: Classic Fallout Skill Calculations


Thacker

Recommended Posts

So I'm at it again, and hit a roadblock again. Maybe someone here can enlighten me.

 

I'm trying to create a mod that will calculate your skills ala the formulas from Fallout 1/2/Tactics, e.g. First Aid = (15% + (Perception + Intelligence)/2).

 

That was the "easy" part. The hard part is, that the script as written prevents skill gains from leveling up; after skill points are assigned, the mod "resets" your skill back to the "base" formula without taking into consideration the skill points:

 

short MedicineSkillRecalculated

begin GameMode

set MedicineSkillRecalculated to (5 + (player.getactorvalue Perception + player.getactorvalue Intelligence)/2)

player.setactorvalue Medicine MedicineSkillRecalculated

End

 

I tried replacing the setactorvalue with modactorvalue instead, but that just resulted in the new value being added onto the skill every iteration.

 

If I could somehow keep track of the number of skill points assigned this wouldn't be a problem. Is there any command that returns the number of skill points a skill has?

 

Any other ideas? Or does this not seem possible?

 

Thanks in advance.

Link to comment
Share on other sites

Hmmm, whilst showering, I just realized maybe I can use

 

SetGameSetting fAVDSkillSKILLNAMEBase MedicineSkillRecalculated

Since it's actually the base value of the skill I want to modify. I'll try this out and get back to ya'll.

 

Edit: Damnit... that's a console command, not a script command :(

Edited by Thacker
Link to comment
Share on other sites

Hmmm, whilst showering, I just realized maybe I can use

 

SetGameSetting fAVDSkillSKILLNAMEBase MedicineSkillRecalculated

Since it's actually the base value of the skill I want to modify. I'll try this out and get back to ya'll.

 

Edit: Damnit... that's a console command, not a script command :(

 

Quite a few console commands are implemented as FOSE/NVSE functions...for example con_SetGameSetting :)

Edited by Astymma
Link to comment
Share on other sites

SetActorValue, as I'm sure you know, sets the base value of an Actor Value but I'm fairly sure that as you level up and spend skill points on skills they are applied to the base. What I would do is toss in some debugging statements that announce such things as GetBaseActorValue compared to GetActorValue just as a test. I can't see how using SetActorValue would erase spent skillpoints unless this were the case to be honest.
Link to comment
Share on other sites

If the above is true (spending skill points increases base) then you might want to do the following:

 

Create a "MenuMode 1048" block and set a flag (to indicate they've been in the CharGen screen).

In a GameMode block check for the flag AND that they don't now have the Tag! perk (so you catch only character creation and the optional redo of character creation as you leave Goodsprings),

if so apply your new base values and begin tracking all SPECIAL values.

 

Create a "MenuMode 1027" block and set a flag (to indicate they've been in the LevelUp screen).

In a GameMode block check for the flag and compare new SPECIAL to old SPECIAL and adjust base Actor Values upwards ONLY the difference the new SPECIAL values would boost.

 

As far as I know, when an actor puts on some armor with , for example, +1AGI and +1END... the game automatically adjust skills internally using ModAV.

You shouldn't have to worry about any situation when their stats go up or down except levelup and chargen.

 

Umm, of course I could be completely wrong about all this so YMMV and please test first hehe :)

Link to comment
Share on other sites

a few console commands are implemented as FOSE/NVSE functions...for example con_SetGameSetting :)

You nailed it on the head. Though actually I had to use SetNumericGameSetting, as con_SetGameSetting doesn't permit variables to be used. My (limited) testing last night shows it works beautifully. I could level up, add skill points and the skill points stuck. They even stuck after SPECIAL values were modified (Mentats and Whiskey) that caused the base value (via SetNumericGameSetting) to be recalculated.

 

SetActorValue, as I'm sure you know, sets the base value of an Actor Value but I'm fairly sure that as you level up and spend skill points on skills they are applied to the base. What I would do is toss in some debugging statements that announce such things as GetBaseActorValue compared to GetActorValue just as a test. I can't see how using SetActorValue would erase spent skillpoints unless this were the case to be honest.

From my testing, the problem I had with setactorvalue was that anytime the script was run, the value of the skill was completely replaced by the variable setting (X + (SPECIAL 1 + SPECIAL 2)/2), this removed the effect of any skill points applied. I had assumed as well that adding skill points would adjust the base value, though this doesn't appear to be the case. E.g. At level 1 I had Medicine of 15. At level up I raised it to 20. Closing the level up window and examining the skill in PIPBoy it shows 20. Close PIPBoy and wait a few moments (for script to update) and recheck the value and it's back down to 15.

 

If the above is true (spending skill points increases base) then you might want to do the following:

 

Create a "MenuMode 1048" block and set a flag (to indicate they've been in the CharGen screen).

In a GameMode block check for the flag AND that they don't now have the Tag! perk (so you catch only character creation and the optional redo of character creation as you leave Goodsprings),

if so apply your new base values and begin tracking all SPECIAL values.

 

Create a "MenuMode 1027" block and set a flag (to indicate they've been in the LevelUp screen).

In a GameMode block check for the flag and compare new SPECIAL to old SPECIAL and adjust base Actor Values upwards ONLY the difference the new SPECIAL values would boost.

 

As far as I know, when an actor puts on some armor with , for example, +1AGI and +1END... the game automatically adjust skills internally using ModAV.

You shouldn't have to worry about any situation when their stats go up or down except levelup and chargen.

 

Umm, of course I could be completely wrong about all this so YMMV and please test first hehe :)

 

I think I had thought out something similar to this as a workaround, but I think it's alittle out of my league, especially considering how easy it is with NVSE!

 

A quick related question:

 

My script's effects aside, is there a way to just change the governing SPECIAL for a Skill (e.g. make Unarmed governed by Strength) via a setting/global in the GECK?

 

Thanks for all the help sofar!

Link to comment
Share on other sites

If you were running SetActorValue in a GameMode block every frame, it will always overwrite applying skill points.

That's why my suggestion involved doing it just once in response to CharGen and LevelUp happening.

Mentats and Whiskey are applied internally as ModAV, meaning they go into the Temp Pool, not the Base Pool.

Conceptually, this is what you want to do:

 

At character creation, once they have completed assigning SPECIAL, Tag Skills and Traits... redo their base

Actor Values and apply the Tag Skills back in. this will happen once unless they redo their character when

leaving the Goodsprings area.

 

Hmm, as I type this...the more I think about it, you need to do some testing...

 

When leveling up, if a SPECIAL is increased by 1, does this simply add 2 to the base Actor Values of the skills

governed by that SPECIAL? If so, then you only need to set base Actor Values at CharGen and just the ONE time.

You can ignore level up then.

 

The main idea is that when modifying base Actor Values, you only do it one time and one time only. Those values

are permanent (in pipboy you see them as the actual value with no (+) beside it). When a temporary effect is happening

such as clothing, drugs or something similar, this is applied to the temp pool and shows in pipboy as a (+) beside the

skill/SPECIAL.In essence, once you apply your new base at chargen, it should remain the base for the rest of the game

assuming level up just adds 2 to the skills governed by a SPECIAL increased during level up.

 

This may be simpler than you think... I'd do some debug output before and after CharGen and before and after LevelUp

using GetBaseActorValue to tell you what exactly changed during these processes. If you were to then wear a +1 AGI/+1 END

clothing GetBaseActorValue should not change but GetActorValue will.

 

Ok, now I'm just rambling hehe, but I think you see what I'm getting at...

Link to comment
Share on other sites

As for MenuMode blocks vs GameMode blocks they're fairly simple. A MenuMode block runs when a menu is being displayed on screen.

A GameMode block runs when there's no menu being displayed on screen. Adding a number to the MenuMode block means you want

it to run only on a specific menu.

 

Code Example:

 

integer MenuFlag

begin MenuMode 1048
Set MenuFlag to 1048 ; they were in the CharGen screen
end

begin MenuMode 1027
Set MenuFlag to 1027; they were in the LevelUp screen
end

begin MenuMode 1003
Set MenuFlag to 1003 ; they were in the Stats screen
end

begin GameMode
if (MenuFlag == 1048)
       	;do some stuff based off being in CharGen screen and then reset MenuFlag to 0
endif
if (MenuFlag == 1027)
       	;do some stuff based off being in LevelUp screen and then reset MenuFlag to 0
endif
if (MenuFlag == 1003)
       	;do some stuff based off being in Stats screen and then reset MenuFlag to 0
endif
end

Link to comment
Share on other sites

Your suggestions... seem to make sense (I am new to scripting and at work, so can't trial and error these in the GECK to understand them).

 

I think though you might misunderstand (slightly) what I intend. I want the calculation of the Skill (via setActorValue or whatever command we'd settle on) to be dynamic; if the associated SPECIALs change for whatever reasion (chemicals, disease, clothing, etc) that new SPECIAL value needs to be used to recalculate the Skill (hence why I originally had the script running every frame).

 

The main idea is that when modifying base Actor Values, you only do it one time and one time only. Those values are permanent (in pipboy you see them as the actual value with no (+) beside it). When a temporary effect is happening such as clothing, drugs or something similar, this is applied to the temp pool and shows in pipboy as a (+) beside the skill/SPECIAL.In essence, once you apply your new base at chargen, it should remain the base for the rest of the game assuming level up just adds 2 to the skills governed by a SPECIAL increased during level up.

 

Now that you mention it I don't think I tried having the script run just once, and then seeing the effect of leveling up and buffs/debuffs to SPECIAL. I assumed if the SPECIALs changed, the Skill value would need to be recalculated. Considering the "base" Skill value in Vanilla is set by fAVDSkillSKILLNAMEBase and modifications to the associated SPECIAL are handled by fAVDSkillPrimaryBonusMult, it does seem like changes to SPECIAL are kept seperate (and thus "temporary") from the base skill.

 

I'll have to try this when I get home. Again, the wonderful scripting power of NVSE kind of makes this point moot, but it's always nice to know if it's possible in other ways. Thanks again.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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