Jump to content

Fallout New Vegas GECK & Scripting Help 101


Recommended Posts

Posted

Interesting day I've had,

 

I somehow crashed a token script on the player by trying to do something to a null reference, so I fixed the error in my code and reloaded the save, token is still crashed, getting no debug messages, checked the same scripted tokens on my companions and they were running fine, spitting out debug messages. So I removed the token and took a working token from one of the companions, still broken, so did a clean save and tried both tricks again, no luck on both options, only thing that worked was to go back to a previous save before I broke the token script.

Posted

Don't tell me Halstrom, I'm having a similar issue since few hours. At the end of a UDF I PrintC 4-5 different lines, I can see only 2 on console, like in an old version of that script. One reference returns an error on console, before, saying that it's null, while it's not true (I check it in game and I see a value), I'm really confused by this. Strange is I reload very old saves and I close my GECK everytime before trying in game... -_-

Posted

It might be restating the obvious, but have you tried restating your computer?  I've had instances where I got old results after changing an esp but then saw the changes after a reboot.

Posted

Yes I tried that and it seemed not being affected. But after some other tries ingame, after opening and closing GECK some times, after some other reloads... I don't know why it started giving me the right values. Oh, I more led to think there's some mistake in the script timing that comes out only in some certain conditions, I'm quite stressing the game. Awww silly me, I'm starting to think these UDFs are too big for me...

Posted

They work very fast, I use sometimes Return to split the script and restart the frame but I feel I wouldn't even need it.

 

I have 3 nested levels, I pass variables across them, my supposition was that in some cases these variables get wrong values on one of the levels and then propagate errors when calling the next level. But I'm getting very lost because of these levels, it's more probable I simply did some dumb mistake.

 

Still, I love how NVSE is showing me errors on variables in console, I never had them before, it is a very nice way to debug things.

Posted

OnAdd blocktype:  I'm realizing a possible problem in my mods.

 

Several use menus.  When you select a button, a token is added.  That token has an OnAdd block on it.  I use the add other item/remove other item workaround before using Remove Me on the thing that calls the menu.

 

Usually this works.

 

However, I was seeing in a previous post by Waffles that there's also an unequip/reequip weapon w/ a delay tactic that can also resolve the bug.  The problem is, I have no fucking idea of how you'd get that to work during a menu thing.  My understanding of when time is/n't passing both in and out of the game from its perspective is bad/shaky/non-existent.

 

While this happens to apply to the sex change during dialogue menu, perhaps this is also the problem I'm having where people using the Bangatron! aren't getting a menu when they press a hotkey.

 

Anyway...if anyone cares, here are the two scripts

 

SexChangeBook:  Since the Teach field is set to NONE, it's equippable.

 

 

 

scn SexChangeBookSCRIPT

int iButton

Begin OnEquip
	ShowMessage SexChangeMenu
End

Begin GameMode
	Set iButton to GetButtonPressed
	if (-1 == GetButtonPressed)
		Return
	elseif (0 == GetButtonPressed)
		Set SexChange.iPCSex to playerREF.getissex female
		Set SexChange.iSexChangeStatus to 1
		playerREF.additem SexChangeToken 1 1
		playerREF.additem pencil01 1 1
		playerREF.removeitem pencil01 1 1
		RemoveMe
	elseif (1 == GetButtonPressed)
		Set SexChange.iSexChangeStatus to 0
		playerREF.removeitem SexChangeToken 1 1
		if (SexChange.iPCSex)
			playerREF.dispel SexoutSheMaleEffect
		else
			playerREF.dispel SexoutHeFemaleEffect
		endif
		RemoveMe
	elseif (2 == GetButtonPressed)
		RemoveMe
	endif
End

 

 

 

SexChangeToken

 

 

scn SexChangeTokenSCRIPT

int iWasInDialogue

Begin OnAdd
	if (SexChange.iPCSex)
		playerREF.cios SexoutSheMaleEffect
	else
		playerREF.cios SexoutHeFemaleEffect
	endif
End

Begin GameMode
	If (iWasInDialogue)
		if (SexChange.iPCSex)
			playerREF.sexchange female	;Turn back into female
		else
			playerREF.sexchange male		;Turn back into male
		endif
		Set iWasInDialogue to 0
	endif
End

Begin MenuMode 1009
	if (SexChange.iPCSex)
		playerREF.sexchange male	;Turn Male
	else
		playerREF.sexchange female	;Turn Female
	endif
	Set iWasInDialogue to 1
End

 

 

Posted

is it necessary the add/remove item? I thought it was only for things that are equipped and not for misc tokens. I mean, I probably misunderstood the problem you are describing but I never have issues with scripted tokens and menus

 

anyway I was thinking, if you are afraid being in pause - menumode creates issues, wouldn't be easier inside the menu simply setting an external quest.var and then in a running gamemode putting something like "when that quest.var has this value then execute my script" ? so on the Sexchange token, on its OnAdd block I would set a var to 1, then on its Gamemode I would check that var and do the cios. I usually use that method in blocks that are not Gamemode

 

