Jump to content

Fallout New Vegas GECK & Scripting Help 101


Recommended Posts

Posted

 

I had one case when she was looking to start conversation with player and then I entered another cell and she lost the package(though it was "MustbeDone" type of dialogue package) so I can tell you now  - that would fail someone sometimes. I can't make player "care" about when travelling with her - move slowly in case she has package active.

 

This is very interesting, this could even demostrate why vanilla handles packages in a different way (like I told some posts ago, about putting them all in their AI tabs and use conditions to evaluate them). Like in the case of Malcolm Holmes, he will stalk you for a long time, no matter what event happens, until he really will speak with you.

 

Well there is a difference with using the geck vs not; AddScriptPackage only works for one package at a time, so if you call it with PackA and a few seconds later with PackB, PackB will replace PackA -- it won't coexist alongside it, like packages added in the GECK do.

 

As this is a custom NPC (right?) it's probably smarter to add the package in the geck, as the top package, and put a condition on it checking a quest variable.

Guest tomm434
Posted

Well yeah, it's like free 10 seconds delay quest which sets appropriate package to NPC. :)

Posted

If you are using a custom NPC, add all packages in GECK.

AddScriptPackage can possibly fail in so many ways :)

 

Your custom NPC must support:

  Interrupt package. Dialogs, comments, combat... Any package the engine can choose to add.

  EVP. If you or the engine call EVP on the custom NPC, it must end up picking the package you want.

 

With addscriptpackage that means continuously verifying which package s running. With GECK package, you just have to make sure your conditions are correct.

 

Lastly your comment about addScriptPackage not checking conditions is extremely surprising. Do you have a repeatable scenario?

 

 

 

Guest tomm434
Posted

jaam, this at least works with dialogue packages. I added "GetPCsex female ==1" especcialy for you while playing male character just now and added dialogue to NPC and it worked.

Posted

Well yeah, it's like free 10 seconds delay quest which sets appropriate package to NPC. :)

Well no, because it doesn't keep adding it and removing it and doing all that crazy stuff. It just adds it once and it won't change unless a script adds one of its own, or the conditions specified in the geck change.

 

It's similar, but more reliable and simpler.

Posted

So apparently ListClear works now? Or does it?

Just had me a quick test & it seems to do as it's told.

 

I've tested it a few times with debug print to check and it seems to work. Has anyone tried TestExpr? (nvse_whatsnew says it might be untested)

Posted

Lastly your comment about addScriptPackage not checking conditions is extremely surprising. Do you have a repeatable scenario?

 

If you mean the conditions you insert inside the package itself, I just tried it today. I AddedScriptPackage MyPackage via console, MyPackage was a Dialogue package with a condition absolutely false (GetItemCount Abraxocleaner 20), still the npc talked to me when I closed the console

Posted

I've noticed using NVSE AddPackageAt instead of AddScriptPackage behaves differently (more reliably), but I believe it adds the package to the actor baseform and it persists until you quitgame (if you load another game it will still be there) and then is wiped. So you need to be careful with it.

Posted

I would like to have the ability to add DLC and TTW doctors to my Pregnancy test dialogue options without making them required masters.

 

My question is if I create a Formlist SexoutFLDoctors and have the DLC/TTW Doctors added to it by BuildREF, would putting a Target.IsInList SexoutFLDoctors as a condition add the Pregnancy test option to those doctors dialogue?

 

Or do I somehow have to modify their greeting topic too?

 

I really have NFI how this dialogue stuff works :)

Guest tomm434
Posted

 

Well yeah, it's like free 10 seconds delay quest which sets appropriate package to NPC. :)

Well no, because it doesn't keep adding it and removing it and doing all that crazy stuff. It just adds it once and it won't change unless a script adds one of its own, or the conditions specified in the geck change.

 

It's similar, but more reliable and simpler.

 

 

And still it's "free 10 seconds quest delay which setts approproiate package to NPC :dodgy: ". I meant exactly what you said. In my lab quets I use exactly this system and only  cast evp on actors(each number in packages names go for appropriate stage). Sorry for painting it over  - to much inside information :) . So, it's more reliable and even convenient, especially if you want actor just do sandbox between exact moments of your quest.

 

post-187071-0-17922000-1407473693_thumb.jpg

Guest tomm434
Posted

I would like to have the ability to add DLC and TTW doctors to my Pregnancy test dialogue options without making them required masters.

 

My question is if I create a Formlist SexoutFLDoctors and have the DLC/TTW Doctors added to it by BuildREF, would putting a Target.IsInList SexoutFLDoctors as a condition add the Pregnancy test option to those doctors dialogue?

 

Or do I somehow have to modify their greeting topic too?

 

I really have NFI how this dialogue stuff works :)

 

That would do it but only if doctors have greeting topic which has no responses in "dialogue choices". In this case all of their responses would be top level topics and that's where your quest comes in.

 

