Jump to content

Fallout New Vegas GECK & Scripting Help 101


Recommended Posts

Posted

I think you should just:

 

- Copy the messages from the original mod, HD00NukaMachineWithout and HD00NukaMachineWith

- Put ingame your nuka cola vending machine, create a new Base ID, flag persistent reference and give it a reference name called HD01NukaMachineRef, attach the script

- Inside the script, replace the MS05IceNukaCola with IceWater

- Replace NukaCola with your water (WaterPurified or WaterUnpurified)

 

I think it should be all

Posted

I think you should just:

 

- Copy the messages from the original mod, HD00NukaMachineWithout and HD00NukaMachineWith

- Put ingame your nuka cola vending machine, create a new Base ID, flag persistent reference and give it a reference name called HD01NukaMachineRef, attach the script

- Inside the script, replace the MS05IceNukaCola with IceWater

- Replace NukaCola with your water (WaterPurified or WaterUnpurified)

 

I think it should be all

yeah i see how it would work but i am so confused on what your doing... i am very new to scripting.

Posted

- the original mod has 2 messages, HD00NukaMachineWithout and HD00NukaMachineWith, I assume they are menus. You must recreate them in your mod or the script won't compile

- I also assume the original mod doesn't allow you to do that in every nuka vending machine, but only on a specific one, called HD01NukaMachineRef (the reference ID, not the base ID)

- The rest of the script essentially says "if it's the player which activates the vending machine, and he has at least 1 nuka cola, remove all his nuka colas and replace them with the same number of iced nuka colas". But it's doing it in a more sophisticated way, it uses menus with showmessage.

 

Still, I'm ASSUMING, I never took a look at that mod so I could be completely wrong. I have few of those vending machines scattered in my FO3, I don't know if it's DC Interiors or FWE which introduces them into my game, I never investigated that much :)

Posted

the default fallout 3 game has only 2 vending machines that you can add Nukas to for iced versions .

 and only 2  messages that appear when activating but only show when you have or don't have Nukas.

but if your getting more then that's probably because of DC interiors. 

i plan to use this script for my Nuka-Cola Mayhem Update for my mod on Nexus.

 

Posted

Fades are just imagespacemodifiers, so you copy or make some that last the length of time you want it to, and imod/rimod in a staged/timed spell script.

 

Here's something from SOFO that works with a fadeouttoblack imod, a "stay black" imod, and fadeinfromblack imod:

 

 

scn SOFOFTBandMoveScpt

float fTimer
float fFatigue
int iStage

Begin ScriptEffectStart

set fTimer to 0
set iStage to 1
set SOFOTraumaQst.iBusy to 1
DebugPrint "SOFO: Passing Out: Spell script started"
return

End

Begin ScriptEffectUpdate

set fTimer to (fTimer + ScriptEffectElapsedSeconds)
set fFatigue to GetAV Fatigue + 10

if iStage == 1
	if MenuMode
		return
	else
		disableplayercontrols 1 1 1 0 0 1 1
		imod SOFOISPassingOut
		set SexoutFleshedOutQst.rCurrentISFX to SOFOISPassingOut
		set iStage to 2
		set fTimer to 0
	endif
elseif iStage == 2
	DamageAV Fatigue fFatigue
	if fTimer > 3 
		if IsImageSpaceActive FadeToBlack4sISFX != 1
			DebugPrint "SOFO: Passing Out: FTB"
			imod FadeToBlack4sISFX
		endif
		if GetAV Fatigue <= 0 && fTimer > 6
			set iStage to 3
		endif
	endif
elseif iStage == 3
	DamageAV Fatigue fFatigue
	set SexoutFleshedOutQst.rCurrentISFX to SOFOISBlack
	imod SOFOISBlack
	rimod FadeToBlack4sISFX
	rimod SOFOISPassingOut
	dispel SOFOAutoDrinkActorEffect
	set SexoutFleshedOutQst.rCurrentISGeneral to 0
	rimod SOFOISDrinking
	player.moveto SOFODocMitchellGuestBedRef
	DocMitchellRef.moveto GSDocMitchellBesideMarker
	DocMitchellRef.addscriptpackage SexoutDoNothing
	if VCG01PlayerStartMarkerREF.GetDistance player < 100
		set iStage to 4
		set fTimer to 0
	endif
