Author Topic: Can an NPC detect what form the PC has taken...  (Read 477 times)

Legacy_NullthraB

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
Can an NPC detect what form the PC has taken...
« on: July 10, 2011, 04:09:13 pm »


               hello,
Can an NPC detect what form/polymorph the pc has taken without using varibles?

I've got a bunch of scripts that allows the player to change his/her form and also to polymorph. It is a rather simple script that uses a conversation to change "set appearance" of the player.

Is there a way to call up and check what "set appearance" the pc currently has choosen? Cause I think that would solve the issue.

I'm not very good with scripting so any help or advice would be great.

Also with polymorphing in the nwn 1 toolset if you poly the pc into the red dragon would he/she be able or have fire breath ability?  I'm a bit fuzzy on polymorphing. Like if you polymorphed turned into a fish would you die out of water?
Say you poly into a red dragon, you'd get the HPoints and base attacks but not the fire breath or ability to fly?

Any suggestions?

thanks,
nb
               
               

               
            

Legacy_NullthraB

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
Can an NPC detect what form the PC has taken...
« Reply #1 on: July 10, 2011, 05:17:52 pm »


               hello,
Another issue that I'm having with this change self script is that when the player loads a saved game he/she is reverted back to their original player appearance, the appearance they selected when creating their character.  I was able to work around it but it does require the player to reset his/her normal appearance.

So, I'm happy with the way things are now but am still curious if there's a better way of doing this.

Any suggestions?

thanks,
nb
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Can an NPC detect what form the PC has taken...
« Reply #2 on: July 10, 2011, 05:29:07 pm »


               // returns the appearance type of the specified creature.
// * returns a constant APPEARANCE_TYPE_* for valid creatures
// * returns APPEARANCE_TYPE_INVALID for non creatures/invalid creatures
int GetAppearanceType(object oCreature)

If you still have questions, I can elaborate when I get back from my swim.

Funky
               
               

               


                     Modifié par FunkySwerve, 10 juillet 2011 - 04:31 .
                     
                  


            

Legacy_NullthraB

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
Can an NPC detect what form the PC has taken...
« Reply #3 on: July 10, 2011, 07:15:53 pm »


               hello,
I will have more questions on this for sure so thank you in advance.

Basically without using any set local int variables on the pc who has changed "set" his/her appearance to (blank), what I'd like is a simple "text appears" starting condition that I could place into conversations that would pop up first.  These start conditions would be based on the players current set appearance type but in a reversed way. So only one type of set appearance would work and all other appearances would return negative reactions.  IS that possible to call on solely based on the players current set appearance? If the int GetAppearanceType(object oCreature) is where you're heading that would be great, however because I don't really know that much about scripting I'm still not sure exactly what that means or how to call on it. For Conversations this one.

Another issue that I'd be interested in and need help with would be set on a hostile NPC or creatures OnHeartbeat script that would check the PC's set appearance and return a non hostile reaction (no attack on sight) if the set appearance met to that NPC's liking. The npc would still be hostile.

Example: PC sets appearance to goblin then enters a den of hostile goblins but the goblins don't react to him at all because of the newly set goblin disguise, unless the player changed right in front of them of course. Also I'd need to figure out a way for the pc to start a conversation with the hostile goblins if I were to use this kind of script. I'm sure I could come up with with a hidden speaker or a triggered event but I think it would feel funny if you couldn't talk to them while in disguise. Not sure on this either.

I could be grasping at straws with this one. Seems too complicated.

Any other suggestions?

thanks,
nb
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Can an NPC detect what form the PC has taken...
« Reply #4 on: July 10, 2011, 08:41:23 pm »


               Before delving into your questions about conversations, is there a reason you're using SetAppearance instead of Polymorphing? To answer your questions about polymorphing, yes, players can get some abilities from the form they shift into - this is controlled by the polymorph.2da. You can view 2das (and export them to text )with programs like NWN Explorer

Looking at the first few lines of polymorph 2da, it doesn't look like the Shapechange version of the red dragon polymorph gets any breathing or other abilities:

2DA V2.0

       Name                                      AppearanceType    RacialType    PortraitId    Portrait          CreatureWeapon1     CreatureWeapon2     CreatureWeapon3     HideItem            EQUIPPED          STR     CON     DEX     NATURALACBONUS    HPBONUS    SoundSet    SPELL1    SPELL2    SPELL3    MergeW    MergeI    MergeA
