Jump to content

Can companions heal you?


jamochawoke

Recommended Posts

Ok I just figured something out.

 

An NPC cannot cast a spell that is higher than their level. So I went in and made the spells I wanted him to cast the appropriate level for his skill in Restoration and voila! It's working now.

 

The combat is still spotty. I'm going to try and clean that up and hopefully get something better working. Sometimes he'll cast the spell, other times he'll run in to a bunch of enemies by himself to die.

Link to comment
Share on other sites

lpgmichael deserves a kudo on this one (post #9 this thread ... sorry lpg I've already given you one in the past):

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/...led_Spell_Notes

 

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

 

@Mshai ... and another adventurer bachelor bites the dust.

Link to comment
Share on other sites

No worries, I kudosed him :P

 

I still need to figure out how to get him to cast in combat.

 

I tried:

 

StopCombat

 

Which does make him stop, for a second... not long enough to cast. Then I thought that maybe it can use a timer like:

 

StopCombat 5

 

or even:

 

StopCombat 15

 

But does the same thing :/.

 

I then tried to give him a travel package to who he was healing but that didn't seem to work either. I might have implemented it wrong.

 

I'm really open to ideas at this point!

Edited by jamochawoke
Link to comment
Share on other sites

This script seems to work but is still pretty spotty. He seems to cut his travel package in half most of the time and not continue until he's in range of the player, or he'll get to the player and will get to the point where the debug message comes up that he's trying to heal... and then he'll go right back in to combat. Although he will occasionally heal. I ended up setting the area of the heal to be really rather large because he tends to hit things like monsters. I might just change the heal to be a touch spell but I like the casting animations of the target (and the fact that he's not riding your ass all the time).

 

I'm thinking of just forcing him to be out of combat with some AI packages and sit back and heal the whole time... because this is so frustrating! Lol! (ps I don't even know if that will work :P)

 

Here's my current evolution of the script:

 

scn VDSimon

short doOnce
float timer

begin gameMode

if doOnce == 0 
if Player.getdistance VDBrotherSimonREF <= 200
	VDBrotherSimonREF.StartConversation Player VDOracleQuestTopic4
	set doOnce to 1
endif
endif

if VDOracleDatabase.SimonFollower == 1 && getstage VDOracleQuest1 >= 60
set timer to timer+getsecondspassed
if timer >= 5
	if Player.GetAV Health > 61 && doOnce == 1
		removeScriptPackage VDHealPlayerPackage
		EvaluatePackage
	endif
	if Player.GetAV Health <= 60
		Message "Player health has fallen to 60."
		SCAOnActor
		addScriptPackage VDHealPlayerPackage
		EvaluatePackage
		if player.getdistance VDBrotherSimonREF <= 200 
			Message "NPC is casting Restoration spell on player."
			if VDBrotherSimonREF.GetAV Restoration < 25
				Cast VDRestoreHealthArea1Novice Player
			elseif VDBrotherSimonREF.GetAV Restoration < 50
				Cast VDRestoreHealthArea2Apprentice Player
			elseif VDBrotherSimonREF.GetAV Restoration < 75
				Cast VDRestoreHealthArea3Journeyman Player
			elseif VDBrotherSimonREF.GetAV Restoration < 100
				Cast VDRestoreHealthArea4Expert Player
			elseif VDBrotherSimonREF.GetAV Restoration == 100
				Cast VDRestoreHealthArea5Master Player
			endif
		endif
	endif
	if VDOracleDatabase.JessaFollower == 1 && VDJessaREF.GetAV Health <= 60
		if VDJessaREF.getdistance VDBrotherSimonREF <= 200
			Message "Jessa health has fallen to 60."
			SCAOnActor
			Message "NPC is casting Restoration spell on Jessa."
			if VDBrotherSimonREF.GetAV Restoration < 25
				Cast VDRestoreHealthArea1Novice VDJessaREF
			elseif VDBrotherSimonREF.GetAV Restoration < 50
				Cast VDRestoreHealthArea2Apprentice VDJessaREF
			elseif VDBrotherSimonREF.GetAV Restoration < 75
				Cast VDRestoreHealthArea3Journeyman VDJessaREF
			elseif VDBrotherSimonREF.GetAV Restoration < 100
				Cast VDRestoreHealthArea4Expert VDJessaREF
			elseif VDBrotherSimonREF.GetAV Restoration == 100
				Cast VDRestoreHealthArea5Master VDJessaREF
			endif
		endif
	endif
	if VDOracleDatabase.InohenFollower == 1 && VDInohenREF.GetAV Health <= 60
		if VDInohenREF.getdistance VDBrotherSimonREF <= 200
			Message "Inohen health has fallen to 60."
			SCAOnActor
			Message "NPC is casting Restoration spell on Inohen."
			if VDBrotherSimonREF.GetAV Restoration < 25
				Cast VDRestoreHealthArea1Novice VDInohenREF
			elseif VDBrotherSimonREF.GetAV Restoration < 50
				Cast VDRestoreHealthArea2Apprentice VDInohenREF
			elseif VDBrotherSimonREF.GetAV Restoration < 75
				Cast VDRestoreHealthArea3Journeyman VDInohenREF
			elseif VDBrotherSimonREF.GetAV Restoration < 100
				Cast VDRestoreHealthArea4Expert VDInohenREF
			elseif VDBrotherSimonREF.GetAV Restoration == 100
				Cast VDRestoreHealthArea5Master VDInohenREF
			endif
		endif
	endif
set timer to 0
endif
endif

end

Edited by jamochawoke
Link to comment
Share on other sites

I just checked out Vilja's scripting to see if there was anything I could do better on my own.

 

It seems that in Vilja's case it's all fake. As in... what Vilja does to heal you is the script adds an item in your inventory that heals you and Vilja does a casting animation... then the item is removed.

 

I tried messing around with the script package and did every option I could think of. However, adding/removing script packages like that really messes with the NPC as he'll sit there and check his packages over and over instead of healing you. In my case Brother SImon will run around you in circles trying to travel to you (or accompany, or whatever AI package I've chosen/messed with for this test run) and then he will watch as you get absolutely pounded. Then the debug message for casting the heal might go off every now and then and occasionally during one of those he'll heal, and it's really rare, then go back in to combat.

 

