Jump to content

Fallout New Vegas GECK & Scripting Help 101


Recommended Posts

Posted
10 hours ago, dborg2 said:

I'm running into a new issue.

I have a formidlist(A) with multiple forrmidlists, Like "B".

I have a script that browses through all formidlists within formidlist(A) to search for a form, and do stuff based, on it being found.

 

Now in game I have a different script that adds a form to formidlist B, but it seems that it isn't updating into formislist(A)-formidlists.

When my other script browses through FormIdList-A's formidlists, it doesn't find the new form, I added in 'B'.

 

Is thas bad programming on my side, or is it a bug from Bethesda, and what would be the best workaround?

 

Does re-adding FormidList-B to Formidlist-A fix it, or do i need to add a new formidlist-C to A?

As I see it, you should see the ones you added later too. Could you post both the scripts, one to browse through all the elements and one to add the form in B?

By the way, if you're using NVSE to add elements to lists, then it is a non-persistent operation and it should be repeated everytime the game restarts

Posted
1 hour ago, A.J. said:

As I see it, you should see the ones you added later too. Could you post both the scripts, one to browse through all the elements and one to add the form in B?

By the way, if you're using NVSE to add elements to lists, then it is a non-persistent operation and it should be repeated everytime the game restarts

SexoutP5SBodySwapSub is called by all swap-scripts periocally. (And gets a formidlist 'A' supplied)

 

SexoutSCR00SAddDLCStuff will be called when the user presses the 'SCR-MCM -Extra' button.

 

And picture is one of those FormIDLists (A) with in it a FormIDList 'B' that should work, but doesn't.

PregBodySwapOutfitOWBList.jpg

 

(Note that I called the 'AddDLCStuff' script in the same session as the rest of the testing I did)

SexoutP5SBodySwapSub.txt

SexoutSCR00SAddDLCStuff.txt

Posted

Mmmh... I don't wanna state the obvious... but I guess that your best deal would be first be sure that the lists REALLY contain what you are expecting. Instead than a simple DBPrintC, I'd dump them all, better if on a file so I could check in tranquillity.

Then and only then, when I'd be really sure that they are really loaded, I'd check why the second script doesn't browse correctly through the elements.

  • 2 months later...
Posted

I'm back again. This time running into the next scripting issue.

 

When wearing an outfit and P2 script SexoutP5SBodySwapOutfit.txt is called with 'actor' and '2' and it will call SexoutP5SBodySwapSub.txt  to find the P2-version of the outfit that 'actor'  is wearing, and return it.

 

The same scripts are called by P3, but then with the 'CurrentOutfit' + '3'. However, for all outfits, P2 is returned and I just can't find out why.

 

---(Edit from here)

I've managed to track down the issue to the SwapSub script.

 

Full ("edited for testing"-subscript)

Quote

scn SexoutP5SBodySwapSub
; argument vars
ref rSwapUpperBody
ref rCurrentOutfit
ref rGlobalList
int iBellySize
int iBellySizeTemp
int iMaxP
int iArrayLength

;other vars
array_var Entry
ref rCurrList

Begin Function {rCurrentOutfit, iBellySize, rGlobalList, iMaxP}
     Let rSwapUpperBody := NVFakeGolfBall
    Let iBellySizeTemp := 3 ; iBellySize
    if iBellySizeTemp > iMaxP
        Let iBellySizeTemp := iMaxP
    endif

      if ListGetCount rGlobalList > 0
          foreach Entry <- (GetListForms rGlobalList)
             let rCurrList := Entry["value"]
             if (-1 < IsRefInList rCurrList rCurrentOutfit)
                Let iArrayLength :=  Ar_size Entry                                           ; --->
                if iBellySizeTemp > iArrayLength 
                    Let iBellySizeTemp := iArrayLength
                endif    
                                                                                 ; <--- If I comment out this section. It works. At the risk of buffer-overflow
                let rSwapUpperBody := ListGetNthForm rCurrList iBellySizeTemp
                SetFunctionValue rSwapUpperBody
                printc "SexoutP5SBodySwapSub, found  %n" rSwapUpperBody    
                BREAK
            endif
        loop
    endif
    
    SetFunctionValue rSwapUpperBody
    return