Also you could looking for "doctors dialogue faction" for TTW - I remember that some of the doctors were in it when I was doing alternatives ways for player to compensate healing services.  you can't use faction in dialogues without dependency

Posted

@Hal. I guess IsInList will do fine. If not, you can always populate your formlist, then loop through it & add each actor ref to a custom faction for GetInFaction or plant an NX var on them or whatever. Don't modify a greeting topic if you don't have to.

Posted

Can someone help me understand what eval does? I read its description, but all I got is that if an if fails, it'll send a message on the console to indicate something. Does eval stop the compiler from checking a whole if statement or something?

Posted

It is a bit tricky to get your head around at first, I attempted to explain it on the GECK wiki.

 

Essentially, 'eval' does nothing, it is just a hack to make the GECK compiler accept NVSE expressions (arrays, strings, UDFs) in if statements, as they will typically not be correctly evaluated for the condition without it.

 

Technically, eval is a function that reduces any expression (so everything to the end of a line or within enclosing parentheses) to a boolean (True or False, which is technically the number 1 or 0, respectively)

 

Eval is not necessary for while loops, as these are added by NVSE. It is unlikely one will ever find a use for it outside of 'if eval' or 'elseif eval'.

Posted

Ok so it use is to make GECK accept an if statement that uses those things as its parameters. I think I get some of it. So the other part refers to making an if a boolean, regardless of what it is checking. The compiler doesn't do that already though? 

 

Thanks for the answer. 

Posted

Yes, the compiler does do it already for 'if' statements. However, because 'if' is a vanilla command, and arrays/strings/UDFs do not exist in the vanilla language, it will not understand them properly. As I understand it, it will treat all string_var / array_var as an int, because this is how they are stored in scripts- the int is a really an ID number that refers to a string/array in the NVSE save file, but vanilla/old commands do not understand this. Hence:

 

string_var MyString

 

let MyString := "Bob"

 

; Within the script, MyString is stored as the number 25 (just example, could be any int ID)

 

if MyString == "Bob"

 

; is saying: 'if 25 == "Bob"'

 

if eval MyString == "Bob"

 

; is saying, 'if the string contents stored at #25 in the NVSE file == "Bob"

 

Eval and other NVSE commands understand that array/string/UDF(?) are not really ints, and replaces them with the expected contents before evaluating.

Posted

I see, I don't suppose that means I should use it with every let I have used on a variable because I've stuck mostly with let instead of set. I didn't have any issues but if it will improve anything, then I'll switch it. 

Posted

I'm not sure what you mean. Eval returns a boolean, so if you did that you'd be letting the variable to 0 or 1. Whilst its potentially sane to do this, it is unlikely most people will ever have a reason to use 'eval' outside of 'if eval'.

 

Let supports NVSE expressions already. let is to set what if eval is to if. They are both workarounds to make the vanilla compiler understand new features, since the existing language can't be rewritten from scratch.

 

You could swap all your 'if Condition' statements to 'if eval Condition' if you wanted.

Posted

Alright I see what you mean, what I meant was that if I did this: 

 

Let variable := something 

 

then I do not have to do this: 

 

If eval (something == some other thing) 

 

Basically if I declare with Let I don't need to use "If eval" if I want to make a check or something later on, do I?  I haven't had any issues by not using it, at least that's what I understood(or misunderstood) from the previous post. 

Posted

if you use "let", then NVSE will be interpreting/compiling your expression so you can reference anything that NVSE brings.

On the other hand "if" or "set" will be interpreted by the vanilla compiler so they are limited to functions that return vanilla types. Except if you opted to use the Compiler Override, because in that case EVERYTHING will be interpreted by NVSE.

Posted

It does not. There should be GetPerkRank in the near future...

 

BUT HasPerk/GetPerkRank and GetAltPerkRank can only work on the player. The structure they check only exists in the PlayerCharacter form.

 

I think you can apply perk to other NPC/Creature, but you cannot check if they are applied. :(

Posted

GetPerkRank would be swell, jaam!

The player-only issue isn't really a problem for me - the whole advantage of perks in the context of spunk/lust (no need for entry points) is that players can select them themselves, which is NA for NPCs.

Posted

Alright I see what you mean, what I meant was that if I did this: 

 

Let variable := something 

 

then I do not have to do this: 

 

If eval (something == some other thing) 

 

Basically if I declare with Let I don't need to use "If eval" if I want to make a check or something later on, do I?  I haven't had any issues by not using it, at least that's what I understood(or misunderstood) from the previous post.

No, that's not right.

 

You must always use eval if any of the things you're comparing with if are not native GECK types -- unless you use the compiler override.

 

You must use let instead of set for assigning NVSE types like string vars and arrays.

 

The bottom line is this: If you're doing something with a variable type introduced by NVSE, you must use functions provided by NVSE -- or the compiler override.

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