Skip to content

Making sure the right party PC speaks

chimericchimeric Member Posts: 1,163
When talking to an NPC, we can use the hero of the story or any companion. This creates a dilemma or rather a stylistic fork on the road in that the author of a mod can treat the PC chosen to do the talking as a proxy of the protagonist, and then use all of the specific references like "I grew up in a library," have the NPC address the speaker as "girl" or "boy" and so forth - this is how Baldur's Gate does it; or the author can try to write dialogue specific to the speaker. When Kagain speaks, hearing "boy" requires serious suspension of disbelief. Another issue that can mess up a conversation, as I'm now discovering, is that a PC you reserve for an interjection may be the one you are using to do the talking. I'd like to know how to prevent that. For instance, the conversation may go like this:

IF ~Kagain is not in the party~ THEN REPLY ~Here, good sir, take this 100 gold pieces!~ GOTO NEXT
IF ~Kagain is in the party and in sight~ THEN REPLY ~Here, good sir, take this 100 gold pieces!~ EXTERN ~KAGAIN~ HELLNO

The HELLNO response from Kagain will forbid the speaker from giving the NPC any money - a nice touch from the role-playing perspective. But what if Kagain was the character chosen to talk, so he was the one to say "Here, good sir, take this 100 gold pieces!" ? Is he going to argue with himself?

