Page 1 of 1

Force NPC into an Alarmed state?

PostPosted: Thu Aug 20, 2009 11:00 pm
by Samantha Mitchell
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?

Force NPC into an Alarmed state?

PostPosted: Fri Aug 21, 2009 2:14 am
by lilmissparty
Set their alarm to 90 or higher.

Force NPC into an Alarmed state?

PostPosted: Thu Aug 20, 2009 11:11 pm
by Tha King o Geekz
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.

Force NPC into an Alarmed state?

PostPosted: Thu Aug 20, 2009 9:39 pm
by Danel
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).

Force NPC into an Alarmed state?

PostPosted: Thu Aug 20, 2009 9:09 pm
by Jessie Butterfield
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)

Force NPC into an Alarmed state?

PostPosted: Fri Aug 21, 2009 5:28 am
by Jordan Fletcher
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.

Force NPC into an Alarmed state?

PostPosted: Fri Aug 21, 2009 5:24 am
by Amanda Leis
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.

Force NPC into an Alarmed state?

PostPosted: Fri Aug 21, 2009 4:48 am
by Amysaurusrex
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.

Force NPC into an Alarmed state?

PostPosted: Fri Aug 21, 2009 3:07 am
by DarkGypsy
Dialog can test for both local variables in a script attached to an NPC and global variables.

Force NPC into an Alarmed state?

PostPosted: Thu Aug 20, 2009 3:29 pm
by Margarita Diaz
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.

Force NPC into an Alarmed state?

PostPosted: Fri Aug 21, 2009 2:46 am
by Scott
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?

Force NPC into an Alarmed state?

PostPosted: Thu Aug 20, 2009 6:45 pm
by emily grieve
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.

Force NPC into an Alarmed state?

PostPosted: Fri Aug 21, 2009 12:13 am
by ChloƩ
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?

Force NPC into an Alarmed state?

PostPosted: Thu Aug 20, 2009 5:41 pm
by Carys
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.