end

 

For some reason iArrayLength becomes 2, and I can't figure out why.

 

Explanation of variables:

Quote

rCurrentOutfit = The outfit the actor is currently wearing
iBellySize = The size we want
rGlobalList = an Array containing outfit-Arrays (so 2 dimensional array). The different outfit-arrays don't have the same length though.

iMaxP = Some of the outfit lists contain 'garbage'. For instance there are 6 Not-pregnant NCR Trooperoutfits in FNV. I want to recognize all, but only use the default 1. These exception-outfits are in different globallists

 

Am I using the 'Ar_size' incorrectly? Or am I required to have all entries with the same array length?

 

Posted
On 2/12/2019 at 8:00 AM, dborg2 said:

I'm back again. This time running into the next scripting issue.

 

When wearing an outfit and P2 script SexoutP5SBodySwapOutfit.txt is called with 'actor' and '2' and it will call SexoutP5SBodySwapSub.txt  to find the P2-version of the outfit that 'actor'  is wearing, and return it.

 

The same scripts are called by P3, but then with the 'CurrentOutfit' + '3'. However, for all outfits, P2 is returned and I just can't find out why.

 

---(Edit from here)

I've managed to track down the issue to the SwapSub script.

 

Full ("edited for testing"-subscript)

For some reason iArrayLength becomes 2, and I can't figure out why.

 

Explanation of variables:

 

Am I using the 'Ar_size' incorrectly? Or am I required to have all entries with the same array length?

 

Update... I changed all the global-formidlists to contain the same amount of outfits, rewrote my swapping script SexoutP5SBodySwapOutfit and removed the 'Ar_size' check from SexoutP5SBodySwapSub.  Now it seems to work fine.

 

 

 

  • 8 months later...
Posted

Howdy could someone help me with a tiny issue Im having? 
Im new to moding and tried to do a simple mod that adds couple of prostitutes with vanila fade to black (at least for now) I wrote a script that removes 50 caps from player inventory and plays a sound effect along with fade to black this works however It didnt check player caps count so If players had 0 caps the script would play regardless and player would get a freebie. I added a condition to remedy this but now the dialogue option dont show up at all 

Screenshot_5.png

Screenshot_6.png

Posted
49 minutes ago, Dibella_Follower said:

Howdy could someone help me with a tiny issue Im having? 
Im new to moding and tried to do a simple mod that adds couple of prostitutes with vanila fade to black (at least for now) I wrote a script that removes 50 caps from player inventory and plays a sound effect along with fade to black this works however It didnt check player caps count so If players had 0 caps the script would play regardless and player would get a freebie. I added a condition to remedy this but now the dialogue option dont show up at all 

Screenshot_5.png

Screenshot_6.png

I'd try Target instead of Reference, in the condition

Posted

so in short i have to know coding in order too mod a pc game also nothing helps my issues my game freezes which FORCES ME to restard my computer EVERY FUCKING TIME

Posted
12 minutes ago, elleven117 said:

so in short i have to know coding in order too mod a pc game also nothing helps my issues my game freezes which FORCES ME to restard my computer EVERY FUCKING TIME

To mod a game, you have to know how to mod.

Posted
20 minutes ago, elleven117 said:

so in short i have to know coding in order too mod a pc game also nothing helps my issues my game freezes which FORCES ME to restard my computer EVERY FUCKING TIME

Depends on the mod for example if you want to make an armor you dont need scritping but you need to know how to make textures so photoshop skills, nothing creates itself you need some skills and motivation in everything you do 

  • 1 year later...
Posted

Howdy again I ran into a weird issue.
Basically  I wanted to convert Vikki & Vance gun from 9mm smg to 45 sub machine gun from honest hearths, everything went well until I tried to change the texture so it actually looks like Tommy gun from the DLC at first I couldn't find it in data folder that's when I learned everything is in BSA folders okay  I thought I extracted Honest Hearts BSA with MO2 to a folder on my desktop then i clicked to replce texture in GECK navigated to proper texture clicked accept and i get invalid directory error.

