Jump to content

Fallout New Vegas GECK & Scripting Help 101


Recommended Posts

Guest tomm434

So I want to add an item to all vendors in Fallout NW.

 

Do I have to add it to all vanilla containers (by their references) or there are some form lists from which items are added?

 

 

Or I can just do scanner of NVVendorChestsCell and add items to each container?

Link to comment

I think vendors are implemented inconsistently in FNV, some use the vendor chest cell, some use a chest in their own cell, some use their inventory, some chests contain leveled lists which you could add to.

 

So there isn't a clean way to add to all vendors, you could use all those approaches but wouldn't get all of them :(.

 

Warning: Miguel's (Westside pawn shop) vendor chest is a mismatched form ID between different localizations of the game, so scripts that reference it directly will fail for some users. That took me a long time to track down.

Link to comment
  • 3 weeks later...
Guest tomm434

Just wanted to share:

 

I found a way to prevent NPC from saying his original greeting and saying what you want him to say. That would be useful if you want original greeting to be overriden. (like if what NPC says when player activates him should be said by default). Sometimes Greeting topic doesn't fire right and you can see NPC saying lines from her original quest and ignoring your GREETING even if your quest's priority is set to be higher.

 

Need to use Events.

i'll just leave the code and explain how it works.

 

 

 

SetEventHandler "OnActivate" aaSCFunctionEventOnActivate "first":: Myself "second"::PlayerRef
Scriptname aaSCFunctionEventOnActivate

ref rActivator
ref rActionRef

int TypeOfActivator

string_var sv_NameNull

Begin Function {rActivator, rActionRef}
Print "UDEvent"


	if GetQuestRunning aaSCSlaveTalkQuest
		return
	endif


	if eval (1 == rActivator.call aaSCFunctionExtCheckActor)
	else
		return
	endif



let aaSCSlaveTalkQuest.sv_OldName := rActivator.GetName

let sv_NameNull :=""
rActivator.Setname $sv_NameNull


let aaSCSlaveTalkQuest.stage :=1
let aaSCSlaveTalkQuest.SlaveRef:=rActivator
startquest aaSCSlaveTalkQuest

sv_destruct sv_NameNull
Print "UDEvent ends"
end
Scriptname aaSCSlaveTalkQuestScript


int stage

string_var sv_OldName
ref SlaveRef

begin gamemode

if stage == 1
    Print "aaSCSlaveTalkQuest stage 0"
    Print "Old name in quest is " +$sv_OldName
    SlaveRef.SetName $sv_OldName
    Print "Name set"
    SlaveRef.StartConversation PlayerRef aaSCSlaveMAINGREETING
    sv_destruct sv_OldName
    let stage :=2
    Print "let stage:=2"
elseif stage == 2
    Stopquest aaSCSlaveTalkQuest
endif


end

begin menumode ; failsafe

if stage == 2
    Stopquest aaSCSlaveTalkQuest
endif

end

 

 

 

 

So event is fired after player activates NPC and before activation happens. My goal is to prevent that Activation from happening. For this I can

 

1)PushActorAway (player won't be able to activate him while NPC is in air)

2)Set NPC Unconscous

So in both of these cases player will notice the difference. (if you set NPC unconscious player will see "$NPCName is unconscious" message)

 

So my code stores old name of the actor, then sets name NPC to empthy string - that's why player can't activate NPC in the next frame. After event I have gamemode quest which sets name back to the actor and makes NPC initiate conversation with player.

 

Downside of StartConversation - if player activates NPC from distance more than 150 (I don't know the exact figure) NPC will need a second or two to initiate dialogue so player can leave the cell and so on.

 

Downside of AddScriptPackage (dialogue) - NPC will take time leaving furniture marker if she is using it and only then initiate conversation.

 

So pick your chair =)

EDIT: Hmmm. If you can check for "GetSitting" problem can be solved. StartConversation fires at any distance if NPC is using marker. And dialogue is initiated instantly if you set Activation distance far enough.

 

Also player will hear "Activation" sound but that's not really noticeable.

 

PS. don't forget to check for Actor state at the start of EVENT - events are persistent through game sessions even if you load another save where actor is not affected by your mod yet.

 

PSS. BTW that can be useful event for Sexout - now you can talk to NPC who is having sex and break the scene, initiate another sexout call etc..

 

Link to comment
  • 2 weeks later...

Hello all,


 


While currently crawling through a playthrough of DUST, it came to my attention that the mod author had disabled geckos in the wasteland. Thinking to my self that it would be interesting to create a gecko companion, I set out to find one on the Nexus. While most seemed very straightforward, one caught my eye; the "Gecko Flamer", a flamer weapon with a gecko model. However, I wanted to fulfill two needs; a rechargeable weapon and a trusty companion. Searching some more, I came across the "Deployable Sentry Gun", a turret which spawns upon placing a mine.


 


