Jump to content

Fallout New Vegas GECK & Scripting Help 101


Recommended Posts

Yeah I found a lot of stuff like formlists, GetDead checks etc don't fill properly till up to 9 seconds, so all my stuff waits a few seconds before filling formlists, then doesn't start running till at least 9 seconds.

This sounds like a cool way to do it, currently I use a globalcounter in SCR and I have my mods check it has been under 9 seconds and is now over it before starting, because the global wasn't being reset to 0 in time, but that's not perfect either.

Link to comment
Guest tomm434

Wanted to share this script with you - it automaticly adds version# in MCM menu mod name.

string_var sv_SubmitVersion


begin GameMode
    if GetGameRestarted
        if IsModLoaded "The Mod Configuration Menu.esp"
            set iMaster to GetModIndex "The Mod Configuration Menu.esp"
            set rList to BuildRef iMaster 2790
            let sv_SubmitVersion := "Sexout Submit v1.0" + $SexoutSubmitVersion ; SexoutSubmitVersion -short global variable
            Setname $sv_SubmitVersion SubmitQuestMCMToken
            ListAddForm rList SubmitQuestMCMToken
            sv_destruct sv_SubmitVersion
        endif
    endif
end

Also another script  (based on Odessa's debug log) which makes debug filename look better (in my opinion) - it adds zeroes before numbers if they are less than 10

    let aUT := GetUserTime
    foreach entry <- (Ar_List "Year", "Month", "Day", "Hour", "Minute", "Second")
        let sv_svkey := entry["value"]

        if eval sv_svkey == "Hour"
            let sv_file_name += "-"
       endif

    if eval aUT[sv_svkey] < 10
        let sv_file_name += "-0" + $aUT[sv_svkey]
    else
        let sv_file_name += "-" + $aUT[sv_svkey]
    endif



    loop

Old version (without addition)

FalloutTTWQuestOverhaul-Debug--2015-2-20--11-3-49

 

New version

FalloutTTWQuestOverhaul-Debug--2015-02-20--11-03-49

 

Link to comment
Damnit, I had this problem fix itself when I updated from windows 8 to windows 8.1, 18 months ago, my hard drive crashed at Xmas and I had windows 8 re-installed on a new drive and updated to 8.1 and the GECK columns have never worked since, long before the march updates mentioned, stupid windows people :P
Link to comment
Guest luthienanarion

 

 

Scn SexoutOffSpring0RenameTokenScript

ref rPlayer
ref rMsgA
ref rMsgB
ref rTarget
int bMenu
int sAdded
int iRemoving

Begin OnAdd
    Set rTarget to GetContainer
    Set rPlayer to PlayerREF
    Set rMsgA to SexoutOffSpringNameMsgA
    Set rMsgB to SexoutOffSpringNameMsgB
    SetNameEx "%n" rPlayer rMsgA
    SetNameEx "%n" rTarget rPlayer
    GetPlayerName
    Set sAdded to 1
End

Begin GameMode
    if (0 == sAdded)
        Return
    endif

    if (1 == bMenu) && iRemoving < 1
        SetNameEx "%n" rPlayer rMsgB
        rTarget.SetActorFullName SexoutOffSpringNameMsgB
        PlayerREF.SetActorFullName SexoutOffSpringNameMsgA
        rTarget.NX_SetEVFo "SOF:rOffSpringName" SexoutOffSpringNameMsgB
        RemoveMe
        Set iRemoving to 1
    endif
End

Begin MenuMode 1051
    Set bMenu to 1
End

 

 

Here's the original version of that script (with comments intact) from my Renamer Rifle mod:

scn lutRenamerTokenOS

ref playername
ref itemname1
ref itemname2
ref actorname

short namemenu
short invalidref
short remove
short removed

begin gamemode

    if(remove)                                       ; Prevent RemoveMe being called more than once.
        if(removed)
        else
            set removed to 1
            removeme
        endif
    endif
    if(invalidref)                                   ; Abort the script and set the token for removal if the target is invalid.
        set remove to 1
        return
    endif
    if(namemenu == 1)                                ; Wait for the text input to close before renaming actors.
        setnameex "%n" playername itemname2          ; Copy the new player name to the "name" of MSG2.
        actorname.setactorfullname lutRenamerMSG2    ; Set the actor's name to the "name" of MSG2.
        player.setactorfullname lutRenamerMSG1       ; Set the player's name back to what we saved in MSG1.
        set remove to 1                              ; Set the token for removal.
    else
        set playername to player
        set itemname1 to lutRenamerMSG1              ; SetNameEx requires a ref variable for input, while SetActorFullName requires a MESG object.
        set itemname2 to lutRenamerMSG2              ; Point our ref variables to our MESG objects.
        set actorname to getcontainer                ; Get the actor the token is on.
        if(actorname)
            if(gettype actorname != 42 && gettype actorname != 43)
                set invalidref to 1                  ; Don't rename non-actor containers.
                return
            endif
            setnameex "%n" playername itemname1      ; Copy the player's name to the "name" of MSG1.
            setnameex "%n" actorname playername      ; Copy the actor's name to the player so that GetPlayerName shows the name of the actor.
            getplayername                            ; Open the player-name input box. This uses MenuMode 1051
        endif
    endif

end ; gamemode



begin menumode 1051                                  ; "Text-Edit" mode used by GetPlayerName.

    set namemenu to 1

end ; menumode 1051
It could probably be simplified, but it predates NVSE4. The player's name displayed in the Pip-Boy stats menu is updated by GetPlayerName but not by SetActorFullName; that's why the displayed name changes until the game is reloaded. (SetActorFullName is used instead of SetNameEx for renaming the actor because the change is permanent.) The correct name is used everywhere else. The extra guard against calling RemoveMe twice is included because an object script that calls it may or may not run an extra time and hit the RemoveMe call again, which crashes the game.
Link to comment

 

Damnit, I had this problem fix itself when I updated from windows 8 to windows 8.1, 18 months ago, my hard drive crashed at Xmas and I had windows 8 re-installed on a new drive and updated to 8.1 and the GECK columns have never worked since, long before the march updates mentioned, stupid windows people :P

 

 

This guy removed that update and solved the problem, so another confirmation of what stated above here.

http://forums.nexusmods.com/index.php?/topic/2679079-geck-error-dialogue-topics-and-conditions-invisible-and-uneditable/&do=findComment&comment=23514774

Link to comment
Guest tomm434

So after item is dropped by player inventory it becomes temp reference (reference starts with 'ff'). So is there any way I can check ref for that except for transforming reference into a string and checking if it starts with "ff"?

Link to comment

NVSE doesn't like it as it's more strict, so you have to resort to the old way of doing things.

 

int iRef
ref rRef

; .... rRef contains some ref
set iRef to rRef
if iRef >> 24 == 255
; ref is dynamic
endif
I also don't remember if you can do the shift and compare in one line or not. If not:

 

int iRef
int iShifted
ref rRef

; .... rRef contains some ref
set iRef to rRef
let iShifted := iRef >> 24
if iShifted == 255
; ref is dynamic
endif
Or if you'd rather avoid the shift.

int iRef
ref rRef

; .... rRef contains some ref
set iRef to rRef
if iRef >= 4278190080 ; this is 0xFF000000
; ref is dynamic
endif
Link to comment

I've been developing a few mods lately, and one of the more complex ones is the Armor Switcher. In my game I have 5 different body replacers running simultaneously, each is tied to a race (or a few). Armor Switcher is supposed to scan all actors and equip armor modeled after that replacer. Basic framework for it works, armors are reequipped depending on the race / body combination, but as I didn't test it out on a longer game yet, I'm curious if I'm missing out on something. I was initially trying to make it work on cell changing, but there's no block function that'll help me with that.

 

Here's the basic part of the code with one of the switching conditions (I'm going to move all the switches on different scripts, one for each replacer):