I assume solution would be to extract the BSA into new vegas data dir but my question now is this wouldn't that mess with anything? should I leave those files there or just leave the 45 smg texture? or am I wrong completely

Posted
3 hours ago, Dibella_Follower said:

Howdy again I ran into a weird issue.
Basically  I wanted to convert Vikki & Vance gun from 9mm smg to 45 sub machine gun from honest hearths, everything went well until I tried to change the texture so it actually looks like Tommy gun from the DLC at first I couldn't find it in data folder that's when I learned everything is in BSA folders okay  I thought I extracted Honest Hearts BSA with MO2 to a folder on my desktop then i clicked to replce texture in GECK navigated to proper texture clicked accept and i get invalid directory error.

I assume solution would be to extract the BSA into new vegas data dir but my question now is this wouldn't that mess with anything? should I leave those files there or just leave the 45 smg texture? or am I wrong completely

If it comes to textures, it should stay under Data\Textures, or some subfolder of that.

You assumed right: extracting inside NV folder is a good way to have right paths and be able to target these files inside the geck. However, if you already installed some mod which replaces vanilla (i.e. an armor replacer, just to say), this operation will overwrite everything.

 

Do you know how to use xEdit? imho it's the fastest way to write a path like that without extracting the files from the BSA and avoid to overwrite modded content.

Posted
10 minutes ago, A.J. said:

If it comes to textures, it should stay under Data\Textures, or some subfolder of that.

You assumed right: extracting inside NV folder is a good way to have right paths and be able to target these files inside the geck. However, if you already installed some mod which replaces vanilla (i.e. an armor replacer, just to say), this operation will overwrite everything.

 

Do you know how to use xEdit? imho it's the fastest way to write a path like that without extracting the files from the BSA and avoid to overwrite modded content.

Sadly im not familiar with xEdit.
And yes that could be a problem if it overwrites everything plus I don't think it would work for other people unless they would also extract BSA file to their data folder

Posted
1 hour ago, Dibella_Follower said:

Sadly im not familiar with xEdit.
And yes that could be a problem if it overwrites everything plus I don't think it would work for other people unless they would also extract BSA file to their data folder

Oh it will work! but I should explain better what there is behind, I'll do my best.

If you open a model in the GECK preview, that model will read the texture inside the BSA, and will show it, ok?

So more in general everything inside the BSA is still read from the GECK in a straight and transparent way, as if it was extracted.

But when you browse for a file because you need to put a path in the GECK, it will show the actual files you have in the folders, and NOT what's inside the BSA.

So, in the GECK you'll have troubles to specify a file and its path which is contained in a BSA, xEdit helps a lot with this.

 

I don't know if I explained you well, but the best deal in this specific case could be this: do not extract everything, to not overwrite your mods... but instead extract only the file/s you need, just be careful to make them end up in their vanilla position (which will be \Data\Textures etc.). After that, you'll be able to point them inside the GECK too. If a file is already present, because a mod is replacing it... well then you don't even need to extract it, just point to the replacer texture and you're good.

Posted
14 minutes ago, A.J. said:

Oh it will work! but I should explain better what there is behind, I'll do my best.

If you open a model in the GECK preview, that model will read the texture inside the BSA, and will show it, ok?

So more in general everything inside the BSA is still read from the GECK in a straight and transparent way, as if it was extracted.

But when you browse for a file because you need to put a path in the GECK, it will show the actual files you have in the folders, and NOT what's inside the BSA.

So, in the GECK you'll have troubles to specify a file and its path which is contained in a BSA, xEdit helps a lot with this.

 

I don't know if I explained you well, but the best deal in this specific case could be this: do not extract everything, to not overwrite your mods... but instead extract only the file/s you need, just be careful to make them end up in their vanilla position (which will be \Data\Textures etc.). After that, you'll be able to point them inside the GECK too. If a file is already present, because a mod is replacing it... well then you don't even need to extract it, just point to the replacer texture and you're good.

I think I understand now thanks

  • 3 years later...
Posted

Does anyone know what GetVATSFrontTargetVisible returns?

 

 

