Jump to content

Can companions heal you?


jamochawoke

Recommended Posts

I've given some NPCs that follow you through certain dangerous areas some heal on target spells. They never use them.

 

Is there a setting in combat AI or something that will make an NPC heal you during battle?

 

I never found one. I ended up writing a script that periodically checks allies HP, and then tells the NPC to go cast the appropriate spell on the appropriate target if the HP falls below a certain level. Worked well.

Link to comment
Share on other sites

Mind letting me in on the script?

 

I ended up trying to make one myself and the NPC never casts the spell.

 

The script goes like this:

 

; NPC casts area healing spell on touch when player Health low
if Player.GetActorValue Health <= 40 && player.getdistance VDBrotherSimonREF <= 200
VDBrotherSimonREF.cast RestoreHealthArea4Expert player
endif

; NPC casts area healing spell on touch when NPC health low
if VDBrotherSimonREF.GetActorValue Health <= 40 && player.getdistance VDBrotherSimonREF <= 200
VDBrotherSimonREF.cast VDRestoreHealthArea4Expert player
endif

 

 

Took this guy up against some trolls to test him out. The trolls beat him down pretty fast. Then they killed him.

 

What I want him to do is cast this huge Restore Health on touch with a large area so it heals me, him, and any other followers.

 

However, even when his or my health gets below the value he never casts the spell.

Link to comment
Share on other sites

Hy friends,

 

CM partners woun't heal you. I son't know any, but some of the special Partners will do. I know that Saerileth does, Julienne from first alchemist companion does, summon pixie does and the companions in Companion Share and Recruit do.

 

Don't know how or why, perhaps will help

 

Have fun anyway

 

 

Harvald :thumbsup:

Edited by Harvald
Link to comment
Share on other sites

I'm not looking to download a mod, just need some scripting help for a one-time event where I need an NPC that follows you for a short time during a quest to heal you as you fight some brutal monsters I made.

 

I did look at some of the healer companion mods already and they tend to use a really convoluted system wrapped up in the entirety of the companion mod. I did notice the main parts are:

 

the health check of the player reference using getactorvalue health

 

and the cast part where you cast a designated spell on the reference you want.

 

There has to be something I am doing wrong with my script.

Link to comment
Share on other sites

Maybe you need another variable to control the casting. I remember quite a while ago I tried making a script for you but the NPC seemed to freeze up because the script kept telling it to cast a spell. Since casting a spell isn't instant, the NPC hadn't cast the spell yet before the script ran again, and restarted the casting process.

 

So you might want to do this:

 

 

if (healing)
if (VDBrotherSimonREF.IsCasting == 0)
	set healing to 0
endif
else
if Player.GetAV Health <= 40
	if Player.GetDistance VDBrotherSimonREF <= 200
		VDBrotherSimonREF.cast RestoreHealthArea4Expert player
		set healing to 1
	endif
endif

if VDBrotherSimonREF.GetAV Health <= 40
	Player.GetDistance VDBrotherSimonREF <= 200
		VDBrotherSimonREF.cast VDRestoreHealthArea4Expert player
		set healing to 1
	endif
endif
endif

 

 

Or you might want to try using a timer instead:

 

 

set timer to timer + GetSecondsPassed

if (timer >= 5)
set timer to 0
if Player.GetAV Health <= 40
	if Player.GetDistance VDBrotherSimonREF <= 200
		VDBrotherSimonREF.cast RestoreHealthArea4Expert player
	endif
endif

if VDBrotherSimonREF.GetAV Health <= 40
	Player.GetDistance VDBrotherSimonREF <= 200
		VDBrotherSimonREF.cast VDRestoreHealthArea4Expert player
	endif
endif
endif

 

Edited by fg109
Link to comment
Share on other sites

Thanks fg! I'll try them out later tonight.

 

Are you sure the NPC has enough magicka, remember spells dont cost what they say they cost in the CS, they cost a formula based on that and the actors abilities and luck etc...

 

http://www.uesp.net/wiki/Oblivion:Leveled_Spell_Notes

 

Also they will need to have the required level in the spell ability.

 

Your script looks OK to me, mine isnt really suitable for an example to paste, as its about 200 lines long, and does more than just healing {:-)

 

Try setting the actor to have 100K magicka or something, and 100 ability in restoration (I assume its restoration based), and see what happens.

Link to comment
Share on other sites

If you have a quest and the companion will only heal you at certain predetermined points in the quest, then you should be able to have some really solid reliable triggers that gets the NPC to cast the spell. The problem most people have is that triggers in Begin GameMode scripts are often slow or unreliable and do not work as logic would dictate that they should.

 

So you could have a trigger that would trip when the SetStage command was executed, and that should be a really fail-safe trustworthy trigger unless your healer was in combat at the time, or you ran out of range before the healing was supposed to take place.

Edited by David Brasher
Link to comment
Share on other sites

  • Recently Browsing   0 members

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