Jump to content

Fallout New Vegas GECK & Scripting Help 101


Recommended Posts

Well, you could have a look at sexout's own scanner script, AJ.

Although with NVSE4, things might be a bit easier because you have "while" loops, so you could entirely copy the method from here & here.

 

Without a while loop, you'll need a label + goto loop, and probably also the GetNumRefs function.

Ahha, thanks Doc, your post nudged my brain with the GetNumRefs, I wasn't using it, it just clicked to me what I was doing wrong in my script

The GetRef commands don't work from the distance of the caster outwards they just go through the list by whatever order the were added or something so you need to check how many refs in the cell then check every one of them and see if they are close by distance :)

Link to comment

Oh Halstrom, I always check new posts around here, they're so useful to me! I just have serious difficulties in understanding the parts with scripts. As it always happens when I open scripts in another mod... I suppose I just need a very much biiiigger quantity of time, to understand them better... Sexout is complex and full of things, I doubt I can get what's written inside of that mod...

 

Anyway, is it "tree" and the other IDs in that Elder Scroll list the same IDs for NV too? I'm confused... what is "first" and what is "next"? is it based by distance, from the closer to the one more far away from the player? and if it's based on the distance, can it look at the distance from a NPC for example, and not the player?... concerning from what's written in that description, I'm trying to figure an example of its use. I'm thinking to DogMeat looking for ammos when we ask to do that... so Dogmeat (generally speaking...) will scan a total of 9 cells looking for ammos, I suppose I won't see that dog for a long time...

Link to comment

Oh Halstrom, I always check new posts around here, they're so useful to me! I just have serious difficulties in understanding the parts with scripts. As it always happens when I open scripts in another mod... I suppose I just need a very much biiiigger quantity of time, to understand them better... Sexout is complex and full of things, I doubt I can get what's written inside of that mod...

 

Anyway, is it "tree" and the other IDs in that Elder Scroll list the same IDs for NV too? I'm confused... what is "first" and what is "next"? is it based by distance, from the closer to the one more far away from the player? and if it's based on the distance, can it look at the distance from a NPC for example, and not the player?... concerning from what's written in that description, I'm trying to figure an example of its use. I'm thinking to DogMeat looking for ammos when we ask to do that... so Dogmeat (generally speaking...) will scan a total of 9 cells looking for ammos, I suppose I won't see that dog for a long time...

It's not distance based you basically get a list of all the objects in cell then check them as you go.

I could have used the SexoutScanner but it's based on the player, where I wanted to scan from the NPC/Object

 

My script for scanning NPC's is now this:

;						if fDistance < 3000 && PlayerREF.GetEquipped SOCFactionItems != 1 && PlayerREF.IsSpellTarget SOC3PerpetualOrgasm != 1
;							Set rTarget to PlayerREF
;							DebugPrint "%n Target is %n at %6.1f" rZActor rTarget fDistance
;						else
							Set iCnt to 0
							Set iNumRefs to GetNumRefs 200 1
							Label 1
							if iCnt < 1
								Set rTemp to rZActor.GetFirstRef 200 1 1								
							else
								Set rTemp to rZActor.GetNextRef
							endif
							Set fDistance to rZActor.GetDistance rTemp
							if rTemp.GetIsSex Female && rTemp.GetDead != 1
								DebugPrint "%n Temp is %2.0f %n at %8.0f" rZActor iCnt rTemp fDistance
								if fDistance < 3000 && rTemp.GetEquipped SOCFactionItems !=1 ; *** && rTemp.GetIsCreature != 1
									Set rTarget to rTemp
									DebugPrint "%n Target is %2.0f %n at %8.0f" rZActor iCnt rTarget fDistance
								endif
							endif
							Set iCnt to iCnt + 1
							if iCnt < iNumRefs	
								goto 1
							endif
;						endif ; *** End Player or NPC Target
Link to comment

Had another fun one today opened a script looking for a problem didn't see anything, changed one variable value from 9 to 5, then it wouldn't save, kept giving a bad End/Begin block error, so closed it and reopened the original and tried saving it, same problem it wouldn't resave, no idea how I managed to save it like that originally, so then I pasted the whole 800 line script into notepad and put it back section at a time looking for the error, in the end hour later, no error :P

Link to comment

Had another fun one today opened a script looking for a problem didn't see anything, changed one variable value from 9 to 5, then it wouldn't save, kept giving a bad End/Begin block error, so closed it and reopened the original and tried saving it, same problem it wouldn't resave, no idea how I managed to save it like that originally, so then I pasted the whole 800 line script into notepad and put it back section at a time looking for the error, in the end hour later, no error :P

 

Another thing that happened to me more than once. An example is this: you create a script attached to a quest and you'll use a variable in another script, as quest.var. Then, you create an ingame reference (I mean when you drag and drop an actor in the render window, then you double click and give the actor a specific reference name). Now if that reference name is the same name of your variable, you will be allowed to do that. But after that, if you'll reopen the script where you declared the variable, it won't save anymore. Same happens if you create a dialogue topic instead of a reference, with the same name of a quest.var, it will allow you to do it. Just a couple of examples but I think there are other ways to break this, using quest.vars.

 

EDIT: I don't remember if I ever checked this thing with PU on, as I usually do in this last period when I find weird things.

Link to comment

I've noticed in more than one place that 'Dispel' seemingly crashes effect scripts.

 

So, you have MySpell -> MyBaseEffect -> MyScript

 

with

 

Begin ScriptEffectUpdate

 

    PrintC "Attempting Dispel"

    Dispel MySpell  ;( or rSelf.Dispel MySpell )

    PrintC "Done Dispel"

 

End

 

Then in game the "attempting" line repeats and the "done" one never appears. Does anyone know why this may be?

Link to comment

Between the call to dispel and the effective dispelling, ScriptEffectUpdate can run again, so you end up calling dispel multiple times which may be the issue.

SexoutNG guards for that with a state variable that forbids dispelling more than once.

 

Link to comment

Yeah same with RemoveMe, I just make a habit of doing it for both now, when you call the end for a script to be sure you should block the script from running again

if iRemoving < 1

<Do Stuff>

	If iEndScript

		Set iRemoving to 1

		Dispel Myself or RemoveMe

	endif

endif
Link to comment

Is there a trick to make IsKeyPressed work or am i doing something wrong?

 

I'm breaking my head here trying to make a simple MessageBoxEx display some message when the M key is pressed

 

Here is my Script (Just for testing)

scn TestKeyPressedScript

Begin GameMode
	If ( IsKeyPressed 50 )
		    MessageBoxEx "M Key Pressed"
	Endif
End

But it's not working

I've attached this script into a new quest object with Start game enabled flagged, Script Processing delay default, saved as a new .esp plugin, loaded/launched the game and nothing happens.

 

Coded with NVSE beta version 3b2 (using nvse_loader.exe -editor shortcut command)

 

Any hints? Thanks

Link to comment

Now here's a problem

 

I'm trying to make SexoutLust.esp a master of SistersOfChastity.esp so I can add LustTracker tokens and harshen the effects

 

I assume you can make one esp a master of another?

 

I've tried 2 ways Opening the SOC.esp with Lust adding the items to my scripts then saving

 

And adding Override Actor Effect edits in FNVEdit

 

Both seem to work fine till I next open them in GECK then Lust is no longer a master and I get missing object or Duplicate object errors.

 

Anyone got any ideas on this one?

Link to comment

Geck does not like non mastered esp as master.

When you save a file in Geck all plugin without the esm flag are removed from the master list.

 

What you have to do is flip the esm flag on sexoutLust (using FNVEdit) before you try to use it as a master in GECK, and revert it back before play testing! Wonderful is'nt it ?

 

Other option: buildref the items you are interrested in. If you only need some tokens, that would be the easiest way.

 

Link to comment

Geck does not like non mastered esp as master.

When you save a file in Geck all plugin without the esm flag are removed from the master list.

 

What you have to do is flip the esm flag on sexoutLust (using FNVEdit) before you try to use it as a master in GECK, and revert it back before play testing! Wonderful is'nt it ?

 

Other option: buildref the items you are interrested in. If you only need some tokens, that would be the easiest way.

Cool, thanks, I'm glad it's just a usual GECK quirk,I think I will go with the BuildREF on this one for the Tokens. I can skip the effects not worth that much trouble, though I can probably BuildREF them to see if which spells are active.

Link to comment

This seems like the "right" scenario for SCR to handle, isn't it? Add the tokens (unscripted) to it, and put the scripts in the two mods.

 

Another option is to do the buildref to get the script base ID, and then assign your script to it, which you can do with RemoveScript/SetScript -- I think anyway, I've never tried them to see if/how they actually work.

Link to comment

This seems like the "right" scenario for SCR to handle, isn't it? Add the tokens (unscripted) to it, and put the scripts in the two mods.

 

Another option is to do the buildref to get the script base ID, and then assign your script to it, which you can do with RemoveScript/SetScript -- I think anyway, I've never tried them to see if/how they actually work.

Well when SexoutSpunk is expanded to cover Arousal & Lust it will be more NX based so the tokens won't be necessary anymore, Sisters is liely to be in Devolopment for a long time anyway, I really need to fire up the old XP PC today and get stuck back into a Siemens HMI SCADA project upgrade I'm supposed to have complete by the 10th :)

Link to comment

Here's a question, is there a way for an Armor item to get it's own REF like GetSelf, what I'm looking at doing is having a script used for multiple gestating baby tokens that recognises it's in different types of tokens so produces different results rather than currently I have a different personalised script for all 22 tokens. My other option is have it be able to send it's GetSelf, ProgressPercentage & GetContainer etc to a Quest script. Or would it be a handy NX command to have if possible?

Link to comment

Well, there are Get/SetTokenRef functions, but I'm surprised a simple GetSelf wouldn't work if you pass that to a ref var, and maybe get a getbaseobject in between?

Ah is there a Set/GetTokenREF function, I can't seem to find one.

 

GetSelf brings up a GECK error if used in a token and I think caused script crashes last time I tried it. It only works if the object script is in a Creature or NPC.

 

GetBaseObject sounds looks like it might do what I want though, I'll give it a whirl.

Link to comment

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use