Author Topic: How can I detect if a character is a PC or an NPC?  (Read 2718 times)

Offline Meira

  • Planewalker
  • *****
  • Posts: 188
  • Gender: Female
  • I'm the snow on your lips
    • Amber's Home
How can I detect if a character is a PC or an NPC?
« on: June 07, 2004, 01:29:25 PM »
Is there any way to detect (in a script) if a party member is a character created by the player or an NPC? The PCs don't have death variables, but I don't think that I can detect something that does not exist. I guess that Name("",Player2) would not work, or would it? Has anybody ever tried implementing a check like this?   

Offline SimDing0™

  • Back In Black
  • Global Moderator
  • Planewalker
  • *****
  • Posts: 3496
  • Gender: Male
  • Word Enhancer
Re: How can I detect if a character is a PC or an NPC?
« Reply #1 on: June 07, 2004, 01:36:14 PM »
Sometimes, a 0 in triggers means anything (see object masks, SpellCast, etc). Sometimes it just means 0. I'm not sure which of these categories "" would fall into here.

Of course, if it doesn't work, you can always do

!Name("Aerie",Player2)
!Name("Anomen",Player2)
...and so on.

Offline Meira

  • Planewalker
  • *****
  • Posts: 188
  • Gender: Female
  • I'm the snow on your lips
    • Amber's Home
Re: How can I detect if a character is a PC or an NPC?
« Reply #2 on: June 08, 2004, 10:56:59 AM »
Sometimes, a 0 in triggers means anything (see object masks, SpellCast, etc). Sometimes it just means 0. I'm not sure which of these categories "" would fall into here.

OK, I tested that last night and it didn't work. :( Other thing that separates the PC and NPC is that PC is exportable. There is a flag (Export allowed, 11) for that, but apparently there is no way to check if it's on or not. Or at least I can't think of any way to check it.     

Quote
Of course, if it doesn't work, you can always do

!Name("Aerie",Player2)
!Name("Anomen",Player2)
...and so on.

Yes that's my plan B, but I was hoping to figure out something that would not require me to keep constant track on the newest modded NPCs. Lazy me...

Offline Loriel

  • Planewalker
  • *****
  • Posts: 390
  • Gender: Male
    • Loriel's Downloads
Re: How can I detect if a character is a PC or an NPC?
« Reply #3 on: June 08, 2004, 03:56:14 PM »
I believe party slots are determined based on join order, rather than what order you rearrange them in for formation.  If that's the case, then this trigger will always find the main character since you can't kick yourself out:

Code: [Select]
IF
  InPartySlot(Myself,0)  //  If I'm the first one in the party
THEN
...

If that works, then this should detect NPC's:

Code: [Select]
IF
  InParty(Myself)  // If I'm in the party
  !InPartySlot(Myself,0)  // but I'm not the main character
THEN
...

Of course, this will not work if you created more than one character (ie. Multiplayer).  You could also put a piece of code in the dplayer scripts, since PC's are the only ones who get dplayer2.bcs, and only NPC's get dplayer3.bcs.  But then, both of these scripts are turned off when someone turns off the AI.  If you want to do a check for multiple created characters (even when the AI is turned off), the only other way I know of is to use the Name() trigger (even though there will constant updates needed) and put the script in the Override slot.

Offline Ghreyfain

  • Moderator
  • Planewalker
  • *****
  • Posts: 4705
  • Gender: Male
    • Pocket Plane Group
Re: How can I detect if a character is a PC or an NPC?
« Reply #4 on: June 08, 2004, 04:01:59 PM »
Detecting multiplayer "sidekicks" is the point of the exercise, yes.  Otherwise, the trigger you want is Player1. :)
Earn Money Sleeping.

Offline Meira

  • Planewalker
  • *****
  • Posts: 188
  • Gender: Female
  • I'm the snow on your lips
    • Amber's Home
Re: How can I detect if a character is a PC or an NPC?
« Reply #5 on: June 08, 2004, 04:38:05 PM »
Yes, I'm looking for the PC sidekicks, not the protagonist.  :)

Quote
I believe party slots are determined based on join order, rather than what order you rearrange them in for formation.

Yes, this is correct for all I know.

Offline Ghreyfain

  • Moderator
  • Planewalker
  • *****
  • Posts: 4705
  • Gender: Male
    • Pocket Plane Group
Re: How can I detect if a character is a PC or an NPC?
« Reply #6 on: June 08, 2004, 04:50:59 PM »
Right.  There're triggers for both who the first/second/etc. person to join the party was, and who is currently in the X spot.

Player1Fill = Whoever's at the top of the list

Player1 = Whoever joined the party first
Earn Money Sleeping.

Offline Grim Squeaker

  • Fallen
  • Planewalker
  • *****
  • Posts: 1019
  • Gender: Male
Re: How can I detect if a character is a PC or an NPC?
« Reply #7 on: June 08, 2004, 04:56:40 PM »
Sweet, I didn't know that.  I'm gonna have to use Player1Fill for 'hey I'm the leader of this group' banters...
"You alone can make my song take flight..."

Offline Ghreyfain

  • Moderator
  • Planewalker
  • *****
  • Posts: 4705
  • Gender: Male
    • Pocket Plane Group
Re: How can I detect if a character is a PC or an NPC?
« Reply #8 on: June 08, 2004, 05:28:19 PM »
Sweet, I didn't know that.  I'm gonna have to use Player1Fill for 'hey I'm the leader of this group' banters...

I've always thought that idea was rather goofy, since I wouldn't ever have Minsc or Sarevok making decisions for the group, I just want them to be the one in front.  Yoshimo's leader line always make me snicker, too.  "Look, karate boy, I want you in the front so you can detect the traps.  How hard is that to understand?"
Earn Money Sleeping.

 

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)?: