Need help on Scripting! Local variable LVAR_FOLLOW_DISTANCE inexplicably resets to 0!

arroyoman

First time out of the vault
New to modding fallout games, and a few days ago, I decided to make a mod for Fallout of Nevada that makes the prostitute (Jasmine) in Black Rock a companion. I have been following tutorials such as https://www.nma-fallout.com/threads/tutorial-for-adding-party-members-in-fallout-2-attempt.199819/

As of now, there is a strange bug happening. When I recruit Jasmine, she follows me around, everything works perfectly fine. But as soon as I enter a new map or reenter any map, she stops following me around.

After some time checking my code, I found out that the local variable LVAR_FOLLOW_DISTANCE or in this case local_var(8) is reset to 0 every time I leave/enter a map.

One of the desperate workarounds I attempted was forcing the value of local_var(8) to set to 3 in the critter_p_proc, using the set_local_var(8, 3) function. I have also tried the same thing in map_enter_p_proc, both attempts did not work: LVAR_FOLLOW_DISTANCE is still being set to 0.

I would greatly appreciate any help if you have some idea what is causing this problem. This is the code for Node1007 that i use to check if local variable LVAR_FOLLOW_DISTANCE has been set to 0. Attached below is the .ssl file I have been working on. (in .txt format as NMA does not allow .ssl uploads)

procedure Node1007 begin
if (local_var(8) == 3) then begin
Reply("I'm staying close.");
end else if (local_var(8) == 6) then begin
Reply("I'm keeping some distance.");
end else if (local_var(8) == 9) then begin
Reply("I'm giving you your space.");
end else if (local_var(8) == 0) then begin
Reply("localvar8 has been set to 0");
end
DEF_PM_FOLLOW;
end
 

Attachments

Last edited:
How many LVARs have you defined for the script in the scripts.lst file?

PS: You should give names to your LVARs. If you know that 8 is "LVAR_FOLLOW_DISTANCE" then you should use that name in your script instead of the number.
 
Last edited:
Thanks for the advice! I had changed local_var(8) -----> local_var(LVAR_FOLLOW_DISTANCE)

As for the party.txt scripts.lst part, I had it set to 15 just now. Unfortunately, the problem persists.
BCProsti.int ; ÁëýêÐîê: Ïðîêàæåííàÿ # local_vars=15
 
Last edited:
This might be total nonsense, but.. I see the script interacts with map vars. Is Fallout Nevada designed to use this many mvars? If the map is not set to handle the map vars the script wants to interact with, then it might cause the bug (I think it's defined by the "# local_vars=#" given to the map script, but i'm not sure.).
 
Last edited:
This might be total nonsense, but.. I see the script interacts with map vars. Is Fallout Nevada designed to use this many mvars? If the map is not set to handle the map vars the script wants to interact with, then it might cause the bug (I think it's defined by the "# local_vars=#" given to the map script, but i'm not sure.).
Unfortunately, I have no idea what you're talking about. However, it would definitely be great if you could elaborate a bit.

After searching through the script for a bit, I could not find any instances of map variables being used in BCProsti.ssl .

Edit: Found it. I think you might be right... I will see what can be done about it.
 
Last edited:
Open your game save in the save editor and see how many variables are declared in your script.
I hope that you know how to use it.
 
Open your game save in the save editor and see how many variables are declared in your script.
I hope that you know how to use it.
Thanks for the pointer Mr Stalin! In the script editor it says that BCProsti.int has 7 local variables despite that I have set the number of local variables to 15 in party.txt scripts.lst . Would you know what might have caused this to happen?
 
Last edited:
@arroyoman
It sounds like your problem is that the amount of variables don't get updated.

I haven't done any fallout modding for a long time so my memory is a bit fuzzy. What I think I remember is this:

The local variables for the scripts are stored in the map save file where the script is located. I'm not sure when the space for the local variables gets allocated there. Probably the first time the script is run, or maybe first time you enter a map. Either way, it doesn't get updated later.
You might think Companion scripts are different since they are not only on one map, but the data just migrates from one map to another, it's not read from the script and then added to the map you move to.

So for it to work, you will have to either start a new game or load a previous save where you haven't been to her map yet (or maybe it's enough if you haven't talked to her yet).

I may be remembering wrong, but it might be worth giving it a try, just in case.
 
