Detecting combat

Post » Sat Feb 06, 2010 12:44 am

Is it possible to check if an actor is in combat? I have searched MWSD and couldn't find anything.

It would be great to hear that there is a function!
User avatar
Chase McAbee
 
Posts: 3315
Joined: Sat Sep 08, 2007 5:59 am

Post » Fri Feb 05, 2010 10:00 pm

Check if either getWeaponDrawn or getSpellReddied are 1 for the given actor.
User avatar
Sammi Jones
 
Posts: 3407
Joined: Thu Nov 23, 2006 7:59 am

Post » Fri Feb 05, 2010 5:10 pm

I wondered this recently. I ended up doing what Yacoby suggested, but I also looked into the "GetFight" function. From MWSFD:

When an Actor’s fight setting hits 100, they will attack the PC.
Player actions will increase (or decrease) an Actor’s fight setting. These are...
Attack Actor 100
etc.


However, I found that attacking an NPC actually had no effect on their Fight setting :wacko:

I also wonder, does an NPC holding a torch count as them having a weapon drawn...?
User avatar
sara OMAR
 
Posts: 3451
Joined: Wed Jul 05, 2006 11:18 pm

Post » Fri Feb 05, 2010 6:00 pm

Alright I'll check for get Weapon Drawn, thank you :)


I also wonder, does an NPC holding a torch count as them having a weapon drawn...?


But also that would be good to know.
User avatar
kristy dunn
 
Posts: 3410
Joined: Thu Mar 01, 2007 2:08 am

Post » Sat Feb 06, 2010 12:01 am

I also wonder, does an NPC holding a torch count as them having a weapon drawn...?


I'm not a scripting expert, but I doubt it. I believe setting WeaponDrawn=1 would be the same as you pressing the [F] key while your weapon was sheathed, I.E. it's a separate mechanical state and not just "he's holding something in his hand."
User avatar
Benito Martinez
 
Posts: 3470
Joined: Thu Aug 30, 2007 6:33 am

Post » Sat Feb 06, 2010 2:22 am

Yeah, I'd probably agree with you there. I was just curious because I had a problem recently with parts of my scripts not working which I thought could have been caused by a "GetWeaponDrawn" section (and the NPC holding a torch), but actually I think it was just because of a dirty save :/
User avatar
Antonio Gigliotta
 
Posts: 3439
Joined: Fri Jul 06, 2007 1:39 pm


Return to III - Morrowind