Jump to content

Companion not going to workbench in workbench mode


Recommended Posts

(edit) SOLVED.

 

I created a new package with a conditional for my looping scene. When the player is in workshop mode, the package 'IvySandboxNearWorkshop' becomes active. She now stays where she needs to be in workshop mode, regardless of the scene that runs.

 

(original post)

When you enter workshop mode in a settlement, companions go to the workbench and wait there, like the good cattle they are.

 

But... my custom companion doesn't want to leave me alone. When I go into workbench mode, she constantly comes back after several seconds.

I think its because of my custom script which I run in a timer, it starts a scene on conditionals every 30 seconds.

When I disable the script, this behavior goes.

 

I can't add a 'stayatselfscene' action, because it should be just dialogue, if I add that then the companion stops walking as you go through the commonwealth, every 30 seconds.

 

Adding a conditional of 'player is in workshode mode = false' in the 1st scene of the quest does not do anything, I think it's still running the scene in workshop mode.

She walks to the workbench as soon as I enter WB mode, but then 20 seconds later, she comes running back.

 

This is my current script without any conditionals:

Scriptname CompanionIvyScript extends Quest
Scene Property p_ivyCompQuestSpontaneousChatter Auto Const
Bool Property pIvyIsRecruited = False Auto

Function ivyListens()
    pIvyIsRecruited = True
    While pIvyIsRecruited
        Utility.Wait(30)
        p_ivyCompQuestSpontaneousChatter.Start()
    EndWhile
EndFunction

Function ivyDeaf()
    pIvyIsRecruited = False
EndFunction

I need to add it in script, like this:

 

IF NOT PlayerInWorkshop mode

<run scne>

ELSE

<do nothing>

ENDIF

 

Does someone know the correct statement I need to use?

Which variable can I check in script to see if the player is in workshop mode?

 

[edit] Do I need to set a boolean on this event, flipping it upon enter/exit? (That seems very dirty to me and inelegant)

Isn't there anything like 'PlayerIsInWOrkbenchMode'?

 

Event OnPlayerUseWorkBench(ObjectReference akWorkBench)

  • Event sent to the player when he uses a workbench
Edited by Reginald001
Link to comment
Share on other sites

There are two different operating contexts you may be referring to workBENCH mode (crafting) and workSHOP mode (building). I have not found an IsIn() function or conditional test for them so have been trapping my own events:

 

RegisterForRemoteEvent(ThisWorkshopRef, "OnWorkshopMode")

Event ObjectReference.OnWorkshopMode(ObjectReference ThisWorkshopRef, bool bStart)

 

You have to get the local workshop from location + the workshopparent script, can give U code for that. With the bStart flag you know if its enter or exit so all good.

 

 

RegisterForRemoteEvent(pPlayerActor, "OnPlayerUseWorkBench")

Event Actor.OnPlayerUseWorkBench(Actor akSender, ObjectReference akWorkBench)

 

Without an enter or exit flag you have to track the state yourself which needs robust state management.

 

 

Another approach is to use the workbench tutorial events which do have separate enter and exit functions, but they don't cover workSHOPs, DLC (nuka mixer) or modded or workBENCHES.

 

RegisterForTutorialEvent("ArmorWorkbenchEntered")

Event OnTutorialEvent("ArmorWorkbenchEntered", Message aMessage)

Link to comment
Share on other sites

There are two different operating contexts you may be referring to workBENCH mode (crafting) and workSHOP mode (building). I have not found an IsIn() function or conditional test for them so have been trapping my own events:

 

RegisterForRemoteEvent(ThisWorkshopRef, "OnWorkshopMode")

Event ObjectReference.OnWorkshopMode(ObjectReference ThisWorkshopRef, bool bStart)

 

You have to get the local workshop from location + the workshopparent script, can give U code for that. With the bStart flag you know if its enter or exit so all good.

 

 

RegisterForRemoteEvent(pPlayerActor, "OnPlayerUseWorkBench")

Event Actor.OnPlayerUseWorkBench(Actor akSender, ObjectReference akWorkBench)

 

Without an enter or exit flag you have to track the state yourself which needs robust state management.

 

 

Another approach is to use the workbench tutorial events which do have separate enter and exit functions, but they don't cover workSHOPs, DLC (nuka mixer) or modded or workBENCHES.

 

RegisterForTutorialEvent("ArmorWorkbenchEntered")

Event OnTutorialEvent("ArmorWorkbenchEntered", Message aMessage)

 

In this case I'm only looking at the workshop behavior. As you're building a settlement, it's important a companion doesn't get into the way.

So I need to check if the workshop is enabled (for any settlement workbench, anywhere), if I understand correctly this needs a workshop ref first:

 

RegisterForRemoteEvent(ThisWorkshopRef, "OnWorkshopMode")

Event ObjectReference.OnWorkshopMode(ObjectReference ThisWorkshopRef, bool bStart)

 

Which would mean I'd have to list all workshops and potentially miss a whole bunch of custom ones, right?

(I mean: I'd have to register the event for all known workshops in the game?)

 

Damned, it seemed so simple. 'Just check if the player is in workshop mode'...

 

So... onPlayerUseWorkbench won't even fire when I open the workshop, right?

 

I don't mind getting the exit event myself, e.g. 'not having the boolean' for it... I can wait with re-starting my script by just enabling it when the player equips a weapon, for my purposes that seems fine.

I just need one trigger moment, when the player goes into any workshop mode, so that I can tell my scripts to stop running for a bit.

 

(edit) I'm thinking of just adding a scene with a conditional that checks for IsInWorkshop mode, because that conditional DOES work in dialogue mode. I can then start a package to run to the workbench location instead. I was hoping that because the conditional is available through dialogue it would also be available through scripting but I haven't found anything. There are also no tutorial events for the workshop mode. :sad:

 

There is an F4SE script for it. Perhaps I'll look into that.

 

(edit) SOLVED.

 

I created a new package with a conditional for my looping scene. When the player is in workshop mode, the package 'IvySandboxNearWorkshop' becomes active. She now stays where she needs to be in workshop mode, regardless of the scene that runs.

Edited by Reginald001
Link to comment
Share on other sites

  • Recently Browsing   0 members

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