;===== Stalking Status =====
		let iAngle := rVictim.GetHeadingAngle rStalker
		let iAngle := Abs iAngle
		let iAngle := Floor iAngle
		
		if iAngle > iMinAngle || rVictim.GetRestrained || (rStalker.GetVATSFrontTargetVisible rVictim == 0)
			if eval !(rStalker.GetIsCurrentPackage rAI)
				if GetRandomPercent < fConfidence
					PrintD "SA: RE - Adding stalk package to " + $rStalker + " : " + (GetFormIDString rStalker)
					rStalker.StopLook
					rStalker.AddScriptPackage rAI
					rStalker.evp
					if rVictim == PlayerREF && GetRandomPercent < ( 2 * rVictim.GetAV Perception )
						MessageEx "You feel as though you're being watched"
					endif
				else
					return
				endif
			endif
		elseif rStalker.GetIsCurrentPackage rAI

 

 

I assume this function returns a boolean
1' if rStalker and rVictim are facing each other and rVictim is visible

But if I'm right, what does are "facing each other" mean in terms of angle?

 

Just out of curiosity...

I'm currently recoding SexAssault and I'm not going to keep things I don't understand. So in the worst case I'll rewrite it differently

  • 6 months later...
Posted (edited)

  

I've been having bugs for a long time with the recording of Log messages. I can't figure out what's wrong and I really need help.

The problem is that sometimes the contents of my log file are deleted. This makes it very difficult to track down the problem.

 

So I tried to pause the game shortly after my log file was deleted and this is what I got:

 

Example 1:

Spoiler

Buglog1.JPG.f8b6e7d7887eae7c31aea738c425146e.JPG

 

 

Here the problem is that the parts framed in orange should never be there.

I should have got :

SA: RR - Scanning for Poudrier renégat (0E012246), Victims available = 1
SA: RR - Stalker Poudrier renégat (0E012246) checking victim Testy

SA: SexAppeal value between Poudrier renégat (0E012246) and Testy (00000014) = 2.826 (CharismaDiff = 1.884, rapistTaste = 1.5, victim fBeautyExhibition = 1)

