Jump to content

[LE] How to make a boss flee?


Wolfstorm

Recommended Posts

I want to create a boss fight where the boss flee when his health reaches 10%. This boss will be set as "essential", that is, he cant be killed, but he will flee.

I already know how to create npcs, and I know there is a space for papyrus scripts in the tab, but dont know what to write there.

Link to comment
Share on other sites

I tried this in a test boss:

 

Scriptname StopCombatTest extends ObjectReference

begin
if ___EncBandit02Boss1HImperialM_TEST.GetHealthPercentage <= 10
stopcombat ___EncBandit02Boss1HImperialM_TEST
endif
end

 

But it says "compilation failed".

Link to comment
Share on other sites

I'm no whizz with scripts, for a start, but you are asking to get the actor value of 'EncBandit02Boss1HImperialM_TEST'. Is this a duplicated NPC that is unique? If it's not unique or assigned as a property to that instance of the bandit, then the game can't resolve that code. it would be like asking if the health of any bandit currently loaded was '<+10'.

 

Next, it can't work because of the way you use the function 'StopCombat'.

 

It should be the other way around, so if the actor property (I assume you declared an actor property in the script) is 'Actor Property MyActor Auto', the line should be : MyActor.StopCombat()

 

I'm also unsure as to what actor property you've set, if any.

 

Then you have an 'If' statement, correctly coupled with an 'EndIf', but what is this 'end', the last line of code? The compiler won't make any sense of that. Read through what the compiler tells you when it fails and try to rectify each part.

Link to comment
Share on other sites

Its a duplicate and set to unique. Since I'm still testing it, I just duplicated one of the bandit bosses.

The idea would be to have him stop combat, then flee and disappear.

I'm no programmer so I dont know where do I declare the actor. And the Bethesda documentation about these functions is obscure.

So I was looking for some line to make the npc stop combat and flee when the health reaches 10%.

I'm getting this error: "no viable alternative at input '\\r\\n'".

Edited by Wolfstorm
Link to comment
Share on other sites

I am not entirely sure how to make the actor flee (never try that), but your code should look something like this.

This is just an example:

Extends ACTOR



Actor Property MyActor Auto
{Link Ref the Actor}

Event OnEnterBleedout()
If ( MyActor.GetActorValue("Health") <= 0.10 )
MyActor.StopCombat()
EndIf
EndEvent


The script should be placed on the Actor.

Edited by maxarturo
Link to comment
Share on other sites

Don't take this the wrong way, Maxarturo,

 

but does the event 'OnEnterBleedout' not require the actor to be 'In Bleedout'?. If so, the 'If' statement is irrelevant.

 

I'm only saying this because 'Bleedout' is set in 2 ways: in the 'Class' tab, where 'Bleedout default' is set, or it is overridden in the actor's 'stats' tab.

 

Normally, in the 'Class' tab, actors have their 'Bleedout Default' set to 0.1 (10% max health). If that is overridden in the 'stats' tab of the actor, it could be higher or lower.

 

OP. What I am saying is this...

 

Use the script given by Maxarturo, it will work but needs no 'If' statement.

 

It will only work, as you intended, if the 'Boss' has its bleedout set to 0.1 and this is not overridden anywhere else.

 

Edit: As for getting him to flee, I can think of a couple of ways to do that...

 

1. the script above could give him a new package. The package would be a 'travel' package and make him run to a specified destination.

2. The script could alter his 'confidence' from 'foolhardy' to 'cowardly'. This may make it hard for the player to kill him, if he keeps running away! Try things between 'cowardly' and 'Brave'.

Link to comment
Share on other sites

cumbrianlad

This was just an example !.

I didn't pay much attention on what the script does other than how it should be written, the event was put there randomly, it was the first one that came to my mind.

The example focuses on the structure of the script.

Link to comment
Share on other sites

I've just had a thought about my comment that making him cowardly. It could be timed. If you add a 'Utility.wait(#seconds)' and then restore him to 'foolhardy'. Or you could 'registerForSingleupdategametime(game hours)', and then restore his confidence inside an event 'OnUpdategametime()'.

 

I think you may have another issue applying it when the actor enters bleedout, though. If he's on his knees, he can't flee and the player could kill him. You might want to make use of the bleedout override I mentioned on his 'stats' tab. Set it higher, say something like 0.5, so that he goes into bleedout at 50% health and the player can't kill him before he gets a chance to tun away! It'll take a bit of tinkering.

 

Edit: Maxarturo. I wasn't trying to be rude. I was just pointing out that the check on his health isn't needed because he'll already be below the health percentage set by one of the two mechanisms I mentioned. It looks like the OPs issue can be sorted using the event you suggested.

Link to comment
Share on other sites

 

I am not entirely sure how to make the actor flee (never try that), but your code should look something like this.
This is just an example:
Extends ACTOR

Actor Property MyActor Auto
{Link Ref the Actor}
 
Event OnEnterBleedout()
      If ( MyActor.GetActorValue("Health") <= 0.10 )
           MyActor.StopCombat()
   EndIf
EndEvent

The script should be placed on the Actor.

 

 

 

The way you put, it makes sense, but it didnt work. I've got this message:

 

Data\Source\Scripts\temp\StopCombatTest.psc(1,0): missing SCRIPTNAME at 'Actor'

Data\Source\Scripts\temp\StopCombatTest.psc(1,6): required (...)+ loop did not match anything at input 'Property'

Data\Source\Scripts\temp\StopCombatTest.psc(1,54): mismatched input '\\r\\n' expecting STATE

Data\Source\Scripts\temp\StopCombatTest.psc(0,0): filename does not match script name: actor

No output generated for StopCombatTest, compilation failed.

 

Removing the "if" didnt changed the outcome.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...