Jump to content


Photo

Non-Joined NPC Dialogue


  • Please log in to reply
28 replies to this topic

#1 ottomadenedamotto

ottomadenedamotto
  • Member
  • 30 posts

Posted 21 August 2010 - 07:28 PM

Okay, so here's another thing that's got me scratching my head.  All the dialogue tutorials I've seen have to do with party members talking to each other.  I just can't for the life of me figure out how to make two non-party NPCs have a conversation once in sight of Player1.  I tried, but it caused a parsing error in the installer.  I figure that I'm way off, but here's the patchwork script I threw together from what I've seen in some tutorials:

This is meant to be Eilthyra's override script, where she has a conversation with Aiden, then walks off to disappear.  For the curious reader, Aiden (a joinable NPC) has an override script to approach Player1 and begin her default dialogue file when AidenTalksToEilthyra=1, but that one didn't bring up any parsing errors, so here's hoping.

CHAIN IF ~Global("EilthyraExists","GLOBAL",1)
   GlobalLT("AidenTalksToEilthyra","GLOBAL",0)
   See(Player1)
   CombatCounter(0)
   !See([ENEMY])~ THEN EILTHYRA AidenTalksToEilthyra
~We're talking.~
DO ~SetGlobal("AidenTalksToEilthyra","GLOBAL",1)~
== Aiden ~Yep.~
== Eilthyra ~We sure are!~
== Aiden ~Okay, I'm sick of looking at you.  Fuck off.~
EXIT

IF
   GlobalLT("AidenTalksToEilthyra","GLOBAL",1)
THEN
   RESPONSE #100
   EscapeArea()
END

So, where am I going wrong here?  Does this need to be split into a script file and a dialogue file?  If so, how do I get the script to launch the dialogue?

#2 Ipsissimus

Ipsissimus

    [Insert witty statement]

  • Member
  • 356 posts

Posted 21 August 2010 - 08:33 PM

You don't use "Aidan" and "Eilthyra." You use the dialogue names. For instance, if I wanted an NPC to talk with Jan before he joined, I'd use the dialogue name JAN and MYNPC. For scripted in-party talk, it'd be JANJ and MYNPCJ. For a banter, it's JANB and MYNPCB.

Check out Berelinde's tutorials: Part 1, part 2, and part 3.

Rule: Scripts do not contain dialogue.

Edit: so the way that dialogue would run is as follows: (using AID and EIL as dialogue names)

CHAIN IF ~Global("EilthyraExists","GLOBAL",1) // you need to register a modding prefix
GlobalLT("AidenTalksToEilthyra","GLOBAL",0) // try use shorter variables.
See(Player1)
CombatCounter(0)
!See([ENEMY])~ THEN EIL AidenTalksToEilthyra
~We're talking.~
DO ~SetGlobal("AidenTalksToEilthyra","GLOBAL",1)~
== ~AID~ ~Yep.~
== ~EIL~ ~We sure are!~
= ~Okay, I'
m sick of looking at you.~ // since Eilythra is still talking, you use Multisay instead. No need to reference her dialogue again.
//that EXIT was unnecessary: do this instead
DO ~EscapeArea()~


Modding prefixes can be registered at the Black Wyrm Lair, though you will need to register an account to post.

The override script is used to control your NPC's actions. What they say belongs in the various dialogue files. You can, however, use their script to ensure that banters occur only under specific circumstances, as described here.

Edited by Ipsissimus, 21 August 2010 - 09:51 PM.

And the mirror, it reflects a tiny dancing skeleton, surrounded by a fleshy overcoat and swaddled in
A furry hat, elastic mask, a pair of shiny marble dice, some people call them snake-eyes, but to me they look like mice
-- "Nothing's gonna change my clothes", They Might Be Giants

#3 ottomadenedamotto

ottomadenedamotto
  • Member
  • 30 posts

Posted 22 August 2010 - 01:09 AM

Thanks for your help. That definitely seems to get it closer to being installed, but I'm still getting a parsing error. I made it a .d file set as Eilthyra's default dialogue and C&Pd exactly what you have above:
CHAIN IF ~Global("EilthyraExists","GLOBAL",1) // you need to register a modding prefix
GlobalLT("AidenTalksToEilthyra","GLOBAL",0) // try use shorter variables.
See(Player1)
CombatCounter(0)
!See([ENEMY])~ THEN EIL AidenTalksToEilthyra
~We're talking.~
DO ~SetGlobal("AidenTalksToEilthyra","GLOBAL",1)~
== ~AID~ ~Yep.~
== ~EIL~ ~We sure are!~
= ~Okay, I'm sick of looking at you.~ // since Eilythra is still talking, you use Multisay instead. No need to reference her dialogue again.
//that EXIT was unnecessary: do this instead
DO ~EscapeArea()~
That's everything in Q!eilthy.d