elseif iStage == 4
	DamageAV Fatigue fFatigue
	if fTimer > 10
		imod FadeInFromBlack4sISFX
		set SexoutFleshedOutQst.rCurrentISFX to 0
		rimod SOFOISBlack
		enableplayercontrols
		set iStage to 5
	endif
elseif iStage == 5
	if fTimer > 14 && IsImageSpaceActive FadeInFromBlack4sISFX
		rimod FadeInFromBlack4sISFX
	endif
	if GetAV Fatigue > 0
		set fTimer to 0
		set iStage to 6
	endif
elseif iStage == 6
	if fTimer > 3
		DocMitchellRef.startconversation player, SOFOTherapy2Drinking2CB
		set iStage to 0
		dispel SOFOFTBandMoveAE
	endif
endif

End

 

 

 

Thanks for that example. I believe I can tweak that to work as I intended. Basically, talk to an NPC, exit dialog, then fade to black while the animation clears and a few objects enable, then fade back in so everything is all pretty. Really only necessary for ZAZ related stuff.

 

Is it impossible to start two sexout animations at the same time in one cell? (It's probably documented somewhere that I missed as usual.) I had everything "working" code-wise at least but only one pair of NPC's started their animation while the other pair stopped due to....  er..  204? (I KNEW I'd forget!) I ended up just making a different cell for pair number 2. That seems to work out.

 

And....  dialog works wonderfully during a paused Sexout animation sequence! I'm already thinking up new ways to use the setup. I may have to put a cap on some of this or I'm never releasing! :blush:

 

Posted

I just noticed that a scanner (GetFirstRef - GetNextRef) can point to a disabled reference. I had to put an extra GetDisabled conditon to avoid that.

Posted

I believe it can point to dead and unconscious references as well. While on scanners, I have found that using 'GetFirstRefInCell' instead of 'GetFirstRef' can cause a CTD in some areas, seemingly only on repeat visits (at least in NVSE v3b2). Not sure why, but something to consider if you're trying to track one down. If you have sexout as a mod requirement, you can use its inbuilt scanner to save on repeat processing.

Posted

I believe it can point to dead and unconscious references as well. While on scanners, I have found that using 'GetFirstRefInCell' instead of 'GetFirstRef' can cause a CTD in some areas, seemingly only on repeat visits (at least in NVSE v3b2). Not sure why, but something to consider if you're trying to track one down. If you have sexout as a mod requirement, you can use its inbuilt scanner to save on repeat processing.

 

Any repeatable code to produce the CTD you know of ?

Posted

I believe it can point to dead and unconscious references as well.

 

Yes, I had to introduce a GetDead condition too. Funny is it wasn't working, it was still pointing to dead creatures. Now I introduced a GetAV Health > 0, which should be worse, instead it's working.

 

My scanner's doing weird things, I can't track down its behaviours. It's setted on a Default timing but I'm wondering if the problem is it can't scan in time and it breaks the script. The previous scanner was checking statics and it was almost instantaneous, but this one is... "strange". Any ideas on how much time a scanner should take to scan with a depth of 1? I mean, do I really risk to go over the Default timing? It's a 150 lines script but it's staged, to my eyes it doesn't seem too "heavy" to handle, excluding the scanner itself which I can't quantify.

Posted

Having the scanner return every reference by default is required. How would you go about removing dead bodies in a cell otherwise ?

 

Prideslayer's scanner can run at 1/10s intervals just fine. Looping through cells at level 2 should be instantaneous. What can consume time is trying to act on the returned values as part of the loop.

 

So you may be better off doing exactly like him: Fill up a list (or an array) as part as the scanner loop, then use another script to process the result. Or you can use his scanner directly :)

 

Posted

 

...I have found that using 'GetFirstRefInCell' instead of 'GetFirstRef' can cause a CTD in some areas, seemingly only on repeat visits (at least in NVSE v3b2)....

 

Any repeatable code to produce the CTD you know of ?

 

 

Yes, in the combat effect script of Jallil's final version of SexAssault,

    set rActiveCell to rVictim.GetParentCell;
    set rActor to GetFirstRefInCell rActiveCell 200 0;

Noted locations were visiting the Mojave Outpost and walking towards the bar (this was the one most tested), and also several other areas, including various exteriors, and interiors- including the Prospector's den near Primm and the Lakelurk cave in the Jacobstown mountains. On first visits it didn't always CTD, but once it had happened once it always repeated. I think I can dig up a save if you'd like.

 

It was hard to track down, and the same code seems reliable in other contexts. It was definitely those lines though, because when I replaced them with:

    set rActor to GetFirstRef 200 1

The CTDs stopped. Thinking about it knowing more now, perhaps GetParentCell for some reason returned 0? Haven't tested to see if 'GetFirstRefInCell 0'  CTDs. Odd that it could work on first visits, but always CTDed once it happened once- I tested a lot of times, and other people reported it too. Clean saving and disabling all other mods did not fix it, nor did combining with waiting in Doc Mitchel's house for a week.

Posted

Having the scanner return every reference by default is required. How would you go about removing dead bodies in a cell otherwise ?

 

Prideslayer's scanner can run at 1/10s intervals just fine. Looping through cells at level 2 should be instantaneous. What can consume time is trying to act on the returned values as part of the loop.

 

So you may be better off doing exactly like him: Fill up a list (or an array) as part as the scanner loop, then use another script to process the result. Or you can use his scanner directly :)

 