Comments

  • kjeronkjeron Member Posts: 2,367
    Trigger: CharName("scriptname",Object)
    CharName("KAGAIN",LastTalkedToBy)
    lolienCrevsDaak
  • chimericchimeric Member Posts: 1,163
    As far as I understand, you're offering alternatives here. Okay. So CharName() works? It's listed as NT in the G3 guide. But what should be the Object argument in the first option? Probably LastTalkedToBy() again, because Myself in a REPLY line refers to the NPC, as I know now. Also the protagonist doesn't have a script name, right?

    The second one seems to be it for finding out if it's Kagain doing the talking. Then again, if you think about it, how would Kagain even offer gold in the first place - never mind interjecting or not? The trigger with ! should probably go before the generous line, so it's not even available.

    Okay, good. Thank you.
  • jasteyjastey Member Posts: 2,669
    edited February 2017
    The protagonist's script name would be Player1, I think?
    Is he going to argue with himself?
    That's a very good point and one reason why the way the engine is handling the dialogues with any "GABBER" doing the talking is unfortunate, not only from the RP perspective.

    I have no good solution for this (and, tbh, I don't want to think further about it, or my head explodes). I always head canon the PC doing the talking, and luckily for me, my PC is usually taking the first slot...
  • chimericchimeric Member Posts: 1,163
    Yes, and we know how Torment handled that problem. But there are advantages to the fact that others can speak, too. I've once suggested here an alignment mod that would shift the alignment of the speaker for various good and bad quests and deeds. That way, selecting speakers consistently, one could role-play a gradual change in the NPC, e.g. Kagain could turn into a Lawful Neutral dwarf first, then perhaps even into a Lawful Good one, or maybe shift to chaos, depending on "his" decisions. That way there would actually be a party of companions in the adventure instead of one important Bhaalspawn and a retinue of static accessories. But most people seem to prefer their NPC as set pieces.
  • AstroBryGuyAstroBryGuy Member Posts: 3,437
    edited February 2017
    To make sure Kagain doesn't interject when he is the speaker, just use the right triggers.

    Trigger on the "no Kagain interjection" response:
    OR(4) !InParty("Kagain") IsGabber("Kagain") Dead("Kagain") StateCheck("Kagain",CD_STATE_NOTVALID)

    Trigger for Kagain's "Hell no!" interjection:
    InParty("Kagain") !IsGabber("Kagain") !Dead("Kagain") !StateCheck("Kagain",CD_STATE_NOTVALID)
    CrevsDaak
  • chimericchimeric Member Posts: 1,163
    IsGabber() is the one I need, the rest I know.
  • chimericchimeric Member Posts: 1,163
    By the way, @AstroBryGuy , this last "not" check, !StateCheck("Kagain",CD_STATE_NOTVALID), what does that include? I'm using STATE_SLEEPING in my scripts. Plus, the list of checks needs to include Exists() or InMyArea().
  • CrevsDaakCrevsDaak Member Posts: 7,155
    CD_STATE_NOTVALID is a conjunction of STATE_CONFUSION, STATE_FEEBLEMINDED, STATE_SILENCED, STATE_PANIC, STATE_BERSERK, STATE_SLEEPING and I think STATE_FROZEN_DEATH and a bunch more of Death checks as well.

    Just like STATE_ILLUSIONS is a conjunction of STATE_INVISIBILITY, STATE_MIRRORIMAGE, STATE_BLUR and STATE_IMPROVEDINVISIBILITY.
    chimeric said:

    Plus, the list of checks needs to include Exists() or InMyArea().

    I think you can avoid Exists(), although you might need to use InMyArea() and might like to add CombatCounter(0) as well (if it's for a banter).
    AstroBryGuy
  • AstroBryGuyAstroBryGuy Member Posts: 3,437
    chimeric said:

    By the way, @AstroBryGuy , this last "not" check, !StateCheck("Kagain",CD_STATE_NOTVALID), what does that include? I'm using STATE_SLEEPING in my scripts. Plus, the list of checks needs to include Exists() or InMyArea().

    Like @CrevsDaak said, it's a combined state check for a bunch of states that leave the character invalid for dialogue. Originally created by @CamDawg (hence the "CD").

    You'll find it defined in many mods with the following code:

    /* STATE.IDS patching to ToB - thanks, Cam, if you read it */ /* adds custom IsValidForPartyDialogue state */ APPEND ~STATE.IDS~ ~0x80101FEF CD_STATE_NOTVALID~ UNLESS ~CD_STATE_NOTVALID~

    InMyArea() is a good idea, in case you've left Kagain in the other room or something. Since this is an interjection trigger, CombatCounter(0) should be unnecessary.
  • chimericchimeric Member Posts: 1,163
    Yes, in one interjection, for some reason, the transition from an NPC's dialogue conditioned on !Exists() didn't work, even though the NPC was in another area. The line was the alternative line with all the negative conditions. You must give two replies under a state, obviously, one with all those positive "yes, is here, no, not sleeping etc." checks, leading to the NPC file, and the other with OR() and the negatives for when the NPC isn't available. Four negatives, so OR(4). And for the NPC who travel in pairs, like Xzar/Montaron or Skye/Eldoth, more lines to cover all the angles. Well, as I was saying, the transition leading out of the NPC's dialogue failed, and I had no idea why, but the moment I changed !Exists() to !InMyArea(), it started to work.

    In case the developers are reading this, it would be nice to have a new trigger that combined in-the-area, not-dead, not-invalid and in-the-party.

    @CrevsDaak , about illusions. Does Dispel Illusions work against those states?
  • CrevsDaakCrevsDaak Member Posts: 7,155
    chimeric said:


    In case the developers are reading this, it would be nice to have a new trigger that combined in-the-area, not-dead, not-invalid and in-the-party.

    OUTER_SPRINT AvailableForInterjecton "all teh trigger go here"
    <<<<<<<< example.baf
    IF
    %AvailableForInterjection%
    THEN
    RESPONSE #100
    StartDialogueNoSet(Player1)
    END
    >>>>>>>>

    COMPILE example.baf EVAL
    chimeric said:


    @CrevsDaak , about illusions. Does Dispel Illusions work against those states?

    What's Dispel Illusions? You mean Detect Illusions? Yeah, it removes all those states.
  • AstroBryGuyAstroBryGuy Member Posts: 3,437
    edited March 2017
    chimeric said:

    In case the developers are reading this, it would be nice to have a new trigger that combined in-the-area, not-dead, not-invalid and in-the-party.

    You mean like "IsValidForPartyDialogue(O:Object*)"? Yeah, it exists, but it's wonky.

    Here's a list of what it checks (from https://forums.beamdog.com/discussion/1686/bg2-bug-ifvalidforpartydialogue-flakiness/p1):
    SethDavis said:

    at the moment, the check does the following:
    check that the target sprite exists
    check that it's not dead
    checks for target distance (squared) is less than visual range (squared)
    checks for line of sight
    checks that the target is in the same area
    checks that the target is not sleeping
    checks that the sprite is a party member
    checks that the target is not the last person you talked to

    CrevsDaak
  • chimericchimeric Member Posts: 1,163
    edited March 2017
    CrevsDaak said:

    What's Dispel Illusions? You mean Detect Illusions? Yeah, it removes all those states.

    Yes, that's the one. I've hardly ever used it, it takes too many points. So that's all it does? I was hoping it would do something to creatures who have ILLUSIONARY or ILLUSION (whichever it is) as their SPECIFIC value. Then we could make phantasm spells like Shadow Monsters or lower-level illusionary summons and make them dispellable by this. By the way, does Detect Illusion count as one of the modal states? Is it detectable somehow by creatures?

    Now how about this - just a thought. Suppose that we make normal, regular creatures, all equipped with a special item that puts them in one of the illusion states from the list above - ideally, with no other effect; or if that's impossible, let this item cast Invisibility or Blur on them. Or we could just script them to ReallyForceSpellRES on themselves on creation. In short, whatever it would take for their state to be subject to Detect Illusions. Then we could put a further condition in the override script, which is that if the creature is not in that state, it destroys itself. Effectively this would be like dispelling the creature - and this should also play in favor of Dispel Magic and Remove Magic.

    Anyway, back to the main topic - speaking order of NPC. Here is what I'd like to do now in one conversation, with interjections. I'd like all of the party NPC to pipe in with their thoughts after a certain state - if they are present, valid and so on. I can write the checks, but it's the order of proceeding that gives me trouble. Basically, I start from this:

    IF ~~ THEN BEGIN 1
    SAY ~The state they will react to.~
    IF ~Minsc is in~ THEN EXTERN ...
    IF ~Edwin is in...~ THEN EXTERN...
    IF ~Xzar is in...~ THEN EXTERN...
    ...
    IF ~nobody else in the party~ THEN REPLY ~...~ GOTO SOMEWHERE-IN-THE-SAME-FILE
    END

    What I want is after the state appears is for all of the present NPC to say their pieces, one by one. How do I do that? If I start with one of them, for example, Minsc, and lead out to EXTERN ~MINSCJ~ REPLY, then I can write in that file:

    IF ~False()~ THEN BEGIN REPLY
    SAY ~...~

    Where do I take this? If I send this back to state 1, then Minsc's line will trigger again and so on ad infinitum. I could now write out all of the yes-no conditions for the other NPC inside Minsc, like so again:

    IF ~Edwin is in...~ THEN EXTERN... - > to Edwin's file
    IF ~Xzar is in...~ THEN EXTERN... - > to Xzar's file

    And so on. That way, starting with Minsc, it could go down the line. But that's a lot of work and conditions for each NPC's file so they switch between each other, and possible loops too. I'd much rather somehow make the conversation return to state 1 after every one speaks, and then proceed to the last option. I've seen something like that done in the Quests and Encounters mod, where the NPC all comment on that man returning money, but I can't look there right now.


    Post edited by chimeric on
  • jasteyjastey Member Posts: 2,669
    If several NPCs talk after the other, use CHAIN.
  • chimericchimeric Member Posts: 1,163
    edited March 2017
    Thank you, but from the description in the Weidu documentation, that's both too complicated and not quite right for the purpose. (Or rather, it's too complicated to the degree it's not right for the purpose.) CHAIN seems to be about two or maybe more NPC going back and forth between themselves, hence this abbreviated notation. That's not what I need - and, actually, I intentionally avoid those exchanges longer than one response per NPC, because, in my opinion, they slow down the action while adding nothing much of interest. I may be better off with INTERJECT here, but this leads directly to the next state, or perhaps I can point it to the original state before the interjection. Either way, it goes straight to that state unless I write an if-present trigger for the other NPC, and then it's no better than the usual EXTERN. What I want is for the NPC to speak their piece, each only once, and only then arrive at the final state.

    In this case the party is trying to guess what the acronym FIB, or possibly IFB or FBI or BFI, may stand for. Everyone offers his opinion, one after the other. Xzar, if present, says "Frenzy In Beyond", Edwin, if present, says "Infinitely Fasting Boulangerie" and so on; the arrival point is the next state in the dialogue.

    Quests and Encounters is your mod, Jastey, right? How did you do it with that man without checking for who is in the party?
  • CrevsDaakCrevsDaak Member Posts: 7,155
    chimeric said:

    CrevsDaak said:

    What's Dispel Illusions? You mean Detect Illusions? Yeah, it removes all those states.

    Yes, that's the one. I've hardly ever used it, it takes too many points. So that's all it does? I was hoping it would do something to creatures who have ILLUSIONARY or ILLUSION (whichever it is) as their SPECIFIC value. Then we could make phantasm spells like Shadow Monsters or lower-level illusionary summons and make them dispellable by this. By the way, does Detect Illusion count as one of the modal states? Is it detectable somehow by creatures?


    I'm not sure if it dispels illusionary creatures (which is ILLUSIONARY, I think 7 on GENDER.ids). Just get into the Circus Tent and test with the Werewolves there.

    The problem with Detect Illusions is that other sources of illusions dispelling and other sources of illusions exist. I think it's not possible to make it detectable (at least in such a way that it would still be worth the trouble).
  • kjeronkjeron Member Posts: 2,367
    You can detect modal state and Detect Illusions stat value, using either a threshold or a simplified % chance:
    Detect(Player1)
    ModalStateObject(Player1,DETECTTRAPS)
    CheckStatGT(Player1,74,136)

    Detect(Player1)
    ModalStateObject(Player1,DETECTTRAPS)
    CheckStatGT(Player1,14,136)
    ChectStatLT(Player1,20,136)
    RandomNumGT(100,14)
    CrevsDaak
  • chimericchimeric Member Posts: 1,163
    Confirmed: Detect Illusion dispels creatures with ILLUSIONARY Gender. They vanish without a trace and give no XP.
  • CrevsDaakCrevsDaak Member Posts: 7,155
    chimeric said:

    Confirmed: Detect Illusion dispels creatures with ILLUSIONARY Gender. They vanish without a trace and give no XP.

    IIRC they have no XP value at all.
  • chimericchimeric Member Posts: 1,163
    edited March 2017
    I was talking about my custom xvarts. I want to make a couple of spells that summon illusionary monsters, but for low levels, like the unimproved Phantasmal Force, the visions should be muted. The silence opcode and the SILENCED flag only suppress right-click responses. The monsters still warble when they die, attack and so on. How can I make them completely soundless, or as much as possible? I could edit out the sounds in the CRE file, but I'd like to be able to take off the shroud of silence when I need to.

    P.S. There is some kind of weirdness with item names. I made a sword that deals non-lethal damage (fist damage) for illusions, from a basic short sword template, and all was well until some point in the editing. I didn't do anything drastic to it at all, just played around with weapon speed and damage dice size, but for some reason it stopped doing any kind of damage at all, even on hits. I deleted that sword and copied the basic short sword back and gave it to the creature; that worked after editing, but only until I changed the name of the file to that of the old "failed" sword. Then this one stopped damaging as well! I changed the name to XXX, and it hits again. What the heck?
    Post edited by chimeric on
  • AstroBryGuyAstroBryGuy Member Posts: 3,437
    Have you tried using SetPlayerSound(O:Object*,I:STRREF*,I:SlotNum*SNDSLOT) to set and unset the CRE sounds?
  • CrevsDaakCrevsDaak Member Posts: 7,155
    edited March 2017
    Illusionary creatures don't deal damage until the player damages or attacks them.
    Edit: they probably don't give XP when dispelled and that's probably intentional as well.
  • chimericchimeric Member Posts: 1,163
    To AstroBryGuy: that would have been a possibility, but testing showed - not like I didn't know it, really... - that animations come with their in-built sounds. Even if you edit out everything, the avatar will cry out when dying, swinging, when it's hit etc. It's possible to mostly shut creatures up, but not quite. In the end I settled for a trick... appropriate for illusions... I made the invisible creatures wear an item that, among other signs of being illusionary, puts a silence on them. This is Phantasmal Force, the 1st-level spell. If Audible Glamer, an accessory spell that adds sound, is cast on these creatures, they will receive a bonus to their stats and destroy the item, which makes them vivid, solid and loud like originals.

    To CrevsDaak: you are mistaken. :smile: The strangeness with the name of the sword was clearly a bug. I had to choose a different file name for that sword, and then it began to cut. This is goddamn weird. Otherwise, though, ILLUSIONARY is just a Gender (and Sex) option, it confers no special properties. I don't know about those werewolves, they were probably a special case.

    Also, all illusions wink away when one of the many True Sight spells is cast. This is becoming a problem, because there are going to be friendly illusions now. The spells work by invoking in a wide area a self-destruct EFF restricted to ILLUSIONARY. I changed the wizard version in my installation to take a detour through another EFF that limits the effect to NOTGOOD. And this time in testing my phantasmal xvarts remained. If I'm going to release an illusions mod, as I'm set to do, the True Sight spells will all have to be fixed. But there may have been edits to them in other mods, so I'm asking for Weidu code to edit an SPL - > edit a Spell Ability - > edit an effect's "Resource" property. It's field no. 11. Can anybody help me out here? Or should I just supply the fixed versions of the default TS spells? If the spells were edited in another mod, they may have different effects or rearranged effects anyhow.
Sign In or Register to comment.