Author Topic: Stop looking at me !  (Read 482 times)

Legacy_Ed Venture

  • Full Member
  • ***
  • Posts: 200
  • Karma: +0/-0
Stop looking at me !
« on: December 31, 2013, 10:24:12 pm »


               I need some plaster to patch the hole in the wall I've been banging my head against all day.
Question. How do I keep an NPC from turning his head, when I'm in the area ? It was hard to keep the curses out of that.

I spawned an NPC, Human Rouge 25. Moved him to a comfortable chair and had him sit. Book open at his side, The ZZZs are floating over his head. Put a heartbeat script on him to keep them ZZZs going. He won't stop looking at me. One by one I stripped him down to just the On Spawn and On Heartbeat Scripts and He still won't stop looking at me ! I applied effects to him, (EffectBlind, EffectDeaf) with a door,with a trigger, and still he won't stop looking at me ! I checked his feats to make sure he didn't have immunity,( learned that one the hard way, trying to put a monk to sleep) and he still, won't stop looking at me ! I applied EffectSilence and EffectInvisibilty on the PC. That worked ! But I think a player is not going to have any fear, trying to sneak up on a guy when he knows he can't be seen or heard. I thought, Hey, maybe it has something to do with the sitting animation, so I got him on his feet. Yeah, yeah, I hear you groaning. Had the day off from work. Sat down at the computer around six this morning. It's now 5:00 pm. I'm tired. I'm cranky, and I think I need a shower. Could somebody Pulease, get him to STOP LOOOKING AT ME !!!  I need my binky.

Your knight in dented armor,
Ed
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Stop looking at me !
« Reply #1 on: December 31, 2013, 11:22:56 pm »


               <looking...>

The head turning feature is turned on/off in the last few columns of the appearance.2da
All humanoid appearances have it turned on, and it is on unless the npc has a "freeze anim" effect (can't look up the function here :-P )

You can a) change the appearance so those npc's never focus on PCs.
'B)' Modify the model so the head geometry (usually "head_g" no longer matches the head geometry listed in the appearance.2da (edit: same effect as (a); all or nothing)
c) apply a freeze anim effect once the npc is sitting
or d) grit your teeth and shut your eyes :-)

If there's any other possibility, I hope someone shares it :-)

<...through the whole in the wall>
               
               

               


                     Modifié par Rolo Kipp, 31 décembre 2013 - 11:24 .
                     
                  


            

Legacy_Valthrendir

  • Jr. Member
  • **
  • Posts: 80
  • Karma: +0/-0
Stop looking at me !
« Reply #2 on: January 01, 2014, 12:58:14 am »


               Only option c from that list could be done via scripting, the rest requires an override (with the exception of option d).

Unless you want to make a model (/change the references of the head model) for the specific NPC in question, appyling a freezing animation is your best bet
               
               

               


                     Modifié par Valthrendir, 01 janvier 2014 - 12:58 .
                     
                  


            

Legacy_Ed Venture

  • Full Member
  • ***
  • Posts: 200
  • Karma: +0/-0
Stop looking at me !
« Reply #3 on: January 01, 2014, 01:30:55 pm »


               Rolo and Valthrendir ,
Yahoooo !
I got it !

AssignCommand(oTarget,ActionPlayAnimation(nAn29,0.00001f,8.0));
On Heartbeat nAn29 = FIRE_FORGET_WHATEVER
He is so busy trying to execute the animation, that he cant move.

I want to say thank you to you guys. Thank You.
Your advice is always helpful. If nothing else it reassures a builder That he's not crazy or that it can't be done.

Now all I do is come up with an explanation for that picture I hung on the wall.

A guy offered me a penny for my thoughts the other day. I said to him, Sorry pal, I  don't have any change.

Ed
               
               

               
            

Legacy_Ed Venture

  • Full Member
  • ***
  • Posts: 200
  • Karma: +0/-0
Stop looking at me !
« Reply #4 on: January 01, 2014, 08:59:56 pm »


               I spoke too soon. It works as long as they're standing. The moment you sit them down, there goes that head again. EffectParalyze? nope. VFX_DUR_FREEZE? Uhuh. All the other stuff I tried ? Nada.
EffectCutSceneParalyze worked. After he stood up. There is just something about the Chair sitting animations that don't like playing with the other animations. I give up (for now)! I think my women left me.

Ed
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Stop looking at me !
« Reply #5 on: January 02, 2014, 12:41:33 am »


               I have this in onconversation for seated speakers:

