jamochawoke Posted October 28, 2011 Author Share Posted October 28, 2011 (edited) Just tried both scripts. While they should technically work... in the fight he still never casts the spells. I just don't get it :/. EDIT:: Here's my whole script for the NPC the last I updated it: 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 set timer to timer + GetSecondsPassed if timer >= 5 set timer to 0 if Player.GetAV Health <= 40 if Player.GetDistance VDBrotherSimonREF <= 200 cast VDRestoreHealthArea4Expert Player endif endif if VDBrotherSimonREF.GetAV Health <= 40 if Player.GetDistance VDBrotherSimonREF <= 200 cast VDRestoreHealthArea4Expert Player endif endif endif endif end Edited October 28, 2011 by jamochawoke Link to comment Share on other sites More sharing options...
jamochawoke Posted October 28, 2011 Author Share Posted October 28, 2011 I also tried this variation in case setting the timer to 0 happened too soon. Still nothing... 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 set timer to timer + GetSecondsPassed if timer >= 5 if Player.GetAV Health <= 50 || VDBrotherSimonREF.GetAV Health <= 50 if Player.GetDistance VDBrotherSimonREF <= 200 VDBrotherSimonREF.cast VDRestoreHealthArea4Expert Player set timer to 0 endif endif endif endif end Link to comment Share on other sites More sharing options...
fg109 Posted October 28, 2011 Share Posted October 28, 2011 OK... try putting in some debug messages. if VDOracleDatabase.SimonFollower == 1 set timer to timer + GetSecondsPassed if timer >= 5 PrintC "Timer has reached 5 seconds, resetting to 0." set timer to 0 if Player.GetAV Health <= 50 || VDBrotherSimonREF.GetAV Health <= 50 PrintC "Player or NPC health has fallen to 50." if Player.GetDistance VDBrotherSimonREF <= 200 PrintC "NPC is casting Restoration spell on player." VDBrotherSimonREF.cast VDRestoreHealthArea4Expert Player endif endif endif endif Link to comment Share on other sites More sharing options...
jamochawoke Posted October 28, 2011 Author Share Posted October 28, 2011 Ok I added the debug messages. Once Simon starts following the player the message comes up every 5 seconds that timer has reached 5 seconds resetting to 0. Then when his health got below 50 he just kind of stops and looks at me. The message goes off that his health is below 50 and then the message that he is casting the restoration spell. But he just looks at me every time instead. Does he have to be out of combat for this to work? As it is now he goes and charges the trolls next to me. As we're fighting the trolls kind of auto-lock on him because monsters tend to hate companions :P. His health gets below 50 and he stops fighting and stares at me until the trolls knock him out... all the while the messages are going off. Link to comment Share on other sites More sharing options...
fg109 Posted October 28, 2011 Share Posted October 28, 2011 (edited) I would guess that he's too far to cast the spell at you. The cast function only works properly for NPCs when they are within touching distance of the target. Try having the NPC cast the spell on itself. Edited October 28, 2011 by fg109 Link to comment Share on other sites More sharing options...
jamochawoke Posted October 28, 2011 Author Share Posted October 28, 2011 (edited) I tried standing right next to him, literally pushing him around by walking into him to get him to cast the spell on me and still no dice. I had the NPC cast a self only spell and that worked... he'll cast spells on himself. I really don't understand it. You can make things like furniture and other stuff like that cast a targetted spell on you. Take the ayleid ruin pillar during the Fingers of the Mountain quest. So at first I thought the cast function will only work on self spells (which will only affect the caster) and targetted damage spells. Then I've seen it done with healing spells on the Healers mod (where the chapel healers will heal you if your health is under a certain percent) and my script is nearly identical to theirs (theirs just had a lot of conditions and extra scripts to check the % of health the player was missing). Although they may have been using some kind of invisible activator or something, I didn't get too far into the bowels of that mod, just looked at their base script for the casting of the spell. Edited October 28, 2011 by jamochawoke Link to comment Share on other sites More sharing options...
David Brasher Posted October 28, 2011 Share Posted October 28, 2011 From my experience, I would say that you probably cannot have a companion heal you while you are in combat. I would expect that there would have to be no battle going on before the NPC could heal you. I say this from personal experience in working on Raiders of Cyrodiil Update. I tried to make a couple of recruitable companions do what you are trying to get them to do and had very little success. If you are interested, you could play-test that portion of the mod and examine the scripting behind it to see how far I got and how far short I fell. It would probably be easier to change your design parameters to have your companions heal you at some other good time, other than when battle is raging all around them. NPCs get seriously distracted when battle is going on. I have seen quest mods get broken because an NPC was supposed to talk and give you a message that would advance the quest, but a battle was going on. So no message, and the quest was ruined. It is the same way with healing or other scripted actions. During battle, it is hard to make an NPC do anything but fight or flee. Link to comment Share on other sites More sharing options...
Striker879 Posted October 28, 2011 Share Posted October 28, 2011 Have a look at CDCooley's healing scripts in Companion Vilja. I've used CM Partners in the past, and some of them will heal you or the group when you ask them. With Vilja you make a selection in her options on when to heal you and she does it. Link to comment Share on other sites More sharing options...
lgpmichael Posted October 28, 2011 Share Posted October 28, 2011 OK what I did to make this work, for an npc to heal other NPC's in his group: First when I detected the need to heal, I put the NPC into a new package, telling him to approach the healing target. The package is a travel package, and is set to must complete, and defensive combat. Then I run stopcombat on it as soon as the evp is done. In effect this makes the NPC stop whatever fighting he is doing, and walk to the heal target, ignoring others that he may want to attack, which makes him forget the spell. It doenst stop him getting distracted if someone else attacks him, unfortunately. He then happily walks over to the target and casts the spell, even in the harshest of combat. I did it as a script on the npc instead of a quest script. This runs much more frequently. Link to comment Share on other sites More sharing options...
jamochawoke Posted October 28, 2011 Author Share Posted October 28, 2011 What spell did you use? I eventually tried just sitting out of combat with less than 50 health and the NPC still refused to cast targetted healing spells. All the debug messages went off and he'd cast a targetted damage spell or a self healing spell on himself but no targetted healing spells in that situation either. I'll try your way of doing things lgpmichael and tell you if I get any different result. Who knew getting an NPC to heal would be such a pain? lol Link to comment Share on other sites More sharing options...
Recommended Posts