Force NPC into an Alarmed state?

Post » Thu Aug 20, 2009 11:00 pm

is there any function or way to force an npc into their alarmed state? basically like if you committed a crime in front of them?
User avatar
Samantha Mitchell
 
Posts: 3459
Joined: Mon Nov 13, 2006 8:33 pm

Post » Fri Aug 21, 2009 2:14 am

Set their alarm to 90 or higher.
User avatar
lilmissparty
 
Posts: 3469
Joined: Sun Jul 23, 2006 7:51 pm

Post » Thu Aug 20, 2009 11:11 pm

i mean like through a script. so that you can use the alarmed function in dialog. seems like there is no way to alarm an npc outside of gameplay.
User avatar
Tha King o Geekz
 
Posts: 3556
Joined: Mon May 07, 2007 9:14 pm

Post » Thu Aug 20, 2009 9:39 pm

SetAlarm sets a degree at which NPC tends to be alarmed *when* he sees a crime by PC. Even SetAlarm 100 won't mean that NPC will become alarmed without a reason. But if your goal is to use Alarm value as free variable - it's exactly what you need, along with SetHello or SetFlee (although SetHello is often used by LGNPC mods, so you might cause a behavior conflict).
User avatar
Danel
 
Posts: 3417
Joined: Tue Feb 27, 2007 8:35 pm

Post » Thu Aug 20, 2009 9:09 pm

my goal was to find out if there was a function to switch an NPC into their alarmed state. (like if they witness a crime)
User avatar
Jessie Butterfield
 
Posts: 3453
Joined: Wed Jun 21, 2006 5:59 pm

Post » Fri Aug 21, 2009 5:28 am

I'm not sure what you're asking. If you increase an NPC's alarm rating, they'll report any crime they notice the player committing. That's all that alarm really does. What exactly do you want the NPC to do? Or, maybe more precisely, what should they do when they notice the player? Do you want them to refuse to talk to the player? Do you want them to attack? Do you want them to say something? I don't think NPCs react any differently when they're in an alarmed state, which is why I'm confused by your request.
User avatar
Jordan Fletcher
 
Posts: 3355
Joined: Tue Oct 16, 2007 5:27 am

Post » Fri Aug 21, 2009 5:24 am

I'm just guessing as to what you want to do here but it sounds like you maybe trying to create a new law & have the NPC's in the area respond to that new law being broken.

To do something like this you would want to first use getPCCrimelevel to determine the player's current bounty. Then increment that result by your new crime's bounty. Next use setPCCrimelevel to that amount and the NPC's should respond appropriately for their alarm rating.

If you just want the NPCs to attack the player then use startCombat to have the NPC attack.
User avatar
Amanda Leis
 
Posts: 3518
Joined: Sun Dec 24, 2006 1:57 am

Post » Fri Aug 21, 2009 4:48 am

I can't think of any way to properly alarm them through a script, unfortunately. I'm not very experienced with the commands but I don't see any way of doing it. All I can think of is forcing an item of their property to be taken by the player, but I don't think that's possible.
You might have to instead simulate the effect, such as using the Say command to make them yell, lower disposition, raise bounty as Nicholiathan described, then check GetFight and conditionally decide whether to call StartCombat, or whatever effect you're after.

I was curious and tried raising my crime level in the console, while standing in front of an NPC, but it didn't alarm them. They do of course react to the crime level when you speak to them, but won't really be in the alarmed state.

To control dialogue with it, maybe the dialogue can test for some variable which you set in the "simulated alarm" script. I don't know if dialogue can test for arbitrary variables or not.
User avatar
Amysaurusrex
 
Posts: 3432
Joined: Wed Aug 09, 2006 2:45 pm

Post » Fri Aug 21, 2009 3:07 am

Dialog can test for both local variables in a script attached to an NPC and global variables.
User avatar
DarkGypsy
 
Posts: 3309
Joined: Tue Jan 23, 2007 11:32 am

Post » Thu Aug 20, 2009 3:29 pm

the idea was to get the npcs to be able to call for the guards, and the guards to respond appropriately. Also so that their alarm can be deactivated if the player pays off the fine and such. seems like i need to implement a heavy handed way of doing it instead, since i can't get npcs to be alarmed except through player actions.
User avatar
Margarita Diaz
 
Posts: 3511
Joined: Sun Aug 12, 2007 2:01 pm

Post » Fri Aug 21, 2009 2:46 am

i can't get npcs to be alarmed except through player actions.

Which is reasonable since the NPC needs a reason to be alarmed. Which brings about a question. Exactly what action do you want to cause alarm such that an NPC will raise an alarm?
User avatar
Scott
 
Posts: 3385
Joined: Fri Nov 30, 2007 2:59 am

Post » Thu Aug 20, 2009 6:45 pm

mainly because their AI resets if you pay off your fine/turn yourself in. some instances this would be good is for things like trespassing, making npc guards without using the guard class, disguises, etc.
User avatar
emily grieve
 
Posts: 3408
Joined: Thu Jun 22, 2006 11:55 pm

Post » Fri Aug 21, 2009 12:13 am

If I may indulge in a bit of thread necromancy with this fresh corpse, I would like to ask a similar question.

I would like NPC's to treat it as a crime if you enter their shop/home after hours. I had planned to do this by setting a variable with a script attached to the door, but then I realized I didn't know how to detect if the lock had been picked. So, I figured a local script on the NPC that checked to see if they could detect you during certain hours.

However, I'm facing the same problem. How can I get them to treat trespassing after hours like a crime?
User avatar
ChloƩ
 
Posts: 3351
Joined: Sun Apr 08, 2007 8:15 am

Post » Thu Aug 20, 2009 5:41 pm

You'll need to either fake the behavior and script-set the bounty higher or force the PC to commit an actual crime. There are a few ways to go about either, but I think faking alarmed behavior (AIFollow or AIFlee, Say a line, give the PC a bounty, etc) would work best.
User avatar
Carys
 
Posts: 3369
Joined: Wed Aug 23, 2006 11:15 pm


Return to III - Morrowind