#include "nw_i0_generic"
void Converse(string sResRef="", object oObjectToDialog=OBJECT_INVALID)
{
   object oChair = GetNearestObjectByTag("Chair", OBJECT_SELF);
   object oSitter = GetSittingCreature(oChair);
   if (oSitter == OBJECT_SELF)
   {
       ClearActions(CLEAR_NW_C2_DEFAULT4_29);
       BeginConversation(sResRef, oObjectToDialog);
       ClearAllActions();
       ActionSit(oChair);
   }
   else
   {
       ClearActions(CLEAR_NW_C2_DEFAULT4_29);
       BeginConversation(sResRef, oObjectToDialog);
   }
}
void main()
{    SetCommandable(TRUE);
   // * if petrified, jump out
   if (GetHasEffect(EFFECT_TYPE_PETRIFY, OBJECT_SELF) == TRUE)
   {
       return;
   }
   // * If dead, exit directly.
   if (GetIsDead(OBJECT_SELF) == TRUE)
   {
       return;
   }
   // See if what we just 'heard' matches any of our
   // predefined patterns
   int nMatch = GetListenPatternNumber();
   object oShouter = GetLastSpeaker();
   if (nMatch == -1)
   {
       // Not a match -- start an ordinary conversation
       if (GetCommandable(OBJECT_SELF))
       {
           Converse();
       }
       else
       // * July 31 2004
       // * If only charmed then allow conversation
       // * so you can have a better chance of convincing
       // * people of lowering prices
       if (GetHasEffect(EFFECT_TYPE_CHARMED) == TRUE)
       {
           Converse();
       }
   }
   // Respond to shouts from friendly non-PCs only
   else if (GetIsObjectValid(oShouter)
              && !GetIsPC(oShouter)
              && GetIsFriend(oShouter))
   {
       object oIntruder = OBJECT_INVALID;
       // Determine the intruder if any
       if(nMatch == 4)
       {
           oIntruder = GetLocalObject(oShouter, "NW_BLOCKER_INTRUDER");
       }
       else if (nMatch == 5)
       {
           oIntruder = GetLastHostileActor(oShouter);
           if(!GetIsObjectValid(oIntruder))
           {
               oIntruder = GetAttemptedAttackTarget();
               if(!GetIsObjectValid(oIntruder))
               {
                   oIntruder = GetAttemptedSpellTarget();
                   if(!GetIsObjectValid(oIntruder))
                   {
                       oIntruder = OBJECT_INVALID;
                   }
               }
           }
       }
       // Actually respond to the shout
       RespondToShout(oShouter, nMatch, oIntruder);
   }
   // Send the user-defined event if appropriate
   if(GetSpawnInCondition(NW_FLAG_ON_DIALOGUE_EVENT))
   {
       SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_DIALOGUE));
   }
}
               
               

               
            

Legacy_Ed Venture

  • Full Member
  • ***
  • Posts: 200
  • Karma: +0/-0
Stop looking at me !
« Reply #6 on: January 02, 2014, 04:07:08 am »


               ffbj,
Thank you for your reply. He is still looking at me.
If this helps.
The NPC is spawned by the door you enter the area with.
This is the NPC's On Spawn.
void main()
{
object oPC = GetFirstPC();
object oCap = OBJECT_SELF;
object oDay = GetObjectByTag("LannesansArmor");
object oNig = GetObjectByTag("NW_MCLOTH015");
object oChair = GetObjectByTag("CapsChair");
object oSeat = GetObjectByTag("CapsSeat");

if(GetIsDay())
{
 AssignCommand(oCap,ActionEquipItem(oDay,INVENTORY_SLOT_CHEST));
 DelayCommand(0.5,AssignCommand(oCap,ActionMoveToObject(oSeat,FALSE)));
 DelayCommand(2.0,AssignCommand(oCap,ActionSit(oSeat)));
 DelayCommand(4.0,SetLocalInt(oPC,"ZZZZZ",2));
}
else
{
 AssignCommand(oCap,ActionEquipItem(oNig,INVENTORY_SLOT_CHEST));
 DelayCommand(0.5,AssignCommand(oCap,ActionMoveToObject(oChair,FALSE)));
 DelayCommand(2.0,AssignCommand(oCap,ActionSit(oChair)));
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Effects That worked with a standing NPC where placed here
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 DelayCommand(4.0,SetLocalInt(oPC,"ZZZZZ",1));
}
}
This is the On Heartbeat.
void main()
{
object oPC = GetFirstPC();
object oTarget = OBJECT_SELF;
effect eSleep = EffectSleep();
effect eVis = EffectVisualEffect(VFX_IMP_SLEEP);

if(GetLocalInt(oPC,"ZZZZZ") == 3)//Busted
{
 //End Heartbeat Actions
}
else
{
 if(GetLocalInt(oPC,"ZZZZZ") == 2)//Awake Working
 {
  //Daytime Actions
 }
 else
 {
  if(GetLocalInt(oPC,"ZZZZZ") == 1)
  {
   ApplyEffectToObject(DURATION_TYPE_INSTANT,eVis,oTarget,8.0f);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Effects that where also placed here
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  }
 }
}
}
I have removed all of the effects I tried on both of these scripts.I have found alot of ways to freeze an Npc. None of them work while they are sitting.
I entered this script On Heartbeat for the chair for testing.
void main()
{
object oChair = OBJECT_SELF;
object oAss = GetSittingCreature(oChair);
//effect ePar = EffectMovementSpeedDecrease(99);

if(GetLocalInt(oAss,"ZZZZZ") == 1)
{
 if(GetIsObjectValid(oAss))
 {
  //This where I placed several effects for testing.
  // It ain't ass would fire untill the Int was set.
  // after that I'm doing.... fired,but not the effects.
/////////////////////////////////////////////////////////////////////
  //ApplyEffectToObject(DURATION_TYPE_INSTANT,ePar,oAss,0.8);
  //SpeakString("I'm doing what you told me. ",TALKVOLUME_TALK);
 }
 else
 {
 // SpeakString("What the Heck ?",TALKVOLUME_TALK);
 }
}
else
{
// SpeakString("It aint Ass",TALKVOLUME_TALK);
}
}
the include x0_i0_anims was also used on these scripts. I don't know if that has anything to do with it, but I wanted to give you guys as much info as I could. As you can tell I am also using conditionals, because depending on the time of day the player enters, the NPC will be either sleeping or awake.

