Pocket Plane Group

Miscellany, Inc. => Infinity Engine Modding Q&A => Topic started by: CoM_Solaufein on April 17, 2004, 09:15:32 PM

Title: CHAIN or Not
Post by: CoM_Solaufein on April 17, 2004, 09:15:32 PM
Can you use a chain on a character that is not an NPC? What I want to do is have a villian start talking to a npc when they see them. They chat and then it ends, then the villian talks to the PC before hell breaks out. Or would I be better off using INTERJECT?
Title: Re: CHAIN or Not
Post by: Bons on April 17, 2004, 11:08:50 PM
You can use CHAIN (Non-joinable characters are still NPCs), and I think that'd be easier for the scenario you describe.
Title: Re: CHAIN or Not
Post by: neriana on April 18, 2004, 12:24:00 AM
Would you also need to use WEIGHTS in this situation?
Title: Re: CHAIN or Not
Post by: CoM_Solaufein on April 18, 2004, 03:01:46 AM
Thats good. I've never seen an example that I recall it being used on a party npc and a non party npc.
Title: Re: CHAIN or Not
Post by: Bons on April 18, 2004, 10:25:26 AM
Would you also need to use WEIGHTS in this situation?

Off the top of my head, no. If the villain NPC has the first line, you'd script them to initiate dialogue with the NPC, and the conditions you use should handle it. The code would look something like this (Something, because I can always be wrong, wrong, wrong. :) ):

In your villain's script:

IF
   Global("VillainNPC1", "LOCALS", 0)
   See("NPC")
   InParty("NPC")
   
THEN
   RESPONSE #100   
      StartDialogueNoSet("NPC")
END

In your .d for the villain:

BEGIN ~VILLAIN~

CHAIN
IF ~
Global("VillainNPC1","LOCALS",0)
InParty("NPC")
See("NPC")
!StateCheck("NPC",STATE_SLEEPING)~ THEN VILLAIN YouMustPayTheRent
~You must pay the rent!~ DO ~SetGlobal("VillainNPC1","LOCALS",1)~
==NPCJ
~I can't pay the rent!~
==VILLAIN
~You must pay the rent!~
==NPCJ
~I can't pay the rent!~
==VILLAIN
~You must pay the rent!~
END
++ ~I'll pay the rent!~ GOTO Curses

IF ~~ THEN BEGIN Curses
SAY ~Curses! Foiled again!~
IF ~~ THEN DO ~Enemy()
Attack([PC])~ EXIT
END 

If the shoe were on the other foot, and the NPC called out to the villain first, then a WEIGHT might be necessary to insure the desired line of dialogue appears.