Here's the response I get:
Copied [Aiden/Q!eilthy.cre] to [override/Q!eilthy.cre]
Compiling 1 dialogue file ...

[Aiden/Q!eilthy.d] PARSE ERROR at line 12 column 1-17
Near Text: 
	syntax error

[Aiden/Q!eilthy.d]  ERROR at line 12 column 1-17
Near Text: 
	Parsing.Parse_error
ERROR: parsing [Aiden/Q!eilthy.d]: Parsing.Parse_error
ERROR: compiling [Aiden/Q!eilthy.d]!
Stopping installation because of error.

I'm stumped...

#4 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 22 August 2010 - 06:12 AM

You need more than CHAIN to provoke one NPC to talk to another. You need to script the NPC to begin dialogue. Dialogue trigger conditions aren't really the same thing.

First, your NPC needs an override script. If the NPCs involved are existing game NPCs, you may need to assign one, sub the NPC probably already has one.

Once you have found the NPC's overrride script, you will put this in, probably using EXTEND_TOP, but if it's an NPC you created yourswelf, you may only need to COMPILE it.

IF 
    Global("EilthyraExists","GLOBAL",1) 
    See(Player1) //or whatever DV you want
    Global("AidenTalksToEilthyra","GLOBAL",0)
    CombatCounter(0)
    !See([ENEMY]) 
THEN 
    RESPONSE #100 
        SetGlobal("AidenTalksToEilthyra","GLOBAL",1)
END 

IF 
    Global("EilthyraExists","GLOBAL",1) 
    See(Player1) //or whatever DV you want
    Global("AidenTalksToEilthyra","GLOBAL",1)
    CombatCounter(0)
    !See([ENEMY]) 
THEN 
    RESPONSE #100 
        StartDialogueNoSet(Player1) //or whatever
END

When you write your dialogue, then, the only trigger you need and the only trigger you should have is ~Global("TAidenTalkedToEithyra","GLOBAL",1). Make sure you close the variable by setting it to two somewhere in the dialogue.

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#5 ottomadenedamotto

ottomadenedamotto
  • Member
  • 30 posts

Posted 22 August 2010 - 01:05 PM

I just want to preface this by saying that I really appreciate all the help I've been getting here. I'm still really surprised that I haven't gotten a single sarcastic response to any of my amateur mistakes and I think I'm looking at a really strong community.

Anyway, thanks for the script, berelinde. I can't tell you whether it works or not, but it got through the installer without any parsing errors. The dialogue, though, is still not going through. I'm not really sure what you mean by your last comment:

the only trigger you need and the only trigger you should have is ~Global("TAidenTalkedToEithyra","GLOBAL",1). Make sure you close the variable by setting it to two somewhere in the dialogue.

Should I not be using the Global AidenTalksToEithyria? And why would I set it to 2? As it is now, when AidenTalksToEithyria=1, Eithyria is supposed to leave the area and Aiden is supposed to approach Player1 to strike up a conversation. Neither of these NPCs are party members at this point.

Here's what I've got right now.

Q!Eilthy.baf (no error)
IF 
    Global("EilthyraExists","GLOBAL",1) 
    See(Player1) //or whatever DV you want
    Global("AidenTalksToEilthyra","GLOBAL",0)
    CombatCounter(0)
    !See([ENEMY]) 
THEN 
    RESPONSE #100 
        SetGlobal("AidenTalksToEilthyra","GLOBAL",1)
END 

IF 
    Global("EilthyraExists","GLOBAL",1) 
    See(Player1) //or whatever DV you want
    Global("AidenTalksToEilthyra","GLOBAL",1)
    CombatCounter(0)
    !See([ENEMY]) 
THEN 
    RESPONSE #100 
        StartDialogueNoSet(Player1) //or whatever
END
[i]On a side note, should I assume here that even though she's launching a dialogue with Player1, she'll actually carry out her conversation with Aiden instead?  If not, what should I use instead of StartDialogueNoSet(Player1)?[/i]