EDIT: now maybe I get it, you are running the script when the dialogue has already started and it must changes sex in the meantime? wow, that's impressive

Posted

IIRC, actors don't assess their inventory until stuff is removed.  So that's why add/remove.

 

I'll have to try your method.

 

There was a post in the Fallout Adult forum (I think) about changing you gender since some SO mods are restricted to female PCs only.  The idea is that since dialogue is done in 1st person, the player wouldn't notice the sex change occur, and that hopefully it would change it between the Greeting and whenever the next is female dialogue check is done.  Of course, jaam enlightened me that the conditions that you put on a quest are actually applied to every line of dialogue in the quest, so if the main condition on a quest is "get is female," it's not going to work at all.  However, the guy in the thread said that he could get the quests started if he changed his PC to female and then back after the quest was started.  The idea is to automate it.  Working on a small, interesting project allows me to avoid working on the daunting and way more complex projects.  :blush:

Posted

That would be pretty easy to do, but I posted in the other thread that it's probably not a great idea. It's a sledgehammer to smack a fly and would likely cause all kinds of other problems. The flip could get 'stuck'.. or it could flip repeatedly over and over again.. or who knows what else.

 

I suggested that modders who want to be more 'gender neutral' in that regard can check for the sexout genderbending spells in their scripts, but even then, the 'right' answer is simply for the player(s) who want the functionality to create it themselves. A few hours in the GECK to:

 

1. Create a custom race.

2. Use gender-reversed bodies and textures for the custom race.

3. Create the PC as a member of that race.

 

The end effect is a person picking 'female' gender during character creation, and seeing all the female perks and dialog options, but walking around with a male body. That is the effect the person asking about it was after, playing a 'sissy' male that everyone treats as female rather than male.

 

Addressing faces and hairstyles would probably be the most annoying part of the work.

 

Good luck in the attempt though, it'll be interesting to see how it works out. :) If you're not TOO far along, you might want to give this approach a shot instead, as it would be a simple standalone file that doesn't require sexout or anything else, and would affect the entire game, not just conversations.

 

Conversations are going to be problematic with gender swapping anyway once you toss Cherchez/Bachelor into the mix I think.

Posted

@pride:  Give the approach of the new race w/ faces and hairstyles a chance?  I did read your posts in the other thread.  Before you get something working, it's hard to tell how far along one is.  ;)   Scripting "something simple" fell into my interests.  Learning new stuff about dealing w/ custom races didn't.  : P  I found out that I was right up against my mod limit yesterday, so that could be why nothing was working yesterday (as in, not even the button toggling on and off).  I'll fuck around with it a little more today before renaming it Abandoned.esp.

Posted

Haha, understood. I think that the custom race is the best way to address it, and should be simple except for maybe the face/hair issues. Those might be simple as well, I haven't ever bothered with custom races so I wouldn't know.

Posted

I got it working.  I cleansed the script of derps!  Will post in the other thread.  The greeting is still starting sex, but you get the other sex's options after that.

Posted

Oh if anyone is wondering updating from Windows 8.0 to 8.1 seems to have fixed the GECK issue with Conditions in effects columns being all shoved to the left and minimised making them "invisible", but it was a pain, it screwed up all my modem network settings till I restarted the router/modem/computer a few times and screwed with things.

Guest Jezzy
Posted

Hi!

 

Which function do you use to find out the NPC race within a script? For exemple, how do you know the NPC is a SuperMutant or a dog?

Posted

Hi!

 

Which function do you use to find out the NPC race within a script? For exemple, how do you know the NPC is a SuperMutant or a dog?

GetIsCreature and GetIsCreatrureType for dog and SM.  Then there's GetIsRace, but I've heard that has problems on custom races.

Posted

Jaam reminds me of the cobbler and the elves.  You wake up one morning and there are shoes.

He's a real treasure, certainly. NX wouldn't be even half of what it is without his contributions to NVSE to support it.

Posted

Why the additional function?

 

If I had to guess to have a return for the race reference. GetIsRace requires you to specify the race and returns 0/1 and GetRace gives you the actual race ref.

 

Edit: It's documented in readme_changes.txt

 

 

Posted

if ar_HasKey MyArrayOfRaces, (SomeNPC.GetRace)

    SomeNPC.AddItemHealthPercent (ListGetNthForm MyGuns, (Rand 0, (ListGetCount MyGuns))), 1, (Rand 0, 1)

endif

 

if an NPC is of any particular race that I allow, give them some gun from my formlist in a random condition.

 

It would be more awkward with only GetIsRace.

Posted

if ar_HasKey MyArrayOfRaces, (SomeNPC.GetRace)

    SomeNPC.AddItemHealthPercent (ListGetNthForm MyGuns, (Rand 0, (ListGetCount MyGuns))), 1, (Rand 0, 1)

endif

 

if an NPC is of any particular race that I allow, give them some gun from my formlist in a random condition.

 

It would be more awkward with only GetIsRace.

 

Lovely, but wouldn't you need some sort of floor or abs function before your first rand?

 

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