Jump to content


Photo

Managing global NPCs not in party


  • Please log in to reply
12 replies to this topic

#1 nullset

nullset
  • Member
  • 18 posts

Posted 12 January 2016 - 05:03 AM

Is it possible to include !InParty global NPCs in a CHAIN dialogue? I have tried everything I can think of (SetNumTimesTalkedTo, MakeGlobal, JoinParty/LeaveParty). Of course, I have ensured that the NPC is in the near vicinity of the party, but when the dialogue reaches the == NPCDLG, it breaks. It works just fine with non-globals, but globals seem to be unrecognized. It would seem that global NPCs must be InParty in order to participate in a CHAIN dialogue.

What I am trying to do is set up invisible dummy global NPCs whose identities (name, portrait) I can modify. This I can do. Then I want to use those NPCs in a CHAIN dialogue without including them in the party. This way I can have a chat between functional characters whose identity varies at my whim. This would eliminate long lists of dependencies to determine who will make a particular remark. Mostly, these dependencies are based on InParty/!InParty, but other criteria are thinkable. I have developed quite an efficient protocol for determining and assigning identities, but it is quite useless unless I can use the dummy NPC in a CHAIN dialogue.

I already have the whole invisible dummy NPC thing working for non-global NPCs, but it is SLOW! I have to CreateCreature/Destroy every time I need them, with the bulk of the functional determination performed after they have been created.

With global NPCs, I could spread the functional determination over the course of the game in unnoticeable chunks, and just port (MoveGlobalObject) them in and out as needed.


Edited by nullset, 12 January 2016 - 05:05 AM.


#2 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5150 posts

Posted 12 January 2016 - 05:47 AM

-why ?
You check if the NPC is in party and then start the conversation if they are, and only if they are. Easy. No moves, no nothing.

Edited by The Imp, 12 January 2016 - 05:48 AM.

Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#3 nullset

nullset
  • Member
  • 18 posts

Posted 12 January 2016 - 07:36 AM

Because I want to code a multi-player banter that covers ANY party. Change the party members and the dialogue goes forward as is. With all the NPC mods out there, I would have thought that the utility of this would be fairly obvious. With the large number of NPCs available, a normal CHAIN dialogue gets unwieldy, and it becomes hard to maintain the priority trees of who says what when. This protocol allows addition of NPCs to a dialogue in discrete, easily localized (modular) code and tp2 insertion.



#4 Roxanne

Roxanne

    Modder

  • Member
  • 3564 posts

Posted 12 January 2016 - 07:42 AM

Because I want to code a multi-player banter that covers ANY party. Change the party members and the dialogue goes forward as is. With all the NPC mods out there, I would have thought that the utility of this would be fairly obvious. With the large number of NPCs available, a normal CHAIN dialogue gets unwieldy, and it becomes hard to maintain the priority trees of who says what when. This protocol allows addition of NPCs to a dialogue in discrete, easily localized (modular) code and tp2 insertion.

If I understand correctly, you want some generic text that <PLAYER2> issues in a CHAIN in response to <PLAYER3>, regardless of who those NPCs are when the banter triggers? i.e. NPC personality etc is not significant, you just want to use them as a foil to bring some text across?


The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*

 


#5 nullset

nullset
  • Member
  • 18 posts

Posted 12 January 2016 - 08:29 AM

Because I want to code a multi-player banter that covers ANY party. Change the party members and the dialogue goes forward as is. With all the NPC mods out there, I would have thought that the utility of this would be fairly obvious. With the large number of NPCs available, a normal CHAIN dialogue gets unwieldy, and it becomes hard to maintain the priority trees of who says what when. This protocol allows addition of NPCs to a dialogue in discrete, easily localized (modular) code and tp2 insertion.

If I understand correctly, you want some generic text that <PLAYER2> issues in a CHAIN in response to <PLAYER3>, regardless of who those NPCs are when the banter triggers? i.e. NPC personality etc is not significant, you just want to use them as a foil to bring some text across?

Hi Roxanne,

 