Q!Eilthy.d
[code]CHAIN IF ~Global("EilthyraExists","GLOBAL",1) // you need to register a modding prefix
GlobalLT("AidenTalksToEilthyra","GLOBAL",0) // try use shorter variables.
See(Player1)
CombatCounter(0)
!See([ENEMY])~ THEN EIL AidenTalksToEilthyra
~We're talking.~
DO ~SetGlobal("AidenTalksToEilthyra","GLOBAL",1)~
== ~AID~ ~Yep.~
== ~EIL~ ~We sure are!~
= ~Okay, I'm bored.~ // since Eilythra is still talking, you use Multisay instead. No need to reference her dialogue again.
//that EXIT was unnecessary: do this instead
DO ~EscapeArea()~[/code]

Here's the error report that comes up for that:
[code]Compiling 1 dialogue file ...

[Aiden/Q!eilthy.d] PARSE ERROR at line 12 column 1-17
Near Text: 
	syntax error

[Aiden/Q!eilthy.d]  ERROR at line 12 column 1-17
Near Text: 
	Parsing.Parse_error
ERROR: parsing [Aiden/Q!eilthy.d]: Parsing.Parse_error
ERROR: compiling [Aiden/Q!eilthy.d]!
Stopping installation because of error.

As you can tell, I'm really new at this and I just don't know what the problem is. Am I only supposed to be using CHAIN for dialogue involving party members? If so, what's the alternative?

Edited by ottomadenedamotto, 22 August 2010 - 01:13 PM.


#6 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 22 August 2010 - 01:42 PM

You only want one trigger for the .d because using multiple triggers makes it far more likely that you will get one of them wrong. "TAidenTalksToEilthyras" was a typo.

You need to BEGIN the dialogue file, and you need to close the variable (advance it by one) so that the NPC won't keep initiating dialogue over and over and over. The script block that initiates dialogue will override the EscapeArea() if you don't close the variable.

The lack of EXIT is probably causing your parse error.

//Consider using a personal prefix for all dialogue file names, etc. You don't need to begin files that have been begun elsewhere, but if neither EIL or AID has been BEGIN-ed somewhere else, you need to do so before the first state.

CHAIN IF ~Global("AidenTalksToEilthyra","GLOBAL",1) ~ THEN EIL AidenTalksToEilthyra 
~We're talking.~ 
DO ~SetGlobal("AidenTalksToEilthyra","GLOBAL",2)~ 
== ~AID~ ~Yep.~ 
== ~EIL~ ~We sure are!~ 
= ~Okay, I'm bored.~ 
DO ~EscapeArea()~ 
EXIT 

// The EXIT is most certainly NOT unneccessary. You need it very much!

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#7 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 22 August 2010 - 02:25 PM

Aha, I see your prefix is Q!. With that in mind, you are always going to need to use tildes around your dialogue file names. I have to do that myself, since my prefix is B!. Swap out Q!Eilthy for EIL above and Aiden's dialogue file name for AID. Keep in mind that if Aiden is joinable, you would be dealing with his J file here, not his creature dialogue file.

I think I remember seeing something about an NPC named Aiden in an old Mod Ideas thread. Is this the same NPC?

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#8 ottomadenedamotto

ottomadenedamotto
  • Member
  • 30 posts

Posted 22 August 2010 - 03:26 PM

I think I remember seeing something about an NPC named Aiden in an old Mod Ideas thread. Is this the same NPC?


No, this one's my idea entirely. I'm pretty excited about it, but I'm trying not to talk it up too much until I have an idea of what I'm doing with the code-type stuff. Before starting, I took a look around to see if there were any NPCs already named Aiden, since it's a common name 'round some parts, but all I found was an Aidan.

Also, grr it's still not working. Q!eilthy.d now says exactly what you suggested above (plus the tildes which I think are where you meant):
CHAIN IF ~Global("AidenTalksToEilthyra","GLOBAL",1) ~ THEN ~Q!eilthy~ AidenTalksToEilthyra
~We're talking.~
DO ~SetGlobal("AidenTalksToEilthyra","GLOBAL",2)~ 
== ~Q!adn~ ~Yep.~
== ~Q!eilthy~ ~We sure are!~
= ~Okay, I'm bored.~ 
DO ~EscapeArea()~ 
EXIT

