Getting a character to stop a fight ?

Post » Tue Sep 22, 2015 9:02 am

All right. I'm tearing my hair out on this one. For days, I've been trying to get a character to stop attacking you and talk to you after a certain point, but nothing I do seems to work.
Basically, you get imprisoned, and you can talk to your guard, who'll let you out if you beat him in hand-to-hand combat. So, I devised this script :

Spoiler
scn IBScript8


short DoOnce

Begin GameMode

if ( DoOnce == 1 )
return
elseif ( DoOnce == 0 )
if ( JonasRef.GetCurrentHealth <= 20 )
JonasRef.StopCombat Player
JonasRef.SetActorValue Aggression 0
JonasRef.ModDisposition player 100
JonasRef.StartConversation Player, Greeting
set DoOnce to 1
endIf
endif

End

Yes, I tried it with GetAV Health, I tried putting an OnKnockout block (he's essential), etc. Should I put a Yield command ? I doubt it'll work. I'm really lost here, so any help will be appreciated.

Oh, and there's a second problem : everytime he falls unconscious, he wakes up, attacks me, and there's now a bounty. Is it because he's a guard ?

I'm stumped :(

User avatar
laila hassan
 
Posts: 3476
Joined: Mon Oct 09, 2006 2:53 pm

Post » Tue Sep 22, 2015 4:42 pm

You don't need to change his aggression if it's only 5, which it should be if he's a guard. It might be better not to use a real guard for this because of the whole crime detection code.

Try using http://cs.elderscrolls.com/index.php?title=StopCombatAlarmOnActor. You'd have to pay off the bounty as well. That might be why he keeps attacking.

User avatar
Michelle Smith
 
Posts: 3417
Joined: Wed Nov 15, 2006 2:03 am

Post » Tue Sep 22, 2015 5:32 am

Thanks for replying, Andalay. But no, it doesn't work. The actor just keeps on hitting me, even when he's obviously at less than 20 health. I'll try tweaking his responsibilty and class next, as a last resort.

User avatar
Causon-Chambers
 
Posts: 3503
Joined: Sun Oct 15, 2006 11:47 pm

Post » Tue Sep 22, 2015 7:13 pm

All right, new update : I've changed his class from Guard to Knight, and set a command to erase the PC's bounty at the start of the fight. This takes care of the getting up and having a new bounty problem. However, he still won't stop attacking at 20 health or less. So there's still that problem.

User avatar
Jeffrey Lawson
 
Posts: 3485
Joined: Tue Oct 16, 2007 5:36 pm

Post » Tue Sep 22, 2015 8:40 am

1. GetCurrentHealth isn't for checking actor health.
2. It's irrelevant to alter aggression or disposition as long as the actor's aggression is 5 or below.
3. For StopCombat, you don't need "player" at the end.

scn IBScript8short DoOncebegin Gamemode if (DoOnce == 1) RETURN elseif (DoOnce == 0) if ((JonasRef.GetActorValue Health / JonasRef.GetBaseActorValue Health) < 0.25) Player.StopCombatAlarmOnActor JonasRef.StopCombat JonasRef.StartConversation Player set DoOnce to 1 endIf endif  End
Hopefully your real code for this quest has stricter conditions on this section or else it'll trigger if the guard is hurt before he's supposed to be.
User avatar
Gisela Amaya
 
Posts: 3424
Joined: Tue Oct 23, 2007 4:29 pm

Post » Tue Sep 22, 2015 12:04 pm

Dissentrix said he tried GetAV Health already. He wants combat to stop once the guard's health reaches 20, not a percentage.

Shroob is correct about getCurrentHealth - that's for your weapon not a character. Have a look at the http://cs.elderscrolls.com/index.php?title=Main_Page and the OBSE Docs. For the OBSE Docs, the version in your Oblivion directory is the latest.

User avatar
ShOrty
 
Posts: 3392
Joined: Sun Jul 02, 2006 8:15 pm

Post » Tue Sep 22, 2015 8:14 am

Thanks, you two. I tried Shroob's method. He does stop fighting, but then just stands there and doesn't initiate conversation. And you can't talk to him, because he still seems to be in combat, despite not attacking. Is it a problem with the StartConversation command ? I've read if it isn't called more than once, it doesn't register.

User avatar
Ladymorphine
 
Posts: 3441
Joined: Wed Nov 08, 2006 2:22 pm

Post » Tue Sep 22, 2015 10:53 am

The game implements StartConversation by creating an AI package that only runs once. If the character doesn't start the conversation soon enough, then the package has completed its run and it needs to be run again, so yes, it's usually best to have a condition and keep running startConversation until the NPC does indeed start the conversation. That's as easy as having the startConversation dependent on a variable and setting that variable in the Info result script.
User avatar
Kitana Lucas
 
Posts: 3421
Joined: Sat Aug 12, 2006 1:24 pm

Post » Tue Sep 22, 2015 4:51 pm

It does register even if called only once, but it can be interrupted. Have you considered putting him and the player in a common faction marked "special combat"? Otherwise any other guards might try to help him.
User avatar
roxanna matoorah
 
Posts: 3368
Joined: Fri Oct 13, 2006 6:01 am


Return to IV - Oblivion