Not quite. I want to elliminate/reduce the priority triggers that are necessary when using either == partynpc or ==PLAYERn in a CHAIN dialogue. I want to define an InParty NPC functionally, and develop the dialogue using a functional !InParty NPC as a clone of the InParty NPC. I use a script protocol to determine which InParty NPC will be represented by which functional clone. The clone is then used in the CHAIN, which is no longer dependant on just who is in the party.

 

I have already established this protocol using non-global NPCs in my Rjali Romance mod, v4.1 of which can be found at BlackWyrmLair (Dragon's Hoard). The problem with non-global NPCs is that they have to be created before each use, and the functional determination protocol causes a significant delay before the dialogue can start up due to processing time. Use of global NPCs would allow the functional determination to be performed in little bits throughout the game, not just at dialogue time. This would elliminate the irritating delay.

 

I am currently working on v5 of the Rjali mod, and had hoped to use global NPCs. But it doesn't appear that they can be used in this way, which led me to see if I am missing something, by asking the modding community for advice. I am a relative neophyte at modding. There are a whole lot of things I don't know and, in the absence of documentation, I can only check other mods, experiment, and ask people such as yourself. I suspect that what I want to do with !InParty global NPCs is just not do-able, but confirmation would be nice.



#6 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5150 posts

Posted 12 January 2016 - 08:49 AM

Not quite. I want to elliminate/reduce the priority triggers that are necessary when using either == partynpc or ==PLAYERn in a CHAIN dialogue. I want to define an InParty NPC functionally, and develop the dialogue using a functional !InParty NPC as a clone of the InParty NPC. I use a script protocol to determine which InParty NPC will be represented by which functional clone. The clone is then used in the CHAIN, which is no longer dependant on just who is in the party.
If you summon the NPC before you start the dialog, you do not need the discover the who is what in the CHAIN, as they can natively summoned via the death variable, which the CHAIN can use. That would be a theoretical solution.

BUT:
I am currently working on v5 of the Rjali mod, and had hoped to use global NPCs.
Let us see your code. It will help. Someone to help you. My bet is that this is no where near what you actually try to do. Just saying.

Edited by The Imp, 12 January 2016 - 08:50 AM.

Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#7 nullset

nullset
  • Member
  • 18 posts

Posted 12 January 2016 - 09:23 AM

Let us see your code. It will help. Someone to help you. My bet is that this is no where near what you actually try to do. Just saying.

 

The code for the Rjali mod can be downloaded from: http://dragonshoard....oad.php?mod=389

 

Nope. What I said is exactly what I am trying to do. Whether you use Summon or CreateCreature, the result is still a non-global NPC. That I am already doing successfully. I want to do the same thing with global NPCs. Have a look at the code; you should see what I am doing.



#8 Roxanne

Roxanne

    Modder

  • Member
  • 3564 posts

Posted 12 January 2016 - 09:29 AM

Because I want to code a multi-player banter that covers ANY party. Change the party members and the dialogue goes forward as is. With all the NPC mods out there, I would have thought that the utility of this would be fairly obvious. With the large number of NPCs available, a normal CHAIN dialogue gets unwieldy, and it becomes hard to maintain the priority trees of who says what when. This protocol allows addition of NPCs to a dialogue in discrete, easily localized (modular) code and tp2 insertion.

If I understand correctly, you want some generic text that <PLAYER2> issues in a CHAIN in response to <PLAYER3>, regardless of who those NPCs are when the banter triggers? i.e. NPC personality etc is not significant, you just want to use them as a foil to bring some text across?

Hi Roxanne,

 

Not quite. I want to elliminate/reduce the priority triggers that are necessary when using either == partynpc or ==PLAYERn in a CHAIN dialogue. I want to define an InParty NPC functionally, and develop the dialogue using a functional !InParty NPC as a clone of the InParty NPC. I use a script protocol to determine which InParty NPC will be represented by which functional clone. The clone is then used in the CHAIN, which is no longer dependant on just who is in the party.

 

I have already established this protocol using non-global NPCs in my Rjali Romance mod, v4.1 of which can be found at BlackWyrmLair (Dragon's Hoard). The problem with non-global NPCs is that they have to be created before each use, and the functional determination protocol causes a significant delay before the dialogue can start up due to processing time. Use of global NPCs would allow the functional determination to be performed in little bits throughout the game, not just at dialogue time. This would elliminate the irritating delay.

 

I am currently working on v5 of the Rjali mod, and had hoped to use global NPCs. But it doesn't appear that they can be used in this way, which led me to see if I am missing something, by asking the modding community for advice. I am a relative neophyte at modding. There are a whole lot of things I don't know and, in the absence of documentation, I can only check other mods, experiment, and ask people such as yourself. I suspect that what I want to do with !InParty global NPCs is just not do-able, but confirmation would be nice.

I think you observed yourself the problem - it is slow and subject to loads of bugs (aside from the fact that it impacts Player1 dialogue and Baldur.bcs etc - which is always a bad idea.). You are also tweaking a large number of other people's mods to make yours work.

I looked a bit of the code you use in the Rjali mod

It is an alternative way to determine in a CHAIN dialogue who is supposed to say which generic line of the dialogue (including some branches for specific individual NPCs). The actual NPCs are represented by your strawmen creatures (each representing an NPC in the party) Instead of doing checks within the dialogue you put them to external scripts and external creatures.

The process requires a lot of preparation - I am not sure it really is so much easier to do it with your method than with the *traditional* one. The checks required for the dialogue to produce the expected resuls must be done, regardless of where it is performed and the effort for coding it stays the same.

 

I took a slightly different approach for similar goals in my own mod

I created one generic monster CHAIN dialogue which contains all the checks and priorities etc for all the NPCs in the game I am interested in. (This is work once done to be re-used for multiple occasions)  I use this one to fill it with individual contents for all types of situation to customise them - I just need to change the trigger for the CHAIN and replace the lines each candidate has to say - I can streamline the monster to have only females talk or only males etc. I can always add new NPCs to the chain when I like. Another advantage is that I can tune the text much better to the individual (e.g. Viconia would phrase the same contents slightly different from Nalia).

I need not affect critical scripts (like Baldur.bcs) I need no invisible creatures and hope they destroy after use, I need not multiple scripts to interact for the effect.

It is always best practice to keep things as simple as you can.


Edited by Roxanne, 12 January 2016 - 09:32 AM.

The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*

 


#9 nullset

nullset
  • Member
  • 18 posts

Posted 12 January 2016 - 10:47 AM

I created one generic monster CHAIN dialogue which contains all the checks and priorities etc for all the NPCs in the game I am interested in. (This is work once done to be re-used for multiple occasions)  I use this one to fill it with individual contents for all types of situation to customise them - I just need to change the trigger for the CHAIN and replace the lines each candidate has to say - I can streamline the monster to have only females talk or only males etc. I can always add new NPCs to the chain when I like. Another advantage is that I can tune the text much better to the individual (e.g. Viconia would phrase the same contents slightly different from Nalia).

 

I do see your point about tayloring the dialogue to specific characters. Any chance I could have a look at that generic monster CHAIN dialogue template that you use? I work only on BG2EE, but the concepts should apply.

 

The bulk of the tweaking of other people's mods is to make them multiple romance capable or faster on the dialogue, each of which is optional. There are a few that actually fix bugs that break the game, such as spelling "naive" with an i-umlaut.

 

I have experienced slowdowns/delays when a CHAIN dialogue carries excessive check and priority triggers. On the other hand, while each target NPC requires scripts to determine the strawmen, a maximum of 5 (InParty) are in play at any one time and only come into play on a target NPC joining or leaving the party. I have yet to see this impact gameplay. (I am talking here of v5, where I switched the strawmen determination from the strawmen scripts to the NPC scripts, which is the protocol I intended for global NPC strawmen.)

 

Bringing me back to my original query. Is it possible to include a !InParty global NPC in a CHAIN dialogue?



#10 Roxanne

Roxanne

    Modder

  • Member
  • 3564 posts

Posted 12 January 2016 - 10:57 AM

I created one generic monster CHAIN dialogue which contains all the checks and priorities etc for all the NPCs in the game I am interested in. (This is work once done to be re-used for multiple occasions)  I use this one to fill it with individual contents for all types of situation to customise them - I just need to change the trigger for the CHAIN and replace the lines each candidate has to say - I can streamline the monster to have only females talk or only males etc. I can always add new NPCs to the chain when I like. Another advantage is that I can tune the text much better to the individual (e.g. Viconia would phrase the same contents slightly different from Nalia).

 

I do see your point about tayloring the dialogue to specific characters. Any chance I could have a look at that generic monster CHAIN dialogue template that you use? I work only on BG2EE, but the concepts should apply.

 

The bulk of the tweaking of other people's mods is to make them multiple romance capable or faster on the dialogue, each of which is optional. There are a few that actually fix bugs that break the game, such as spelling "naive" with an i-umlaut.

 

I have experienced slowdowns/delays when a CHAIN dialogue carries excessive check and priority triggers. On the other hand, while each target NPC requires scripts to determine the strawmen, a maximum of 5 (InParty) are in play at any one time and only come into play on a target NPC joining or leaving the party. I have yet to see this impact gameplay. (I am talking here of v5, where I switched the strawmen determination from the strawmen scripts to the NPC scripts, which is the protocol I intended for global NPC strawmen.)

 

Bringing me back to my original query. Is it possible to include a !InParty global NPC in a CHAIN dialogue?

Simple answer - yes

Any creature InMyArea with a dialogue file can be used in CHAIN.


The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*

 


#11 agb1

agb1
  • Member
  • 1623 posts

Posted 12 January 2016 - 03:12 PM

What is the difference between a global NPC and a local NPC?


BiG World Fixpack (community collection of mod fixes and compatibility patches, with user-friendly cross-platform script)

 

BiG World Setup (tool to automate best-practice installation of Infinity Engine mods on Windows, with conflict analysis)

Latest version:    https://bitbucket.or.../get/master.zip


#12 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5150 posts

Posted 12 January 2016 - 03:22 PM

What is the difference between a global NPC and a local NPC?

From what I read, it's that as most if not all global NPCs have multiple .cre files covering them, the ones in the .are files, those are actually locally stored during the time they are summoned from the NPC que via the NPCLEVEL.2da file, when the PC first enters the area, and so they are stored there if you leave them there, or they are in the party if you take them with.

 

Now, if you want to move them, you can transfer them from area to area with scripts designed for that. Look Haiass and the genie mod and familiar scripts, they should have this feature. Now generalizing this to a mega feature is going to be a humongous deal... cause they all take part of a script, and it's a humongous ordeal to do it for ~160 NPCs if I remember my calculations correctly, based on this. And this will most definitely cause a bit of lag during the map entry phase.

 

Aka the idea is to have the NPC follow you even if not as a party member... and thus have all the dialogs they have cause they are in the same area... they don't necessarily need to come and fight for the Player Character, but they'll be in most of the areas anyways.


Edited by The Imp, 12 January 2016 - 03:41 PM.

Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#13 nullset

nullset
  • Member
  • 18 posts

Posted 13 January 2016 - 04:52 AM

What is the difference between a global NPC and a local NPC?

 

Global NPCs are those who are carried in the .gam file. They are, therefore, accessible in the game whether they are in your area or not. MoveGlobal can be used on them whether they are in your area or not. Including an NPC in your party or Make Global will cause an NPC to become global. Non-global (what you call local) NPCs can not be affected by MoveGlobal (except maybe if they are in your area).

 

The idea is to port them in (MoveGlobalObject) when needed, and off to Limbo (wherever you define that to be) when no longer needed at the moment. You can use a non-global NPC this way, but they must be created/destroyed each time because  attributes are not persisted across area transitions nor in saved games. Being in the .gam file has its perks.