@arroyoman
It sounds like your problem is that the amount of variables don't get updated.

I haven't done any fallout modding for a long time so my memory is a bit fuzzy. What I think I remember is this:

The local variables for the scripts are stored in the map save file where the script is located. I'm not sure when the space for the local variables gets allocated there. Probably the first time the script is run, or maybe first time you enter a map. Either way, it doesn't get updated later.
You might think Companion scripts are different since they are not only on one map, but the data just migrates from one map to another, it's not read from the script and then added to the map you move to.

So for it to work, you will have to either start a new game or load a previous save where you haven't been to her map yet (or maybe it's enough if you haven't talked to her yet).

I may be remembering wrong, but it might be worth giving it a try, just in case.
Thanks Darek! I will try it out!
 
party.txt??? this file does not declare any variables.
No, but in his spoiler tag he writes in the format of what is in scripts.lst. So he probably did edit scripts.lst and later got confused about the name of the file. At least that is how I interpreted it.

If he really means party.txt, then yeah, that is obviously the problem!
 
Speaking of party.txt, how does it work? Following JimtheDinosaur's tutorial, I had configured party.txt and added another entry for my companion mod:

[Party Member 26] ; pMJasmine_PID
party_member_pid=16777271
area_attack_mode=be_sure, be_careful, be_absolutely_sure
attack_who=whomever_attacking_me, strongest, weakest, whomever, closest
best_weapon=no_pref, ranged_over_melee, ranged, unarmed
chem_use=clean, stims_when_hurt_little, stims_when_hurt_lots, sometimes, anytime, always
distance=stay_close, charge, snipe, on_your_own, stay
run_away_mode=none, coward, finger_hurts, bleeding, not_feeling_good, tourniquet, never
disposition=none, custom, coward, defensive, aggressive, berserk
level_minimum=4
level_up_every=1
level_pids=16777705,16777706,16777707,16777708,16777709,16777710

But it doesn't seem to be working. Do I have to start a new game for it to work too? Or did I miss something here?

Edit: started a new game and she does not level up.
 
Last edited:
But it doesn't seem to be working. Do I have to start a new game for it to work too? Or did I miss something here?

Edit: started a new game and she does not level up.
Does not work how? Nothing of it?
Does she level up but the new stats are not saved, or does she not level up at all? If it's the latter, where you a least level 4, since that is when you set her to start levelling up.
 
She does not level up at all, and my newly created character is at level 10... (using F12SE)

This is what I have done:
1) I created 6 new proto files using the proto manager
2) Created new entry for companion in party.txt
3) Assigned said proto files to party.txt
4) Edited the critpid.H accordingly, then compiled BCProsti.ssl

#define PID_JASMINE (16777271)
#define PID_JASMINE_STAGE1 (16777705)
#define PID_JASMINE_STAGE2 (16777706)
#define PID_JASMINE_STAGE3 (16777707)
#define PID_JASMINE_STAGE4 (16777708)
#define PID_JASMINE_STAGE5 (16777709)
#define PID_JASMINE_STAGE6 (16777710)

That's all I did. Please do let me know if I am missing something.
 
Last edited:
...That's all I did. Please do let me know if I am missing something.

You are missing level up floats, should be put in ...DATA\Text\English\Game\MISC.MSG
That shouldn't stop your companion from leveling up, but it may prevent you from noticing that she did.
You should still be able to see some text about it in the message window though. Are you sure that is not happening?

One more thing, are you sure your new proto files are put in the correct folder, and are they set to read-only (not base proto) so the game didn't delete them? Did you add them to the critters.lst file?
 
Last edited:
Thanks for the reminder, Darek, but I am sure that she did not level up as I'm using the combat control mod to pull up her character sheet. Her SPECIAL and hit points all remain the same.

The proto files are put into data/proto/critters, set to READ-ONLY, and I double checked to make sure that critters.lst was updated.
 
Since your protos are all there, the problem is most likely a mismatch with your pid numbers.

See the protos themselves contain their own pid number, and if you listed something else than that in party.txt, the game won't be able to find the correct protos. If your listed pid number in party.txt match up to any existing proto, your companion will level up adding from that proto, but if the proto doesn't exist, she will not be able to (as in she will be treated as a npc that doesn't level up).

So find out what the pid numbers in your protos are and add those values to party.txt instead of what you have now, and the level up should start working.
 
Back
Top