Author Topic: NPC Pairs  (Read 1983 times)

Offline Wounded_Lion

  • Planewalker
  • *****
  • Posts: 208
  • Gender: Male
  • Dungeon Dweller
NPC Pairs
« on: December 09, 2005, 02:51:13 PM »
I rather enjoyed the NPC pairs of BGI (though I am aware that some players found it annoying to have to take both characters).  I especially enjoyed how well-designed and complimentary each pair was...

I need to know how best to implement this style of NPC pair in BGII (but I don't want to install BGI at this time to find out how it was done in that game).  Would it be best to have a global variable set upon joining and removing, and to have the other character's override script react appropriately?  For example, Char1 is removed and sets "Char1Removed" to "3".  Char2's override script reacts to "Char1Removed" being "3" by forcing removal of Char2.  And vice versa.

Is this best?  Or is there a more efficient, guaranteed-to-work-more-often method of doing this?

a Wounded Lion

Offline Rabain

  • Planewalker
  • *****
  • Posts: 281
  • Gender: Male
  • Luck o' the Irish!
Re: NPC Pairs
« Reply #1 on: December 09, 2005, 03:10:01 PM »
In BG1 what they do is use the following actions after the person you kicked out has their last word (this example is from Khalid's kickout dialog):

You kickout Khalid...then:

Khalid: "T-t-that is disappointing, but I s-shall not give up on you, so long as you do not, either."

Actions:

ActionOverride("Jaheira",ChangeAIScript("",DEFAULT))
ActionOverride("Jaheira",LeaveParty())
ActionOverride("Jaheira",SetDialog("JaheiP"))

Which will cause Jaheira to leave the party and use her kickout speech also.

If you then talk to Khalid again and ask him to join they use this after he says Okay to joining:

ActionOverride("Jaheira",JoinParty())
JoinParty()

Jaheira then attempts to join the party.
Touchstone: Wild Elf Fighter
BG2CPM: Dialog Portraits for Everyone!
WTPFamiliars: A new version of the Find Familiar Spell
All at: Border Kingdoms

Offline Wounded_Lion

  • Planewalker
  • *****
  • Posts: 208
  • Gender: Male
  • Dungeon Dweller
Re: NPC Pairs
« Reply #2 on: December 09, 2005, 03:46:17 PM »
Thanks, Rabain.  I'll experiment a little with this and see what seems to work best.  I appreciate the info.

a W.L.

Offline Lu

  • Planewalker
  • *****
  • Posts: 750
  • Gender: Female
Re: NPC Pairs
« Reply #3 on: December 10, 2005, 12:00:44 AM »
   Yet what Rabain suggests doesn't solve it 100%. Them cheaters can make Khalid enter a small area alone, then kick him out and never enter the small area again with a party member. So adding additional checks in Jaheira script whether Khalid's in the party is needed, too

Offline Ghreyfain

  • Moderator
  • Planewalker
  • *****
  • Posts: 4705
  • Gender: Male
    • Pocket Plane Group
Re: NPC Pairs
« Reply #4 on: December 10, 2005, 01:07:42 AM »
I don't think coding to prevent people from cheating is a good practice to get into.  Next you'll be trying to circumvent ctrl+y.  Or writing a script that takes away the killsword.  Let cheaters cheat.  They hurt no one but themselves.
Earn Money Sleeping.

Offline Lu

  • Planewalker
  • *****
  • Posts: 750
  • Gender: Female
Re: NPC Pairs
« Reply #5 on: December 10, 2005, 01:52:47 AM »
 @ Ghreyfain
   Sir, yes, sir!
   I mean I actually saw the way of kicking out an NPC that I mentioned as an engine flaw, so what I suggested was rather kinda way to fix it, the word 'cheater' maybe wasn't that good. But perhaps it really isn't worth bothering at all. Either way, I thought Mr. W. Lion would like to hear about it

Offline Borsook

  • off topic
  • Planewalker
  • *****
  • Posts: 1679
  • Gender: Male
  • not a badger
Re: NPC Pairs
« Reply #6 on: December 10, 2005, 02:23:38 AM »
Thog like pair npcs too. Thog want them back.
"Borsook seems like a pretty cool guy who offers his insight where appropriate... just very, very frequently." - Imrahil

Borsook's Chambers - Home of Borsook's Mods

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7244
Re: NPC Pairs
« Reply #7 on: December 10, 2005, 10:11:16 AM »
I don't think coding to prevent people from cheating is a good practice to get into.  Next you'll be trying to circumvent ctrl+y.  Or writing a script that takes away the killsword.  Let cheaters cheat.  They hurt no one but themselves.

Eh. I don't think a check that says "If my buddy isn't in the party, there's a problem" is particularly egregious. That seems far more in keeping with "characters should have a reasonable awareness of the gameworld" than anything else.
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

Offline jester

  • Here be dragons...
  • Planewalker
  • *****
  • Posts: 2416
  • If you fail, fail gloriously.
Re: NPC Pairs
« Reply #8 on: December 10, 2005, 10:22:11 AM »
Why would you have to code anything extra to prevent NPC pairs from being split up? Khalid and Jaheira work for me quite well and if I tire of one, but want to keep the other, just make sure you stand back while one of the pair is attacking that dragon. You can always mourn together afterwards, as a team.

To prevent this you should check for resurrectability and install a time that makes the surviving paired NPC leave after an ultimatum to bring the companion back to live. IMO this would nevertheless prevent this 'cheat', but could be a debatable character flaw with said NPC. :/
People should not be afraid of their governments. Governments should be afraid of their people.

Why spend all your day surfing for porn?




Balance in all things
I haven't had this much fun since... the last time.

Offline Lu

  • Planewalker
  • *****
  • Posts: 750
  • Gender: Female
Re: NPC Pairs
« Reply #9 on: December 10, 2005, 10:48:38 AM »
Quote
Khalid and Jaheira work for me quite well and if I tire of one, but want to keep the other, just make sure you stand back while one of the pair is attacking that dragon
   I dunno actually... I kinda feel uncomfortable when anyone dies, other than Irenicus (not our lovely "Adlerson", of course) and the likes, save Jaheira or Khalid, so I'd rather have neither in the party instead. Not that it belongs in this section though

Offline Zyraen

  • Planewalker
  • *****
  • Posts: 279
Re: NPC Pairs
« Reply #10 on: December 10, 2005, 11:23:55 AM »
I actually did Beyond the Law because I wanted an NPC Pair, but since I didn't have BG1 I had NO idea that it was not a new idea.

In any case, if you want to check BTL out, you can just click the banner in my Signature.

For those who wish the coding I use to keep them together, in consideration of Death / Drop, Perma-Death and other weird stuff, as well as Join Dialogues, just make a request on this thread and I'll put up the Code.
(http://www.geocities.com/arkevaul/btlbn2.gif)
SoA Release - Love between a Law Enforcer and a Fugitive - can such a thing even happen?

Zyraen's Miscellaneous Mods - Ust Natha Accelerator, item tweaks, & more

Offline Borsook

  • off topic
  • Planewalker
  • *****
  • Posts: 1679
  • Gender: Male
  • not a badger
Re: NPC Pairs
« Reply #11 on: December 10, 2005, 11:27:05 AM »
"Borsook seems like a pretty cool guy who offers his insight where appropriate... just very, very frequently." - Imrahil

Borsook's Chambers - Home of Borsook's Mods

Offline Wounded_Lion

  • Planewalker
  • *****
  • Posts: 208
  • Gender: Male
  • Dungeon Dweller
Re: NPC Pairs
« Reply #12 on: December 13, 2005, 02:32:18 PM »
Wow.  Thanks all for all of the advice.  I think its appropriate to force this issue (with additional script checks) because NPCs ideally have thoughts, opinions, and motivations of their own (imo, at least).

After all, if that hot half-elven girl (or guy, to be fair) that you've been nailing is kicked out of the party, are you really going to stick around?   ;D

a W.L.

Offline Wounded_Lion

  • Planewalker
  • *****
  • Posts: 208
  • Gender: Male
  • Dungeon Dweller
Re: NPC Pairs
« Reply #13 on: December 13, 2005, 02:33:52 PM »
For those who wish the coding I use to keep them together, in consideration of Death / Drop, Perma-Death and other weird stuff, as well as Join Dialogues, just make a request on this thread and I'll put up the Code.

I am interested in seeing how you do it.

a W.L.

Offline Lu

  • Planewalker
  • *****
  • Posts: 750
  • Gender: Female
Re: NPC Pairs
« Reply #14 on: December 13, 2005, 04:33:07 PM »
Quote
Wow.  Thanks all for all of the advice.  I think its appropriate to force this issue (with additional script checks) because NPCs ideally have thoughts, opinions, and motivations of their own (imo, at least)
  I agree 100%
  I also agree 100% when Ghrey says, "let 'em cheaters cheat", that's why I retreated when you said it, Mr. Ghreyfain, sir
  But now I think, "let 'em cheaters cheat, but why should we care 'bout 'em cheaters?"
  So I think now, the more you take care about the stuff the better, Mr. Wounded Lion, sir

Offline Zyraen

  • Planewalker
  • *****
  • Posts: 279
Re: NPC Pairs
« Reply #15 on: December 13, 2005, 10:16:35 PM »
This is the code on Kiyone's BAF file. Similar Blocks are also present for Kova's BAF.

The first block describes a perma-death of sorts, where Kova "dies" and immediately leaves the party. This includes Imprisonment and Petrification though. This causes Kiyone to say something like "oh no." and leave.
The second block describes a normal death, but the party kicks Kova out. Conventionally, this means the NPC is not resurrectable in any way. This results in Kiyone giving <Charname> a middle finger for being an ass before leaving and taking Kova with her, presumably to try to resurrect him.

// If Kova dies and is kicked out

IF    OR(5)
      StateCheck("Kova",STATE_ACID_DEATH)
      StateCheck("Kova",STATE_FLAME_DEATH)
      StateCheck("Kova",STATE_EXPLODING_DEATH)
      StateCheck("Kova",STATE_STONE_DEATH)
      StateCheck("Kova",STATE_FROZEN_DEATH)
   !InPartyAllowDead("Kova")
   InParty(Myself)
   Global("KKJoin", "GLOBAL", 1)
   !Global("FindingKova", "GLOBAL", 250)
THEN
   RESPONSE #100
   StartDialog("KYCSPLAT", Player1)
END

IF    Dead("Kova")
   !StateCheck("Kova",STATE_ACID_DEATH)
   !StateCheck("Kova",STATE_FLAME_DEATH)
   !StateCheck("Kova",STATE_EXPLODING_DEATH)
   !StateCheck("Kova",STATE_STONE_DEATH)
   !StateCheck("Kova",STATE_FROZEN_DEATH)
   !InPartyAllowDead("Kova")
   Global("KKJoin", "GLOBAL", 1)
   !Global("FindingKova", "GLOBAL", 250)
THEN
   RESPONSE #100
   StartDialog("KYCDEAD", Player1)
END

BTW, in "KYCDEAD", when Kova is dead, I need to execute ActionOverride("Kova", DestroySelf()) in the dialog, as when Player1 kicks a dead person out of the party, the body will appear beside Player1 (usually).
Kiyone, in her annoyance expressed in the "KYCDEAD" dialog, will speak of taking his body away to be revived, so I use the DestroySelf() command to make Kova's discarded body disappear.
Obviously, in "KYCSPLAT" it is not an issue as there Kova has no corpse left for her to deal with.

================

Further Notes - Kiyone joins the Party before Kova does, so I use the KKJoin Global to indicate if he has joined in the party. From the time that Kova joins the party, they become coded to be "inseparable".

For the standard party leaving Dialogue for Kiyone... (the following isn't the exact code i use, btw)

CHAIN
IF ~(blah)~ THEN Z#KIYOP ByePlayer1
~blah blah Bye <CHARNAME>!~
END
IF ~InParty("Kova")~ THEN EXTERN Z#KOVAJ ByePlayer1AfterKiyoSayBye
IF ~!Dead("Kova") !InParty("Kova") Global("KKJoin","GLOBAL",1) THEN EXTERN Z#KOVAP ByePlayer1AfterKiyoSayBye
IF ~Dead("Kova") InPartyAllowDead("Kova")~ THEN EXTERN Z#KIYOB KiyoNotLeavingWithKovaDead

The first option it is Z#KOVAJ and not Z#KOVAP, because I assume that the player reformed party and kicked only Kiyone out without taking him along.
The second option assumes the Player1 kicked them both out at the same time (so both switch to P files).
The third option checks that Kova is dead and in the party, and if so she simply refuses to leave. If you want her to leave and take Kova's dead body along, in place of
EXTERN Z#KIYOB KiyoNotLeavingWithKovaDead
use
DO ~ActionOverride("Kova", LeaveParty())
ActionOverride("Kova", DestroySelf())~ EXTERN KiyoTakeKovaBodyAway

Note there is a distinction between "ByePlayer1AfterKiyoSayBye" and "ByePlayer1". This prevents infinite loops (like Kiyone saying bye, then Kova saying bye, then Kiyone saying bye, then Kova saying bye) and so on and so forth. However if you can control it through globals and proper checks, then it's not an issue, you can use the same blocks. In my case, if I use a setting of "KKJoin" Global to control it, I can use the same DLG blocks.

===============

Remember for both of the above you must create the same for the other NPC (in this case, for Kova)
« Last Edit: December 13, 2005, 10:28:34 PM by Zyraen »
(http://www.geocities.com/arkevaul/btlbn2.gif)
SoA Release - Love between a Law Enforcer and a Fugitive - can such a thing even happen?

Zyraen's Miscellaneous Mods - Ust Natha Accelerator, item tweaks, & more

Offline Wounded_Lion

  • Planewalker
  • *****
  • Posts: 208
  • Gender: Male
  • Dungeon Dweller
Re: NPC Pairs
« Reply #16 on: December 13, 2005, 10:55:13 PM »
Thank you, Zyraen.

:pirate

a Wounded Lion

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: