Making sure the right party PC speaks
chimeric
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?
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?
0
Comments
CharName("KAGAIN",LastTalkedToBy)
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.
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...
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)
Just like STATE_ILLUSIONS is a conjunction of STATE_INVISIBILITY, STATE_MIRRORIMAGE, STATE_BLUR and STATE_IMPROVEDINVISIBILITY. 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).
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.
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?
Here's a list of what it checks (from https://forums.beamdog.com/discussion/1686/bg2-bug-ifvalidforpartydialogue-flakiness/p1):
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.
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?
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).
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)
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?
Edit: they probably don't give XP when dispelled and that's probably intentional as well.
To CrevsDaak: you are mistaken. 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.