"level 2" is 9 or 25 cells?

I'd like to try that solution with arrays / lists

But I also would like to compare with a Find Package - Object Type (creature). The problem is I should write conditions for the creature itself inside the package, because in this way it still points to dead creatures. So I was wondering, if I put under the Conditions of the package a GetDead condition pointing to TARGET, does it make sense?

Posted

0 is one cell.

1 is 9 cells.

2 is 25 cells.

 

Except in interior, as any interior is a single cell.

 

Rather than GetDead, use (GetDeadCount > 0). GetDead can be unreliable for LevelledCharacter or NPC that have been reactivated or reenabled. (I saw some comments in vanilla scripts). And yes I don't see anything stopping you from giving a dead reference some packages :) .

Posted

I also thought to use a GetDeadCount, but I assume I should make a gbo of my scanned reference first, which introduces another function and would slow more my loop.

I'm... quite confused by the loop itself. I'm using a level 1 and yes, it's true,I introduce many checks inside the loop. Reducing them and setting the Delay time to 10 it works, but... I don't know, I still can't understand why it takes that much.

Essentially the scanner does this:

 

get the reference

   is the reference alive?

        is the reference hostile?

           is the reference disabled?

               is the reference closer than the previous one?

                   ok then assign that reference to the chosen one

 

               endif

          endif

    endif

 

I'm surprised because essentially the loop must check these things on a group of... 20?30? maybe 40? references, there are not that many creatures inside 9 cells. Do you think it's really such a heavy script to handle?

If I put a else - return, could that change something?

I'm asking these things because I'm more asking about the theory, since it's acting strange in game I can't really understand what happens when I try it.

Posted

What am I doing wrong that's making all of these duplicated records appear even though I haven't KNOWINGLY altered anything (nor is any of the data in the record changed from the master).  For example, the expanded block in the Worldspace.

 

NOTE:  Ignore the note in there about "the only record I'm concerned about."  That was just a note to A.J.

 

 

 

A4vcgi8.jpg

 

 

Posted (edited)

I wonder if un-nesting the chunks would change anything?

 

EDIT: I use the NG scanner, but I had a delay problem once where I switched from nested checks to un-nested checks, with the 'do' at the end, and a skip on each check to bail out and move on to the next one if filtered.  And that fixed it.  It was weird.  Just a thought.

