Jump to content

Fallout New Vegas GECK & Scripting Help 101


Recommended Posts

Guest tomm434
Posted

jaam, that's convenient.

Posted

On Mod Local Data

 

Implying (to my limited understanding of NVSE) that:

- GetAllModLocalData is broken

- ModLocalDataExists and RemoveModLocalData work correctly

- SetModLocalData and GetModLocalData sort of work, except the reference I stored appears to have been converted to a number

 

Try again with the new beta 6.

 

By the way thanks for testing and documenting it all.

 

Posted

About language and GetStringIniSetting: Unfortunatly the function seems to work but the data returned is useless :(

 

Guest tomm434
Posted

FYI, I was looking at Prideslayer's code and in it he sets references to 0 many times. I don't know why my script glitched. The only thing I know is that when I set it to 0, quest stopped working ingame. So let's consider that it was my mistake.

Posted

Can anyone give me an example or some reference to look at, in order to learn how to use a UDF to make contact between two scripts? Basically, if I call a UDF in one script, I need it to to modify a value in another script? Is something like that possible with NVSE 4?

Guest tomm434
Posted

You can SetFunctionValue inside the function and then do a script

if eval (1 == call YourFunction)

in function you do

int MyValue


if Quest.Value2==1
set Value to 1
else
set Value to 2
endif
SetFunctionValue MyValue

So in the first script "call YourFunction" will return "MyValue" from function

 

 

Posted

You can SetFunctionValue inside the function and then do a script

if eval (1 == call YourFunction)

in function you do

int MyValue


if Quest.Value2==1
set Value to 1
else
set Value to 2
endif
SetFunctionValue MyValue

So in the first script "call YourFunction" will return "MyValue" from function

 

I see, I'll figure out something with that. I'm guessing what ties things up is the "Quest.Value2" right?

 

What is the other script attached to?

The script in which it has to set a value is attached to a quest. But it will likely get called in several object scripts to modify that other value in the main quest script. 

Posted

I don't see why you couldn't directly affect the quest var from the udf, as you would in any other script.

 

let myquest.var := something

 

you could do something fancy with the udf's setfunctionvalue too of course:

 

let myquest.var := call myUDF

Guest tomm434
Posted

Agree with DoctaSax

 

 

I'm guessing what ties things up is the "Quest.Value2" right?

Block inside function is just an example - There you can add any code and any check you like

Guest tomm434
Posted

Is this a good way to end quest?

This code runs inside the quest

stopquest MyQuest
resetquest MyQuest
let VeryImportantVariable :=0
PrintC "Quest Ended"

"VeryImportantVariable" is important - it's better to set to 0 after quest is ended because it block dialogues from NPC(Dialogue with NPC(greeting) should not start while quest is running or there will be trouble). Is it possible for player to activate NPC between these lines if he spams "activate" button?

VeryImportantVariable :=0
{PlayerActivates NPC}
stopquest MyQuest 

And what is more reliable -to stop quest first and then reset it or vice versa? Will script run wholly under any cirsumstances?

 

 

 

Guest tomm434
Posted

Nomm it's about what line should I put first. I have "two chairs" dilemma here.

Posted

I was just curious why you didn't have the quest set (settings in the window rather than in a script) to repeat stages so that you wouldn't have to stop and restart the quest.

Guest tomm434
Posted

I was just curious why you didn't have the quest set (settings in the window rather than in a script) to repeat stages so that you wouldn't have to stop and restart the quest.

 

That's temporary repeatable quest for cutscene(Lunette heals player).I can't have it running during gameplay. I changed the system so quest is ended after end conversation(because it's not neat when player controls are enabled just before dialogue starts). So the end point of the quest is inside quest script now.

Guest tomm434
Posted

No it's still the same.

Posted

I had no end of trouble using resetquest. As near as I can tell it didn't work. In the end I made the quest non-repeatable. :dodgy:

 

 

I have an audio question. Is there a simple way to make several sounds play randomly?

 

I have a "band" and I'd like them to play more than one song but no matter what I do, I can't get radios to work. (I think it has to do with codecs.) BUT I can get the song to play as a standard sound object. The trouble comes in if I want more than one song to play.

Guest tomm434
Posted

I would point you to the Radio-creating quest but when I wanted to do the same feature as you, I coudn't understand the tutorial. You can try to do radio via scripts

int Chance
int PlayTime

let Chance := Rand 0 100

if Chance <=30
playSound MySong1
let PlayTime := 30 (playtime is different for each song)
elseif Chance >30 && Rand <60
playSound MySong2
let PlayTime := 50 
endif

Then start a timer. When timer ends (Timer >=PlayTime), run this code again

Posted

I think PlaySound is reliable, but only works for mono .wav files? ~5MB per minute, although they compress well for download. Not ideal, although probably acceptable if its under ~10 minutes total.

 

On ResetQuest, NVSE 4.1 added a new function:

 

 


        ResetAllVariables    sets all variables in a script to zero, unless called on a reference, apply to the calling script.
            [ref.]ResetAllVariables

(nvse_whatsnew.txt)

 

Although, I've never tried it...

Posted

Well there's an idea. I actually went through the radio tutorials once before in FO3 so it wasn't too bad setting it up this time. (They sure to make it as confusing as possible don't they?) My issue this time was that the songs wouldn't play in FONV at ALL. I tried every configuration I could. Mp3, ogg, and a boatload of different wav formats both stereo and mono. None worked. :s

 

However, that script should work perfectly! Thanks! I was really hoping I could have more than one song since that would get monotonous after a while. :angel:

 

 

EDIT: I actually managed to get playsound to work with a particular stereo wav format. I think it was 4bit unsigned stereo but I can double check if anyone is curious. All other stereo wav formats I tried either wouldn't work in the GECK and in game, or would work in the GECK but not in game. Annoying to say the least!

Guest tomm434
Posted

You can also try "Ref.playsound3D" -  sound will come from the direction of the reference.

 

Script worked? *sigh of relief*

 

Odessa, I don't see the difference by "resetquest" and "ResetAllVariables". I was asking about timing - which line should I put first  - which line order will be more reliable.(in case line order matters)

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...