TL;DR, Would it be possible to script a Gecko Flamer, which upon being dropped or activated via an item or hotkey, "deploys" as a simple gecko follower. Once finished, interacting with the Gecko via dialogue, hotkey or on activation returns him to your inventory as a weapon.


 


Any tips anyone could give about how to script this concept mod as seamlessly as possible would be greatly appreciated.


 


The script that I have written goes like this: 


 


scn GeckoFlamerScript; begin OnUnEquip player; placeatme "WeapGeckoFlamerSPAWN" 1; End


 


I am unsure of where to go next with this, since the GECK wont let me choose this script in list for the Gecko Flamer Weapon. Also, I am unsure on how to make the Gecko activateable in order to return him to my inventory as weapon.


Edited by uygeskgcvkhzg
Link to comment
Guest tomm434

try this esp

 

You'll find weapon "GeckoPlacer" in GECK. Fire detonator to place Gecko, activate gecko to remove him. You can't spawn 2 geckos at once (see script)

 

 

 

Script for weapon has block "OnFire" - runs when you fire weapon.

Script for gecko has block "OnActivate PlayerRef"  - when gecko is activated by player = when player gets him in crosshair and press "E".

GeckoPlacer.esp

Link to comment

I'm trying to create a script to show the names of 2 NPCs in a message.  The message and script looks like below.  (sorry but I can't figure out how to add this to a spoiler, I see nothing to do that).  The debug print works perfectly.  I get a CTD everytime the showmessage runs.  I've played around with the variables and changed them to integers (and changed the %n to %g in the message) and the script runs with no problems.  For some reason, it does not like the %n variable.  I am running with NVSE 5.0 beta 1.  Any help would be appreciated.

ABCMsg

You have selected NPC %n and NPC %n for this act.
__________________________________

ref rPartner1
ref rPartner
Set rPartner1 to SunnyREF
Set rPartner to VeronicaREF
DebugPrint "You have selected NPC %n and an NPC %n for this act." rPartner1 rPartner
ShowMessage ABCMsg rPartner1 rPartner
Link to comment
Guest tomm434

Me too  - I haven't been able to get it working. So I use MessageBoxEx

string_var sv_message

ref rPartner1
ref rPartner

begin function{}

Set rPartner1 to SunnyREF
Set rPartner to VeronicaREF


let sv_message := "You have selected NPC %n and an NPC %n for this act. " + $rPartner1 + $rPartner

MessageBoxEX $sv_message ; keep "$" symbol

sv_destruct sv_message ; always destruct strings

end
Link to comment

 

Me too  - I haven't been able to get it working. So I use MessageBoxEx

 

 

tomm434 - Thanks for the tip on MessageBoxEX.  I was finally able to get it working.  The only problem I had was getting the string built.  For whatever reason, I could not build it as you suggested.  This code looked like:

This code did not work	
	
ref rPartner1
ref rPartner
string_var sv_message

Begin GameMode

	Set rPartner1 to SunnyREF
	Set rPartner to VeronicaREF
	let sv_message := "3: You have selected PC %n and NPC %n for this act. " +$rPartner1 +$rPartner
	DebugPrint "%z" sv_message
	MessageBoxEX $sv_message ; keep "$" symbol
	sv_destruct sv_message ; always destruct strings

This is what I finally was able to make work:

This code worked
	
ref rPartner1
ref rPartner
string_var sAPartner1
string_var sAPartner
string_var sv_message1

Begin GameMode

	Set rPartner1 to SunnyREF
	Set rPartner to VeronicaREF
	Let sAPartner1 := GetName rPartner1
	Let sAPartner := GetName rPartner
	let sv_message1 :="4: You have selected " + sAPartner1 + " and " + sAPartner + "for this act"
	DebugPrint "%z" sv_message1
	MessageBoxEX $sv_message1 ; keep "$" symbol
	sv_destruct sv_message1 ; always destruct strings
	sv_destruct sv_message sAPartner1 sAPartner1

Thanks again for you help. 

Link to comment

Ok so I I got an array with GLTA of all the possible leveled lists in the game. Now my issue is separating what is and isn't a leveled list that corresponds to a weapon. I know I could just use GLTA on a specific mod and all that and it'd be easier, but I want to be able to detect anything that is a weapon within a leveled list and then add it into the game. However, I don't suppose there is some way to open up a leveled list, and find out if its contents are weapons, that is unless there's some other way to pick out everything without resorting to IsModLoaded or anything that ends up relying on another mod. 

Link to comment
Guest tomm434

 

 

Me too  - I haven't been able to get it working. So I use MessageBoxEx

 

 