Edited by t3589
Posted

I wonder if un-nesting the chunks would change anything?

 

EDIT: I use the NG scanner, but I had a delay problem once where I switched from nested checks to un-nested checks, with the 'do' at the end, and a skip on each check to bail out and move on to the next one if filtered.  And that fixed it.  It was weird.  Just a thought.

 

Could you explain me with a written example please?

 

I usually nest the chunks so that it will skip the next conditions when the previous ones are false, it's something I've read in a post of Cipsis and it made sense for me, essentially he was saying this:

 

if A

  if B

 

is faster than

 

if A && B

 

What I don't know if I must use a else return or not. Anyway, as I said, the fact it made sense for me doesn't mean it's true ^_^

 

Anyway for now I solved optimizing a little the script, putting a delay of 10 (which is far too high) and using cell depth 1 instead of 2. But STILL IT DID A MISTAKE GRRRR... after 20 creatures, it still found a dead creature, I don't have any more ideas on how to avoid that... first I used a GetDead and it wasn't working, now I used a GetAV Health > 0 and it worked fine until this last case. I will have to laugh when I'll have to add a "Is Enemy?" condition, since I still have to find a good way to check it... IsFriendDisposition doesn't work if they're yellow and will get aggressive in aggro radius; checking faction doesn't work too since animals are not really enemies...  using a list will avoid custom creatures... I'm confused.

 

EDIT: using a Find package, pointing to Creature as type and setting Get Dead == 0 - Target as condition didn't do the trick, the package won't be evaluated

Posted

You make an interesting point.  Nested is supposed to be faster.  When trying to figure out why my scan was delaying, it literally seemed that the script was 'too' fast for its own good.  Causing it to skip chunks.  Like I said it was weird.

 

When I say I took them out of nests I mean more like:

 

 

 

if A

return/abort

endif

 

if B

return/abort

endif

 

if abort=false

do

endif

 

 

 

In separate chunks.  I know it doesn't make sense to me either, but it worked.  Or at least it shifted the delay to a matter of the order in which the ref was received.  But I'm just guessing.  I stopped trying to understand it once I got it to work.

Posted

So, unnesting all the previous conditions, checking them one by one, and set an extra variable if the conditions are not satisfied. Well I can really try that, I tried everything... as first sight, I would say it's slower, but let me try that.

 

Now I just replaced a GetAV Health with a GetDead, again, and the script stopped working. I'm wondering if there's something wrong with this:

if (MyREF.GetDead == 0)

 

Is it wrong to write that, to check if MyREF is alive? Because if it's not wrong, it just means three things for me: 1) GetDead can't be used on a Gamemode block inside a Quest (I think I already used it in the past, but my memory is short... still in Beth guide it doesn't say anything about it); 2) GetDead is definetely a lot more slow and this breaks my script, or 3) GetDead can't be used on a scanned Reference, which is what I'm start wondering about... I already found that dinamic references have limitations and don't work with some functions, they really need you to point to a specific ref. So I'm wondering if a scanned reference is considered "dinamic"... *twice confused*

Posted

I'm certain it's slower.

 

I use 'if (myref.GetDead)' all the time, I don't see why the opposite wouldn't work.

 

You know what I think you're onto something.  This is for creatures correct?  I think it may have something to do with the ref itself.  It reminds me of this post

Posted

Well, it wasn't GetDead, it simply stopped working. But I think I understood why. Working with GECK opened and trying it ingame is causing issues. Maybe it's because both use NVSE and I never used it so much as in this mod. These random issues really took me in the wrong path, now it's even working with Default timing...

Posted

The best if scenario is the worst looking:

if not a
  return
endif
if not b
  return
endif
if not c
  return
endif
...

It's ugly but it has proven to be the most reliable.

 

:)

Posted

I am skeptical that:

 

if a

  if b

    do something

 

and

 

if a && b

  do something

 

doesn't compile down to identical code, but maybe I don't know compilers.

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