stars2heaven Posted March 27, 2011 Share Posted March 27, 2011 I'm trying to set this up so that this npc is enabled, approches a location on a ledge, says something to you, and then runs away. I've got that much working, finally. But for some reason her AI is now bonkers, even though nothing has changed with her AI and it was working fine when the script to make her speak to you was broken. What happens now is, instead of running away after speaking to you, she follows me around insisting that I am trespassing, despite the fact that she has AI telling her to go elsewhere. The actual script is quite long with parts not relevant to this, so this is just a snipet of the script. I'll explain what things are doing inside the script. Also, if you know an easier way to do the same thing let me know! If (Player.GetDistance AAs2hlidDisableforQueen1 <= 300) && (DoOnce == 4) DisablePlayerControls NPCRef.enable Set DoOnce to 5 Set Timer2 to 2 EndIf If (Speak == 0) && (timer1 <= 0) && (DoOnce == 5) Set Speak to 1 Set Timer2 to Timer2 - GetSecondsPassed ;These timers are set up because I found that I couldn't get the npc to say her lines right after enabeling her. Also, she has an AI travel package that is true so long as "Speak" is less than 4, this part is working fine. ElseIf (Speak == 1) && (Timer2 <= 0) Set timer1 to NPCRef.say NPCTauntSpeach 1 NPCI.D. 1 Set Timer2 to 2 Set Speak to 2 ElseIf Speak == 2 Set Timer2 to Timer2 - GetSecondsPassed Set Speak to 3 ;This timer is here because I wanted to give her time to say her stuff and get away before enabling player controls again ElseIf (Speak == 3) && (Timer2 <= 0) EnablePlayerControls Set Speak to 4 ;Here speak is set to 4 and makes false her previous AI Package, and makes true the one that is supposed to make her run away. Instead, she runs to the player as I described even though the location she must travel to is not the player. EndIf Just so you know, the setting is within a dungeon. There is no owner set for the cell and the npc is not a merchant or anything special. She is a member of an evil faction, however. But her aggression for the moment is set to 5. Link to comment Share on other sites More sharing options...
stars2heaven Posted March 27, 2011 Author Share Posted March 27, 2011 Never mind. I was looking back over some other scripts that I've wrote that do similar things and noticed evaluate package commands. Putting one in this script made her do what she was supposed to. However, I still feel that this script is very muddy. If anyone happens to know of a way to improve it, do it more simply, or whatever, please let me know. Link to comment Share on other sites More sharing options...
Hickory Posted March 27, 2011 Share Posted March 27, 2011 Make sure that the package is set to Must Complete, Must Reach Destination and No Low Level Processing. Also make sure that her confidence is low if she is to run away.. Link to comment Share on other sites More sharing options...
Hickory Posted March 27, 2011 Share Posted March 27, 2011 However, I still feel that this script is very muddy. If anyone happens to know of a way to improve it, do it more simply, or whatever, please let me know. Without knowing the rest of the script, this is how I would compose the portion you quoted: If Player.GetDistance AAs2hlidDisableforQueen1 > 300 Return ElseIf DoOnce == 4 DisablePlayerControls NPCRef.enable Set DoOnce to 5 Set Timer2 to 2 If ( Speak == 0 ) && ( timer1 <= 0 ) Set Speak to 1 Set Timer2 to Timer2 - GetSecondsPassed ElseIf ( Speak == 1 ) && ( Timer2 <= 0 ) Set timer1 to NPCRef.say NPCTauntSpeach 1 NPCI.D. 1 Set Timer2 to 2 Set Speak to 2 ElseIf Speak == 2 Set Timer2 to Timer2 - GetSecondsPassed Set Speak to 3 ElseIf ( Speak == 3 ) && ( Timer2 <= 0 ) EnablePlayerControls Set Speak to 4 EndIf Endif Link to comment Share on other sites More sharing options...
Recommended Posts