But there's a new error now:
Compiling 1 dialogue file ...
Processing 1 dialogues/scripts ...

ERROR locating resource for 'CHAIN3'
Resource [Q!EILTHY.DLG] not found in KEY file:
	[./chitin.key]
ERROR: preprocessing APPEND_EARLY [Aiden/Q!eilthy.d]: Failure("resource [Q!EILTHY.DLG] not found for 'CHAIN3'")
Stopping installation because of error.
At least it's not another parsing error (I think.) But .dlg? I've never been told to make one in any tutorial. I thought that's what I was making by compiling my .d files.

Edited by ottomadenedamotto, 22 August 2010 - 03:29 PM.


#9 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 22 August 2010 - 03:31 PM

Did you BEGIN the dialogue files anywhere? When you see a CHAIN3 error, that means that one or more of the dialogues is not present in the game. You would ned

BEGIN ~Q!EILTHY~

at the top of the file. :)

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#10 Ipsissimus

Ipsissimus

    [Insert witty statement]

  • Member
  • 356 posts

Posted 22 August 2010 - 03:33 PM

D files compile to DLG files - no need to worry.

Can you post the whole Q!Eilthy.d file in spoiler tags? (spoiler tags are listed under the "Other Styles" menu)
And the mirror, it reflects a tiny dancing skeleton, surrounded by a fleshy overcoat and swaddled in
A furry hat, elastic mask, a pair of shiny marble dice, some people call them snake-eyes, but to me they look like mice
-- "Nothing's gonna change my clothes", They Might Be Giants

#11 ottomadenedamotto

ottomadenedamotto
  • Member
  • 30 posts

Posted 22 August 2010 - 03:40 PM

Hey, it worked! Hooray!

Thanks for all your help!

And keep an eye out for future topics where I try to get my scripts/dialogues to actually do what I want them to.

Ipsissimus: Thanks for the heads up. I'll use spoiler tags in the future.

Edited by ottomadenedamotto, 22 August 2010 - 03:40 PM.


#12 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 22 August 2010 - 04:05 PM

And keep an eye out for future topics where I try to get my scripts/dialogues to actually do what I want them to.

Heh. If you're like most of us, that usually takes a few years. :whistling:

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#13 ottomadenedamotto

ottomadenedamotto
  • Member
  • 30 posts

Posted 22 August 2010 - 06:51 PM

Well, while this topic is here, the mod installed and both characters appeared where they're meant to, but the dialogue just doesn't happen. I tried tinkering with it a bit, but I still have no idea what the problem is.

Here's Q!eilthy.baf
Spoiler


And here's Q!eilthy.d
Spoiler


Any thoughts?

#14 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 22 August 2010 - 08:18 PM

Have you assigned Eilthyra's override script to her CRE? You can do that in the tp2 using this code. You would put this in after you name the CRE.

WRITE_ASCII 0x248 ~q!eilthy~ #8 // assign override script

Here's a block from Haldamir's tp2 where I assign everything to do with the NPC:

COPY ~haldamir/character/b!hal.cre~ ~override~
  ADD_CRE_ITEM ~leat04~ #0 #0 #0 ~IDENTIFIED~ ~ARMOR~
  ADD_CRE_ITEM ~sw1h01~ #0 #0 #0 ~IDENTIFIED~ ~SHIELD~
  ADD_CRE_ITEM ~sw1h02~ #0 #0 #0 ~IDENTIFIED~ ~WEAPON1~ EQUIP
  ADD_CRE_ITEM ~potn52~ #0 #0 #0 ~IDENTIFIED~ ~QITEM1~
  ADD_CRE_ITEM ~bow01~ #0 #0 #0 ~IDENTIFIED~ ~INV1~
  ADD_CRE_ITEM ~arow01~ #14 #0 #0 ~IDENTIFIED~ ~QUIVER1~
  ADD_CRE_ITEM ~arow02~ #5 #0 #0 ~IDENTIFIED~ ~QUIVER2~
  SAY NAME1 ~Haldamir~
  SAY NAME2 ~Haldamir~
  WRITE_ASCII 0x248 ~B!HALS~ #8 // assign override script
  WRITE_ASCII 0x2cc ~B!HAL~ #8 // assign pre-joining dialogue file
  WRITE_ASCII 0x280 ~B!HALDAMIR~ #32 // assign DV
  WRITE_ASCII 0x34  ~b!haldas~ #8     // assign small portrait
  WRITE_ASCII 0x3c  ~b!haldam~ #8     // assign medium portrait

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#15 ottomadenedamotto