tomm434 - Thanks for the tip on MessageBoxEX.  I was finally able to get it working.  The only problem I had was getting the string built.  For whatever reason, I could not build it as you suggested.  This code looked like:

This code did not work	
	
ref rPartner1
ref rPartner
string_var sv_message

Begin GameMode

	Set rPartner1 to SunnyREF
	Set rPartner to VeronicaREF
	let sv_message := "3: You have selected PC %n and NPC %n for this act. " +$rPartner1 +$rPartner
	DebugPrint "%z" sv_message
	MessageBoxEX $sv_message ; keep "$" symbol
	sv_destruct sv_message ; always destruct strings

This is what I finally was able to make work:

This code worked
	
ref rPartner1
ref rPartner
string_var sAPartner1
string_var sAPartner
string_var sv_message1

Begin GameMode

	Set rPartner1 to SunnyREF
	Set rPartner to VeronicaREF
	Let sAPartner1 := GetName rPartner1
	Let sAPartner := GetName rPartner
	let sv_message1 :="4: You have selected " + sAPartner1 + " and " + sAPartner + "for this act"
	DebugPrint "%z" sv_message1
	MessageBoxEX $sv_message1 ; keep "$" symbol
	sv_destruct sv_message1 ; always destruct strings
	sv_destruct sv_message sAPartner1 sAPartner1

Thanks again for you help. 

 

 

I don't know why - I never checked that code  ingame, maybe suntax is wrong.. But you can easily make sv_message1 without additional strings if you want.

 

 

Link to comment
  • 3 weeks later...

Someone knows a way to retrieve base scale of an actor?

I dug around but I can't find anything about it. Tried with GetAV + some words but I didn't have any luck...

 

Nyaalichs resizer might have that in there somewhere.  I'm guessing it would be in SexoutNG as well for the setscale stuff.  Where it's at exactly if it is there, your guess is as good as mine.  It's where I'd look.

 

Link to comment

 

Someone knows a way to retrieve base scale of an actor?

I dug around but I can't find anything about it. Tried with GetAV + some words but I didn't have any luck...

 

Nyaalichs resizer might have that in there somewhere.  I'm guessing it would be in SexoutNG as well for the setscale stuff.  Where it's at exactly if it is there, your guess is as good as mine.  It's where I'd look.

 

 

 

thank you very much, I'll inspect them :)

 

 

 

I bet five bucks that they getscale :P

 

 

Link to comment

Yeah and the Set/GetScale isn't the same value as what you see in the GECK of the creature either. So if you have a creature that already is .5 of the original size by GECK and do SetScale .5 it will actually be .25 in size.

Link to comment

Not sure what you're asking.  : \

GetScale doesn't return the base scale.

If you have a creature base ID with a scale of 0.5, you drag a reference of it on the render window, and then you GetScale it, you will obtain:

- Via script, scale 1

- Via console, "scale 1, with a base of 0.5"

I wanted to see if there was a way to obtain that 0.5, or it would be impossible to understand properly the scale of an ingame actor, but I guess it's not possible and I'll have to use JIP's plugin for that

 

 

So if you have a creature that already is .5 of the original size by GECK and do SetScale .5 it will actually be .25 in size

it depends by where you are checking in the geck. You actually have 2 different scales, what you set in game should be the scale of the reference and not the scale of the base ID (which I was trying to retrieve)

Link to comment

This scale seems to be actor base height multiplied by actor base scale.

I created different instances of the same dog, and then I setted its scale on the ref window (so I didn't set the base ID, I setted the ref). GetScale was returning me that value. But the height should be 0 if I remember well

 

EDIT: yeah I confirm that, on my dogs GetScale is the ref scale and getnpcheight returns 0

https://drive.google.com/file/d/0B9H0W8lI6DR-OVFEdXhXZlVZV3c/view?usp=sharing

https://drive.google.com/file/d/0B9H0W8lI6DR-ajYyVjI2cXFFTEk/view?usp=sharing

Link to comment

Creature seem to use the base scale. NPC use the height.  That forms the base scale outputted by the console version of GetScale.

 

I was mainly interested in creatures because I was trying to obtain the GECK "Base Scale" field via script.

However I did few tries with humans for curiosity, to check the height.

While the "base scale" that it tells in the console when you write GetScale is the product of the ref scale x the height, as you say, it's not really a trusty value to understand the real size of a human, because it doesn't take care of the race.

- You make a ref of 0.8 >>> getscale will say that the scale is 0.8 and the base scale too (because 0.8x npc height)

- You make a ref of 1, with 0.5 height >>> getscale will say that the scale is 1 with the base of 0.5

- You make a race with 0.5 height >>> you will have a midget but both the getnpcheight and getscale (bot ref and base) will answer 1

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