Jump to content

Override Package?


FiftyTifty

Recommended Posts

Hullo folks, got a question 'bout packages.

 

At the moment, whenever I add a package to an NPC through a script (A sandbox package, in particular), it is ignored in favour of the NPC's default package. This causes the NPC to return to their editor location as if I never added a sandbox package in the first place.

 

Any idea how I can override this?

 

And yes, I made sure the sandbox package is set to "Current Location" rather than "Editor Location".

 

 

Thanks in advance.

 

Edit: I'll just add, this even happens to the "Wait" command on the companion wheel.

 

Now that I think about it, this could be an issue with TTW...

Edited by FiftyTifty
Link to comment
Share on other sites

Hullo folks, got a question 'bout packages.

 

At the moment, whenever I add a package to an NPC through a script (A sandbox package, in particular), it is ignored in favour of the NPC's default package. This causes the NPC to return to their editor location as if I never added a sandbox package in the first place.

 

Any idea how I can override this?

 

And yes, I made sure the sandbox package is set to "Current Location" rather than "Editor Location".

 

 

Thanks in advance.

 

Edit: I'll just add, this even happens to the "Wait" command on the companion wheel.

 

Now that I think about it, this could be an issue with TTW...

 

Have you set conditions in the package exactly the opposite of the default one package? Example: I'm taking this from my companion mod - GetQuestVariable JaneHasBeenSaved - 0 in the default package so she sits in the room, in the new package just change such a line to JaneHasBeenSaved to 1 so she will stand up and add the "YourCharacterREF.RemoveScriptPackage TheDefaultPackageName" and after that "YourCharacterREF.AddScriptPackage YourPackageName"

Link to comment
Share on other sites

If you use actorREF.addscriptpackage, you don't need any conditions on it. The script package will override the current AI package stack. However, it's buggy if the actor needs to traverse a portal (or the player leaves and comes back), or across savegames. In that case you would need to check if it is still active and re-apply it if not (through a quest script). Then that adds the problem of tracking the actors (NVSE and form lists, probably). I normally just use addscriptpackage for something that is going to start and end in with the player in the current cell, but you should be able to do what you want. It will just be more complex to work around.

Link to comment
Share on other sites

Just did some testing in-game, to see if the packages were bugging out. Using console commands, adding the package and then using the command "Evaluate Package" will cause the NPC to use the added package.

 

Need to figure out how to do this with a quest, though. It has to be non-specific to an NPC, however.

 

Edit: Is there something for Fallout's dialogue scripting system akin to Skyrim's? If you wanted to run a command in the dialogue window and reference the speaker, all you would have to do is "akspeaker.additem x xxx", for example. What is Fallout's equivalent?

 

Edit2: Found it; you just leave out the reference.

 

So instead of typing "xxxref.additem", you would type "additem". This probably only works for things such as packages and dialogue, where the script will be attached to an object/NPC.

Edited by FiftyTifty
Link to comment
Share on other sites

An evp is not needed for a scriptpackage added through a quest/object script, or added through a dialog/quest result script, or a spell. Switching between menumode (console) and gamemode is probably why you see that behaviour.

The default target for a dialog result script (and package result scripts) is 'S' or the subject doing the talking. So the reference for script commands here is implicit. You can also specify a reference if you don't want the script command to apply to the subject.

Object scripts also follow the implicit reference rule for functions. The functions apply to the reference that the script is running on unless you specify a reference.

Quest scripts and quest result scripts always need the reference to be specified.

Just an example:
This spell is called by a quest script to make my NPC do something.

call from quest RHKWendyRPQuestScript:

RHKWendyREF.AddSpell RHKWendyWalkToPlayerRepairEffect


scn RHKWendyWalkToPlayerRepairEffectScript

float fTimer
float fAnimTimer
float fTemp
short iDoOnce


BEGIN ScriptEffectStart

    if (Player.IsSneaking)
        RHKWendyREF.AddScriptPackage RHKWendyWalkToPLRepairSneakPKG
    else
        RHKWendyREF.AddScriptPackage RHKWendyWalkToPLRepairPKG
    endif
    set fTimer to 15    ;Fail-safe end the package
    DisablePlayerControls 1 1 1 1 1 1 0
    set fTemp to RHKWendyRP.PlayerAngleZ
    
END

BEGIN ScriptEffectUpdate

    if (RHKWendyRP.iPackageDone)
    else
        if (fTimer <= 0)
            set RHKWendyRP.iPackageDone to 1    ;Proceed regardless of position
            EnablePlayerControls                    ;in case it went bad
        else
            set fTimer to fTimer - ScriptEffectElapsedSeconds
        endif
    endif

    if (RHKWendyRP.iPackageDone == 1)
        set RHKWendyRP.iPackageDone to 2
    elseif (RHKWendyRP.iPackageDone == 2)
        set RHKWendyRP.iPackageDone to 3
        RHKWendyREF.SetAngle Z fTemp
    elseif (RHKWendyRP.iPackageDone == 3)
        set RHKWendyRP.iStagingDone to 3    ;advance the quest script stage
        set RHKWendyRP.iPackageDone to 6
    endif
    
END

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...