SA: RR - Poudrier renégat (0E012246) will find Testy (00000014) very attractive - Roll: 27% < Chance: 98% (Bonus multiplier was 3.5
               

Here is the script:

;==================================
; SexAssaultStalkerScriptGetVictim
; Added by Machiavelique September 01 2024
; Finds and returns the most attractive victim for a stalker. Called from SexAssaultStalkerScript only.
; The idea is just to reduce the code inside SexAssaultStalkerScript cause it's now too big and can't be compiled.
;==================================
scn SexAssaultStalkerScriptGetVictim

;*** Argument ***;
ref rStalker										; The Stalker

;*** Return Value ***;
ref rVictim										; The Victim

;*** Script Variables ***;
array_var entry								; Loop variable for browsing an array
ref rCurrentActor								; Loop variable corresponding to the actor currently browsed by the loop
float fChanceMultiplier						; Chance multiplier for the stalker is attracted by a nearby victim
float fSexAppeal								; Chance multiplier/divider for an NPC to become a stalker based on charisma difference stalker/victim and victim equipement
int iSize											; Used to store the size of an array
int iRand											; Used to store a random number
int iFinalChance								; % Final chances for a stalker being attracted to a victim after applying multipliers/dividers 
int iBestFinalChance							; If the stalker has found several attractive victims, iBestFinalChance is the score of the most attractive victim.


Begin function {rStalker}

	Let iSize := Ar_Size SexAssaultRR.victimsList
	Call SexAssaultPrintD 1 "SA: RR - Scanning for " +$rStalker+ " (" +(GetFormIDString rStalker)+ "), Victims available = " +$iSize
       
	foreach entry <- SexAssaultRR.victimsList

		Let rCurrentActor := *entry
		Call SexAssaultPrintD 3 "SA: RR - Stalker " +$rStalker+ " (" +(GetFormIDString rStalker)+ ") checking victim " +$rCurrentActor

		;*** Sexuality & Prevention Check ***;
		if rStalker.SameFaction rCurrentActor
			Call SexAssaultPrintD 3 "SA: RR - Skipping victim: " +$rCurrentActor+ " (" +(GetFormIDString rCurrentActor)+ "), cause is same Faction than this Stalker."
			continue
		elseif (rStalker.GetFactionRelation rCurrentActor < 2 && rStalker.GetAV Aggression > 1) || rStalker.GetFactionRelation rCurrentActor == 1
			Call SexAssaultPrintD 3 "SA: RR - Skipping victim: " +$rCurrentActor+ " (" +(GetFormIDString rCurrentActor)+ "), cause is hostile towards this Stalker."
			continue   
		elseif eval !(SexAssault.iGay) && rStalker.GetIsSex Male && rCurrentActor.GetIsSex Male
			Call SexAssaultPrintD 3 "SA: RR - Skipping victim: " +$rCurrentActor+ " (" +(GetFormIDString rCurrentActor)+ "), cause is Male, Stalker is Male, and Player set MCM Gay Off."
			continue
		elseif eval !(SexAssault.iLesbian) && rStalker.GetIsSex Female && rCurrentActor.GetIsSex Female
			Call SexAssaultPrintD 3 "SA: RR - Skipping victim: " +$rCurrentActor+ " (" +(GetFormIDString rCurrentActor)+ "), cause is Female, Stalker is Female, and Player set MCM Lesbian Off."
			continue
		elseif eval !(SexAssault.iStraight) && rStalker.GetIsSex Female != rCurrentActor.GetIsSex Female
			Call SexAssaultPrintD 3 "SA: RR - Skipping victim: " +$rCurrentActor+ " (" +(GetFormIDString rCurrentActor)+ "), cause is not of the same sex than this Stalker, and Player set MCM Straight Off."
			continue
		elseif SexAssault.iRelation && rCurrentActor.GetFactionRelation rCurrentActor > 1
			Call SexAssaultPrintD 3 "SA: RR - Skipping victim: " +$rCurrentActor+ " (" +(GetFormIDString rCurrentActor)+ "), cause is Friend or Ally with this Stalker, and Player set MCM Relation On."
			continue
		elseif rCurrentActor.IsInCombat
			Call SexAssaultPrintD 3 "SA: RR - Skipping victim: " +$rCurrentActor+ " (" +(GetFormIDString rCurrentActor)+ "), cause is currently in Combat"
			continue
		elseif rCurrentActor.GetDead || rCurrentActor.GetUnconscious || rCurrentActor.GetKnockedState
			Call SexAssaultPrintD 3 "SA: RR - Skipping victim: " +$rCurrentActor+ " (" +(GetFormIDString rCurrentActor)+ "), cause is dead/unconscious/knocked out"
			continue
		elseif eval (call fnSexoutActorInUse rCurrentActor)
			Call SexAssaultPrintD 3 "SA: RR - Skipping victim: " +$rCurrentActor+ " (" +(GetFormIDString rCurrentActor)+ "), cause is currently in a sex scene"
			continue
		endif

		;*** Optional Faction Checks ***;
		if rStalker.GetIsCreature
			Let fChanceMultiplier := SexAssault.fCreatureMult
		elseif rStalker.GetInFaction VCaesarsLegionFaction
			Let fChanceMultiplier := SexAssault.fLegion
		elseif rStalker.GetInFaction KingsFaction
			Let fChanceMultiplier := SexAssault.fKings
		elseif rStalker.GetInFaction NCRFactionNV
			Let fChanceMultiplier := SexAssault.fNCR
		elseif rStalker.GetInFaction GreatKhansFactionNV
			Let fChanceMultiplier := SexAssault.fKhans
		elseif rStalker.GetInFaction FiendsFactionNV
			Let fChanceMultiplier := SexAssault.fFiends
		elseif rStalker.GetIsClass PowderGanger
			Let fChanceMultiplier := SexAssault.fPowder
		elseif rStalker.GetInFaction BoomerFaction
			Let fChanceMultiplier := SexAssault.fBoomers
		else
			Let fChanceMultiplier := SexAssault.fOtherMult
		endif

		if fChanceMultiplier == 0
			continue
		endif
	
		;*** Victims attractiveness ***;
		Let fSexAppeal := Call SexAssaultSexAppeal rStalker rCurrentActor

		Let iFinalChance := SexAssault.fStalkerRate * fChanceMultiplier * fSexAppeal
		Let iRand := GetRandomPercent	
		if iRand < iFinalChance
			if rVictim == None
				Call SexAssaultPrintD 2 "SA: RR - " +$rStalker+ " (" +(GetFormIDString rStalker)+ ") will find " +$rCurrentActor+ " (" +(GetFormIDString rCurrentActor)+ ") very attractive - Roll: " +$iRand+ "% < Chance: " +$iFinalChance+ "% (Bonus multiplier was " +$fChanceMultiplier+ ")"
				Let rVictim := rCurrentActor
				Let iBestFinalChance := iFinalChance
			elseif iFinalChance > iBestFinalChance
				Call SexAssaultPrintD 2 "SA: RR - " +$rStalker+ " (" +(GetFormIDString rStalker)+ ") will find " +$rCurrentActor+ " (" +(GetFormIDString rCurrentActor)+ ") more attractive than " +$rVictim+ " and change target - Roll: " +$iRand+ "% < Chance: " +$iFinalChance+ "% (Bonus multiplier was " +$fChanceMultiplier+ ")"
				Let rVictim := rCurrentActor
				Let iBestFinalChance := iFinalChance
			endif	
		endif
	loop

	Let entry := Ar_Null
	SetFunctionValue rVictim

End

 

SexAssaultStalkerScriptGetVictim is a type Object script called from an effect script (SexAssaultStalkerScript) 

Logs framed in orange (SA - VH and SA - RP) come from type Quest script.

 

There is no reason why ‘SexAssaultStalkerScriptGetVictim’ should be interrupted in the middle of a script by a Quest scripts, and then resumed where it left off.
And each time it deletes the logs.

 

I really don't see what's causing this, especially as it's a random problem. Most of the time, it works fine (the scripts run without interruptions, and I have the logs without them being deleted). However, I have the feeling that using Events increases the chances of generating the problem. I'm currently trying to create a ‘TestLog’ mod to reproduce the issue but for the moment I can't manage it.

 

 

 

 

Example2:

Spoiler

Buglog2.JPG.b5c57ad569ffb87ca3e44da4863c40d3.JPG

 

 

 

 

 

 

 

 

 

 

 

Example3:

Spoiler

Buglog3.JPG.228d1ef84eadc5858934e637d70b878b.JPG

 

 

Here there are 2 victims available for the Stalkers (my character ‘Testy’ and ‘Sunny Smiles’). The game engine is running through a loop in the ‘SexAssaultStalkerScriptGetVictim’ script, then suddenly this loop seems to be paused, the VH and RP quest scripts are executed, then the loop is resumed where it left off.

Why ? I have no idea...

 

 

I'm still looking for the cause, but I have to admit that the problem seems rather complex and I don't know if I'll find it...

 

Files script:

SexAssaultStalkerScript.txtSexAssaultStalkerScriptGetVictim.txtSexAssaultSexAppeal.txtSexAssaultQuestRP.txtSexAssaultQuestVH.txtSexAssautPrintD.txt

Edited by Machiavelique
Posted

I've finally managed to locate the problem and it's worse than I thought. The deletion of the contents of the Log file is not the cause but the consequence of a more serious problem.

 

As long as there is no Event, scripts are supposed to be executed from top to bottom until the end of the block. Unfortunately, this is not entirely true. I've noticed that there's a problem between quest scripts and effect scripts.

 

Quest scripts can interrupt an effect script, and the effect script can resume and interrupt the quest script. When this happens, saving the console logs and using PrintD in the quest and effect scripts can lead to the logs being erased.

Here's a mod that makes it easy to reproduce the problem. I tested it with NVSE 6.3.5b and no other mod loaded (so just FalloutNV.esm and TestLog.esp).

 

It sounds like the game engine is managing the quest and effect scripts in parallel. If that's the case, it's strange that I didn't realise it sooner.

I still find it hard to believe that the game engine manages them in parallel because between two instructions in an effect script I sometimes find many instructions from two quest scripts that have been executed.

I don't really know what to think, I reported this problem on the NVSE Github but I don't know if I'll get an answer. I'd like to have other opinions/analysis. 

TestLog.esp

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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