Jump to content

How do I make a companion say something at a certain location


SirIdiot

Recommended Posts

I've made a companion and I want him to comment on places he visits. How do I make the condition for this?

I can do it for interiors easy (GetInCell) but I don't know how to do exteriors like goodsprings, novac, and such.

I can do it for places like freeside and the strip easy with the (GetInWorldspace)

 

What is the condition to make him only say it when he's outside? (Goodsprings, Novac, Primm, Nipton ect.)

Link to comment
Share on other sites

Use trigger zones. Script is like

 

scn scriptnamehere

 

Begon OnTriggerEnter Player

 

CompanionRef.Say TopicID

 

End

 

Don't use a doOnce loop, doesn't work at times. Flag say once on the dialog instead.

You can throw the say command anywhere, doesn't seem to break things. Try digging around in vanilla quest scripts and having them comment on quests too.

Link to comment
Share on other sites

Use trigger zones. Script is like

 

scn scriptnamehere

 

Begon OnTriggerEnter Player

 

CompanionRef.Say TopicID

 

End

 

Don't use a doOnce loop, doesn't work at times. Flag say once on the dialog instead.

You can throw the say command anywhere, doesn't seem to break things. Try digging around in vanilla quest scripts and having them comment on quests too.

 

The .Say is where he'll say something but not actually start a conversation with the player right?

Link to comment
Share on other sites

@SirIdiot-

There is the potential for compatibility issues using triggers. The good thing about them is it gives you finer control over where you want the companion to comment, the bad thing is you are touching cells to get comments into the game. With scripting you are pretty much guaranteed to never have compatibility issues (good), but it's more of a challenge to get comments exactly when/where you want them (bad).

 

If you are still interested in looking at how you might script for exterior locations other than using GetInWorldspace you can go look at how the devs did it for Cass in her VCassTimerRegionBarkScript.

Link to comment
Share on other sites

You might want to check if the companion is with waiting too.
I used Regions as used with Cass (see VCassTimerGeneralBarkScript and VCassTimerRegionBarkScript), except Cass says them to herself and not the player. I added to the example a situation that checks against a vanilla script variable. This is a sample of what I have done and I know it works. Also, Bob will not say the related line, if Bob happens to visit the same region with the player later. That wasn't necessary in this case, but I added it as an example.
Another feature of this example is that the Barks happen only once. Cass' scripts allow for repeats, but only after a certain amount of time has expired.
You can use the Regions editor to get an idea of the defined regions. The Regions names listed there will tell the you value you need for the IsPlayerInRegion function.
I didn't want to add trigger boxes to the world and this example shows an alternative method. Having a look at the Regions editor will give you a good idea of how other things in the game are achieved. I was just about to try and define my own region since the MapPrimm Region was not working for me. I instead found the AudioINCPrimm Region.
scn BobCompQuestScript
 
int BobBarkDone1
; ...(some other code you might have)
 
Begin GameMode
    ; ...
    if BomCompREF.Waiting == 0 && BomCompREF.HasBeenHired == 1
        if BobBarkDone1 == 0 && IsPlayerInRegion AudioINCPrimm == 1 && VDialoguePrimm.bPlayerWarned == 1
            ; DialoguePrimm.bPlayerWarned gets set to 1 after being warned by the NCR Trooper.
            ; This will make Bob say his BomCompBarkNCRPrimm topic defined in conversations
            BomCompREF.SayTo Player BomCompBarkNCRPrimm 1
            set BobBarkDone1 to 1
        endif
        ; ...
    elseif  BomCompREF.HasBeenHired == 0 || BomCompREF.Waiting == 1
        if BobBarkDone1 == 0 && VDialoguePrimm.bPlayerWarned == 1
            ; If Bob was not with the player when he was warned, then he
            ; will not say the related line.
            set BobBarkDone1 to 1            
        endif
    endif
    ; ...
    
End ; GameMode

Edit: Somewhat ninja'd by IIamaRCA.

Edited by trilioth
Link to comment
Share on other sites

 

You might want to check if the companion is with waiting too.
I used Regions as used with Cass (see VCassTimerGeneralBarkScript and VCassTimerRegionBarkScript), except Cass says them to herself and not the player. I added to the example a situation that checks against a vanilla script variable. This is a sample of what I have done and I know it works. Also, Bob will not say the related line, if Bob happens to visit the same region with the player later. That wasn't necessary in this case, but I added it as an example.
Another feature of this example is that the Barks happen only once. Cass' scripts allow for repeats, but only after a certain amount of time has expired.
You can use the Regions editor to get an idea of the defined regions. The Regions names listed there will tell the you value you need for the IsPlayerInRegion function.
I didn't want to add trigger boxes to the world and this example shows an alternative method. Having a look at the Regions editor will give you a good idea of how other things in the game are achieved. I was just about to try and define my own region since the MapPrimm Region was not working for me. I instead found the AudioINCPrimm Region.
I prefer scripting as well (although I use the occasional trigger if I need it). Funny what you found with MapPrimmRegion. I've never been able to get Sloan to work. I finally threw down a marker to use for comments.
Link to comment
Share on other sites

I prefer scripting as well (although I use the occasional trigger if I need it). Funny what you found with MapPrimmRegion. I've never been able to get Sloan to work. I finally threw down a marker to use for comments.

MapPrimm didn't cover the area where I need the bark to fire, where as AudioINCPrimm did.

 

I found a region named VMapSloanRegion; it only covers four cells in the worldspace WastelandNV: (-8, 2), (-7,2), (-8, 1) "Sloan" and (-7, 1). I haven't setup any barks for that region, but I hope that information helps.

Link to comment
Share on other sites

 

I prefer scripting as well (although I use the occasional trigger if I need it). Funny what you found with MapPrimmRegion. I've never been able to get Sloan to work. I finally threw down a marker to use for comments.

MapPrimm didn't cover the area where I need the bark to fire, where as AudioINCPrimm did.

 

I found a region named VMapSloanRegion; it only covers four cells in the worldspace WastelandNV: (-8, 2), (-7,2), (-8, 1) "Sloan" and (-7, 1). I haven't setup any barks for that region, but I hope that information helps.

 

Thanks :smile: I'll dig around in the map and see what I can figure out.

 

Edit: Those four cells are exactly at Sloan (as would be expected), but I've done extensive testing trying to get a comment at that location using isplayerinregion and it's failed time and time again. I have no explanation for why it won't work other than NV weirdness. It may even work for someone else and for whatever reason won't for me in this particular esp. I can get one from the marker I've put down so I solved it, but ya, weird.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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