array_var people
array_var switcher
ref woman

begin GameMode

	let people := GetRefs 42 -1
	ForEach switcher <- people
		Let woman := switcher["value"]
		if woman.GetIsSex female
			if woman.GetIsRace Hispanic
				if woman.GetEquipped ArmorLeather
					woman.additem T6ArmorLeather 1 1
					woman.unequipitem ArmorLeather
					woman.removeitem ArmorLeather 1
					woman.equipitem T6ArmorLeather
				endif
			endif
		endif
	Loop

end

I still need to refine the parts for unequipping the armor and reverting it to a normal one and copying the condition for the armors being switched, so you don't get magically repaired armor every time you equip it.

 

My question is: Will it work on random spawning enemies, like raiders, patrols and other like that, or I need to add/remove something?

 

 

Link to comment

Looks fine, yeah.

I'm guessing this is only related to women, so you may want to skip males with a continue command at the top end of your loop, rather than go through a bunch of conditions that don't apply.

 

foreach ....

  if woman.getissex male

    continue

  elseif someothercondition

 

  endif

loop

Link to comment

This scrap checks for cell change, in case you need it:

        Let rNewCell := Player.GetParentCell
        if rNewCell == rOldCell
            PrintC "Same cell"
        else
            Let rOldCell := rNewCell
            PrintC "Cell changed"
        endif
Link to comment

Thanks, your suggestions are really useful, now I know how to improve things. :D

When I refine the mod and make it work as I want, might put it up here, I know people were asking for stuff like this, but nobody delivered, hehe...

If you do it on NPC's there's a nasty GECK trick that an object token script on a NPC can't add an item to an NPC for some reason, it causes CTD, but it works on a player fine, I had to use an effect or token script instead in Pregnancy and damaged armor swapping.

Link to comment

Aggh.... just spent 3 hours chasing this causing a script freeze, it compiles fine of course:

 

if iCurrDebug <> iPrevDebug

instead of this:

if iCurrDebug != iPrevDebug

Something left over in my brain from VIC20 BASIC days.........
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