I'm moving on with the build (already spent about 20 hours on this problem), but am keeping the door open on this part.

Thanks again,
Ed
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Stop looking at me !
« Reply #7 on: January 02, 2014, 08:39:12 pm »


               My standard onspawn for sitting npc's.
Try putting it in, just to see if it helps.  If not then put in a standard hb script.
Then you will at least know where the problem lies.  I do not have that trouble with npc's, but I know what you mean they swerve their heads around.
#include "nw_i0_generic"
void main()
{
 object oChair = GetNearestObjectByTag("Chair", OBJECT_SELF);
 float fDistance = GetDistanceToObject(oChair);


    // * If dead, exit directly.
   if ((GetIsDead(OBJECT_SELF) == TRUE)|| (GetIsInCombat(OBJECT_SELF)))
   {
       return;
   }
   if ((GetIsObjectValid(oChair) && !(GetIsObjectValid (GetSittingCreature (oChair)) && (fDistance) < 6.0)))
   ActionSit(oChair);




   // Send the user-defined event if appropriate
   if(GetSpawnInCondition(NW_FLAG_ON_DIALOGUE_EVENT))
   {
       SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_DIALOGUE));
   }
}

But first remove x0_i0_anims// comment it out
               
               

               


                     Modifié par ffbj, 02 janvier 2014 - 08:43 .
                     
                  


            

Legacy_Ed Venture

  • Full Member
  • ***
  • Posts: 200
  • Karma: +0/-0
Stop looking at me !
« Reply #8 on: January 03, 2014, 03:20:11 am »


               ffbj,
Both your script and mine do the same thing. They keep the NPC sitting on conversation.
I have done alot of testing on this, and have come to this conclusion, It seems that once the sitting animation is applied in the NPC,s Action que it excludes all other actions.
Test 1 When these lines are inserted in the On Heartbeat (As Above) the Pc enters the area, The Npc is seated. The moment the HB fires he stands up and Freezes(including his head). PlayAnimation must clear the que.

  ApplyEffectToObject(DURATION_TYPE_INSTANT,eVis,oCap,8.0f);
   AssignCommand(oCap,PlayAnimation(ANIMATION_FIREFORGET_BOW,0.00001,7.0));

Test 2 Insert the ActionPlayAnimation, and he stays in the chair, but that head still follows you around. I used the chair script(Above) to show that after the conditions were TRUE,(The NPC was sitting in chair and had the correct variable set on him) The SpeakString fired, but not the same line that freezes him completely, when he is standing.
                                                                                                                       AssignCommand(oCap,ApplyEffectToObject(DURATION_TYPE_INSTANT,eVis,oCap,8.0f);
   ActionPlayAnimation(ANIMATION_FIREFORGET_BOW,0.00001,7.0));

As far as I can tell,( That's a noob far) It must be a game setting, that I can't get to.Some day when I'm good enough to learn how edit game files, I swear, I'm going to stop that head.

I appreciate the time and energy you put in trying to help.
Thank You,
Ed
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Stop looking at me !
« Reply #9 on: January 03, 2014, 04:31:22 pm »


               Yes, you are correct.  What it fixed was their full bodies turning in the chair, which I really hated.
So no dice on the head turn, though I imagine someone fixed it somewhere along the way.
Yes there is something special about sitting.  For instance if you change you weapon it stands you up.  It might be something in the onperception that fires it, the head turn.  So if you walk by someone and they notice you they turn their head.  One way to test this I suppose would be to make an npc blind and deaf and see if their head still turns while seated.
               
               

               
            

Legacy_Ed Venture

  • Full Member
  • ***
  • Posts: 200
  • Karma: +0/-0
Stop looking at me !
« Reply #10 on: January 05, 2014, 02:43:14 pm »


               ffbj ,
Thank you.
Ed