Is there any way I can just have him follow the player without going in to combat at all? I tried ToggleCombatAI but that's a console-only command and the script wouldn't accept it as code.

Link to comment
Share on other sites

You can try putting this script on the NPC:

 

 

scn examplescript

short healing
float timer

Begin GameMode

if (GetFactionRank SomeFaction <= 0)		;not following or healing
	Return
endif

if (GetFactionRank SomeFaction == 1)		;following
	if (IsInCombat) || (Player.IsInCombat)
		SetFactionRank SomeFaction 2
		SCAOnActor
		EVP
	endif
endif

if (GetFactionRank SomeFaction == 2)		;healing
	if (IsInCombat)
		SCAOnActor
	endif
	if (Player.IsInCombat == 0)
		SetFactionRank SomeFaction 1
		EVP
	endif
	if (healing)
		set timer to timer + GetSecondsPassed
		if (timer >= 5)
			set timer to 0
			set healing to 0
		endif
	elseif (Player.GetAV Health < (Player.GetBaseAV Health) / 3)
		set healing to 1
		;Cast appropriate level healing spell on Player
	endif
endif

End

 

 

The NPC should have at least two packages. One should be a follow package on the player when the NPC is rank 1 in some faction. The other should be a wander package around the player with a low radius, and with defensive combat checked, with the condition that the NPC is rank 2 in some faction.

Link to comment
Share on other sites

Hey fg thanks!

 

Before you posted that I had a very complicated system that mostly worked involving CastMagic AI packages (yes they actually DO work despite what everyone says!) and swapping them in and out. However, it caused some issues and occasionally the NPC would freeze up not knowing what to do.

 

This is a much more elegant solution. I modified it to match all the variables and stuff I had already put on the NPC and the quest he's involved in and it worked out pretty well! The only problem is that now the NPC won't heal out of combat and I'm not sure how to get that working within this script frame. I tried making an if statement that checked if both the NPC and player were out of combat and to cast the spells if that condition was met and I placed it after your script setup but no dice.

 

But hey at least he's healing me now when I'm getting my butt handed to me by a giant golem ^_^;

Link to comment
Share on other sites

Hmmm did some further playtesting and it seems this is having the same problems using the AI CastMagic Packages was having the more I play. Odd.

 

I almost want to use Vilja's system but it's so absurdly overpowered. Basically what Vilja does is the moment you hit a certain percent of health she does a fake spell on herself (just for the castself animation) and then a script calls a container to empty its items into your inventory. The container only holds one item, and that's a ring with an onAdd script that heals your player instantly and then removes itself.

 

It's the reason people keep saying they never really die when they have Vilja healing. The only occasions I can see it happening is if Vilja gets stuck talking or something and doesn't initiate the part of the script she's supposed to or if you're fighting a ton of enemies with high damage at once that their DPS overcomes the healing factor.

 

Also you don't get the cool cast on target animations.

Edited by jamochawoke
Link to comment
Share on other sites

  • Recently Browsing   0 members

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