ottomadenedamotto
  • Member
  • 30 posts

Posted 22 August 2010 - 10:37 PM

Well, I already have the script assigned to her override script slot via Near Infinity. Should I use the code instead? And if so, why?

Also, is this the same place where one gives to an NPC an item which can't be removed (such as Boo?) I can't figure out how to do that.

Edited by ottomadenedamotto, 22 August 2010 - 11:03 PM.


#16 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 23 August 2010 - 05:46 AM

You really should not use NI for creature creation or editing. It chews up creature files something fierce. Use DLTCEP instead. Also, I know theacefes' tutorial says to set the script with NI, but I've never been able to get it to work, so I set it in the tp2. It will harm nothing if you do it both ways, DLTCEP and tp2. I advise against using NI at all for CRE files.

You can add inventory items with the tp2, as well. I like doing it that way because it lets me change inventory items at will. Changing one item code in a tp2 is much easier than firing up DLTCEP every time I want to change starting equipment.

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#17 ottomadenedamotto

ottomadenedamotto
  • Member
  • 30 posts

Posted 23 August 2010 - 06:02 AM

Ah, okay. Btw, do you know how to make an item untouchable like Boo and play a little description when the player tries to move it?

#18 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 23 August 2010 - 06:49 AM

No, I'm no good at items, I'm afraid. If I were going to make one, though, I would use DLTCEP to modify Boo, changing the BAMs and possibly using DisplayString() to print the text in the little window.

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#19 Wisp

Wisp
  • Modder
  • 1353 posts

Posted 23 August 2010 - 11:11 AM

Making items undroppable/unmoveable is easy. There's a bit that has to be explicitly set for an item to be moveable. In DLTCEP it's called "Moveable" and can be found under the Icons & item attributes tab. But I'm fairly certain Boo-like messages are hard coded and not something you can reproduce.

Edited by Wisp, 23 August 2010 - 11:12 AM.


#20 ottomadenedamotto

ottomadenedamotto
  • Member
  • 30 posts

Posted 23 August 2010 - 12:29 PM

Have you assigned Eilthyra's override script to her CRE? You can do that in the tp2 using this code. You would put this in after you name the CRE.

WRITE_ASCII 0x248 ~q!eilthy~ #8 // assign override script

Here's a block from Haldamir's tp2 where I assign everything to do with the NPC:

COPY ~haldamir/character/b!hal.cre~ ~override~
  ADD_CRE_ITEM ~leat04~ #0 #0 #0 ~IDENTIFIED~ ~ARMOR~
  ADD_CRE_ITEM ~sw1h01~ #0 #0 #0 ~IDENTIFIED~ ~SHIELD~
  ADD_CRE_ITEM ~sw1h02~ #0 #0 #0 ~IDENTIFIED~ ~WEAPON1~ EQUIP
  ADD_CRE_ITEM ~potn52~ #0 #0 #0 ~IDENTIFIED~ ~QITEM1~
  ADD_CRE_ITEM ~bow01~ #0 #0 #0 ~IDENTIFIED~ ~INV1~
  ADD_CRE_ITEM ~arow01~ #14 #0 #0 ~IDENTIFIED~ ~QUIVER1~
  ADD_CRE_ITEM ~arow02~ #5 #0 #0 ~IDENTIFIED~ ~QUIVER2~
  SAY NAME1 ~Haldamir~
  SAY NAME2 ~Haldamir~
  WRITE_ASCII 0x248 ~B!HALS~ #8 // assign override script
  WRITE_ASCII 0x2cc ~B!HAL~ #8 // assign pre-joining dialogue file
  WRITE_ASCII 0x280 ~B!HALDAMIR~ #32 // assign DV
  WRITE_ASCII 0x34  ~b!haldas~ #8     // assign small portrait
  WRITE_ASCII 0x3c  ~b!haldam~ #8     // assign medium portrait


Nothing. the tp2 did give Aiden her starting gear, so I know it's doing what it's supposed to, but the dialogue still won't fire. Talking to Aiden initiates her joining dialogue and talking to Eilthyra gets you snubbed. The script and dialogue are the same as above, and assigned to Eilthrya both in DLTCEP and the tp2. Is there anything else I can try in order to make this work?