0      POLYMORPH_TYPE_WEREWOLF                   171               23            316           po_werewolf       nw_it_crewpsp002    nw_it_crewpsp002    nw_it_crewps005     nw_it_creitem018    ****              18      ****    18      5                 ****       ****        ****      ****      ****      ****      ****      ****  
1      POLYMORPH_TYPE_WERERAT                    170               23            315           po_wererat        ****                ****                nw_it_crewps002     nw_it_creitem018    ****              16      ****    22      5                 ****       ****        ****      ****      ****      ****      ****      ****  
2      POLYMORPH_TYPE_WERECAT                    99                23            314           po_werecat        nw_it_crewpsp010    nw_it_crewpsp010    nw_it_crewps015     nw_it_creitem018    ****              20      ****    20      5                 ****       ****        ****      ****      ****      ****      ****      ****  
3      POLYMORPH_TYPE_POLYSELF_GIANT_SPIDER      159               25            301           po_spidgiant      ****                ****                nw_it_crewps018     nw_it_polyhid001    ****              19      ****    17      5                 ****       ****        ****      ****      ****      ****      ****      ****  
4      POLYMORPH_TYPE_POLYSELF_TROLL             167               18            306           po_troll          nw_it_crewpsp005    nw_it_crewpsp005    nw_it_crewps005     nw_it_polyhid002    ****              23      ****    14      5                 ****       ****        ****      ****      ****      ****      ****      ****  
5      POLYMORPH_TYPE_POLYSELF_UMBER_HULK        168               7             309           po_umberhulk      nw_it_crewpsp006    nw_it_crewpsp006    nw_it_crewps017     nw_it_polyhid003    ****              23      ****    15      7                 ****       ****        ****      ****      ****      ****      ****      ****  
6      POLYMORPH_TYPE_POLYSELF_PIXIE             55                17            559           po_fairy          nw_it_crewpsp026    nw_it_crewpsp026    ****                nw_it_polyhid004    ****              10      ****    24      5                 ****       ****        ****      ****      ****      ****      ****      ****  
7      POLYMORPH_TYPE_POLYSELF_ZOMBIE            198               24            354           po_zo_rot01       nw_it_crewpb005     ****                ****                nw_it_polyhid005    ****              14      ****    14      ****              ****       ****        ****      ****      ****      ****      ****      ****  
8      POLYMORPH_TYPE_SHAPECHANGE_RED_DRAGON     49                11            198           po_drgred         nw_it_crewpsp015    nw_it_crewpsp015    nw_it_crewps017     nw_it_creitemdrm    ****              36      ****    30      10                ****       ****        ****      ****      ****      ****      ****      ****  



By contrast, the shifter form does get spell 239, or Dragon_Breath_Fire (looking in the spells.2da).


72     POLYMORPH_TYPE_DRAGON_RED                 1670              11            198           po_drgred         nw_it_crewpsp027    nw_it_crewpsp027    nw_it_crewps017     x2_it_emptyskin     ****              48      ****    36      0                 ****       29          239       ****      ****      ****      ****      ****  


If you used polymorphs instead of appearances, you would scan for polymorph effects and check type, instead of looking at appearances.

Funky
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Can an NPC detect what form the PC has taken...
« Reply #5 on: July 10, 2011, 08:57:48 pm »


               Sorry, these forums are atrocius for posting 2das in (and code in general, really). Have a look in NWN Explorer for a clearer idea of what I'm talking about. Can't even see the columns in that mess.

Funky
               
               

               
            

Legacy_La Rose Noire

  • Newbie
  • *
  • Posts: 49
  • Karma: +0/-0
Can an NPC detect what form the PC has taken...
« Reply #6 on: July 10, 2011, 09:35:36 pm »


               Appearance is an integer. Store it on the PC when polymorphing him si you can use it in NPC OnPerception script.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Can an NPC detect what form the PC has taken...
« Reply #7 on: July 10, 2011, 09:50:08 pm »


               

La Rose Noire wrote...

Appearance is an integer. Store it on the PC when polymorphing him si you can use it in NPC OnPerception script.



NullthraB wrote...

hello,
Can an NPC detect what form/polymorph the pc has taken without using varibles?



               
               

               
            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
Can an NPC detect what form the PC has taken...
« Reply #8 on: July 11, 2011, 12:06:54 am »


               Just to throw in my two cents worth usually when a PC is polyed they receive a skin with that change you could check the skin tag to determine what form they have polyed into. So in the case of appearance change check their appearnce type, and poly check the tag of their skin.
               
               

               


                     Modifié par Baragg, 10 juillet 2011 - 11:07 .
                     
                  


            

Legacy_NullthraB

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
Can an NPC detect what form the PC has taken...
« Reply #9 on: July 11, 2011, 01:29:45 am »


               hey folks,
thanks for the input however i think i'm more confused now because I'm not good at scripting stuff.
L.Souls Sc.Gen does not have a text appears function for checking what Appearance the player currently has placed. And i could not create it by my self.
Also all of my change self scripts were created by LS SGen.

Set polymorph type is very limited using nwn 1.69 basic. However setting the appearance type had many more options. So what I did was a little of both.

I've got an PC who can, over a period of time learn to change his/her appearance via poly and set appearance. Using nwn 1 toolset 1.69 I've selected the Type and Poly for the player using a conversation which uses simple script to change the Appearance or Poly type of the player.

My question is.....
Can you script/create a script for me that I can use via a conversation that will be able to tell (Text Appears) when and based on the players current set Appearance that will fire when he/she enters a conversation with said NPC.

Example: Player is a goblin
player uses item to change into a human
when he meets a human...that humans conversation file fires saying this another human and I should speak to him like a brother. different responses based on the goblins other appearance would arise if the goblin was not looking like a human.

I think that is the simplest way to do it.
But...



so the goblin appears as a human and the human treats him as a fellow human (text appears OPC is set to human appearance).

If opc (goblin) looks like a wolf or pixie the humans conversation will reflect a reaction based on a simple text appears script.

I'd like to just stay focused on the text appears starting condition for now.

Note: all set appearance scripts are simple and were created using LS S Gen. SO I need a very simple Text appears script that lets the conversation file know which appearance the pc currectly has set.

thank you,
nb
               
               

               
            

Legacy_NullthraB

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
Can an NPC detect what form the PC has taken...
« Reply #10 on: July 11, 2011, 02:22:03 am »


               
               
               

               


                     Modifié par NullthraB, 11 juillet 2011 - 07:13 .
                     
                  


            

Legacy_NullthraB

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
Can an NPC detect what form the PC has taken...
« Reply #11 on: July 11, 2011, 11:18:58 am »


               pls help script this for me

L Souls script gen does not have or use this type of text appears condition therefore I can't create it on my own

I need some help with this one. '<img'>

// For a starting condition text appears within a
// Conversation that checks the players
// set appearance and returns ture. If player is this
// appearance than start this conversation line.

void main
{
int oPC GetAppearanceType_GOBLIN_B
}


This is a start, I'll need to do this.
thank you,
:innocent:
               
               

               


                     Modifié par NullthraB, 11 juillet 2011 - 07:12 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Can an NPC detect what form the PC has taken...
« Reply #12 on: July 11, 2011, 10:08:47 pm »


               int StartingConditional()
{
    int nAppearance = GetAppearanceType(GetPCSpeaker());
    int iResult =
      (
           nAppearance == APPEARANCE_TYPE_GOBLIN_A
         ||nAppearance == APPEARANCE_TYPE_GOBLIN_B
         ||nAppearance == APPEARANCE_TYPE_GOBLIN_CHIEF_A
         ||nAppearance == APPEARANCE_TYPE_GOBLIN_CHIEF_B
         ||nAppearance == APPEARANCE_TYPE_GOBLIN_SHAMAN_A
         ||nAppearance == APPEARANCE_TYPE_GOBLIN_SHAMAN_B
       );
    return iResult;
}
               
               

               
            

Legacy_NullthraB

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
Can an NPC detect what form the PC has taken...
« Reply #13 on: July 12, 2011, 12:27:39 pm »


               Thanks Lightfoot8,
The script compiled without any errors and I'll be testing it out over the week.

Thanks again,
nb
               
               

               
            

Legacy_NullthraB

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
Can an NPC detect what form the PC has taken...
« Reply #14 on: July 15, 2011, 11:18:06 am »


               Hi,
To: Litfoot8,
The script doesn't do what I'm looking for.

To: Funky
Polymorph was missing some Appearance Types I wanted to use.

I'm looking for 2 text appears starting condition scripts for conversations, that uses the PC's currect set Appearance and or Ploymorph TYPE_(.....) as a text node Appears starting variable.


//Looks for Appearance


//Looks for Polymorph


Is this possible...help?

TY,
nb