Author Topic: Faction: getisenemy . Moving NPCs  (Read 361 times)

Legacy_DM_Vecna

  • Hero Member
  • *****
  • Posts: 501
  • Karma: +0/-0
Faction: getisenemy . Moving NPCs
« on: January 10, 2013, 06:33:57 pm »


                I am playing with my factions and am thinking about how NPCs move aside when near a friendly PC. Does anyone know if this is hard coded, or perhaps there is a way to hook into this behavior?  

I am also interested in getisenemy, is there a lib somewhere with that function or again hard coded? I have a feeling getisenemy is driving the npc behavior above.

thanks!
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Faction: getisenemy . Moving NPCs
« Reply #1 on: January 10, 2013, 07:03:49 pm »


               Interesting, I have not noticed that behavior of a creature stepping aside. Could it be how a non hostile naturally reacts to personal space versus the way a hostile faces their enemy and moves to attack? Anyway, I am curious and will look for it now.

Regarding GetIsEnemy. I don't think that is drawn from a library.

I am curious as to why you suspect that it drives the "stepping aside" behavior? And how does it drive that behavior?

Do mean by calling that function it sets up the behavior? That possibility doesn't seem likely to me.
               
               

               
            

Legacy_Invisig0th

  • Sr. Member
  • ****
  • Posts: 279
  • Karma: +0/-0
Faction: getisenemy . Moving NPCs
« Reply #2 on: January 13, 2013, 11:20:40 am »


               If I understand correctly, I believe you may be referring to the situation where an immobile friendly creature will slide slightly out of the way if you run into them, similar to how a henchman would. The purpose appears to be preventing a PC from being inadvertently trapped by friendlies standing nearby. IIRC, neutral creatures will not "slide" out of the way, and will remain in position.

I seem to recall seeing this occasionally in community-made modules, where a larger friendly creature is barring progress by physically blocking passage with their bodies. Say, for example, an umber hulk standing in front of a small doorway.  If that creature is in a neutral faction and you bump into him, I believe he does not move at all. But if that creature is in a friendly faction and you bump into him, I believe he may slide a very short distance, allowing passage.

If that is indeed what is being asked about here, then we are talking about a very subtle feature of the collision detection system. It's safe to say that this collision detection and exactly how it behaves is entirely hard coded way down deep inside the engine. The only "hooks" would be the collision-related settings that we as builders can adjust (perspace and such in the appearance.2da). Considering that the faction relationship is only a tangential consideration, I doubt you'll be able to alter the actual mechanics of how this works for friendly vs. neutral creatures in any way with scripting. Other than shifting factions back and forth, you're probably not going to influence things much.
               
               

               


                     Modifié par Invisig0th, 13 janvier 2013 - 11:37 .
                     
                  


            

Legacy_Invisig0th

  • Sr. Member
  • ****
  • Posts: 279
  • Karma: +0/-0
Faction: getisenemy . Moving NPCs
« Reply #3 on: January 13, 2013, 11:33:21 am »


               As a side note, anyone interested in factions and how they work with functions like GetIsEnemy() should take a look at this tutorial from Bioware. It won't help you change the behavior or locate the library these functions are in, but it will help you understand how all this stuff is supposed to work in the first place (which is not exactly intuitive).

NWNLexicon - Factions, Shouts, and Attacking My Enemy
               
               

               


                     Modifié par Invisig0th, 13 janvier 2013 - 11:36 .