Eluwil Posted July 19, 2022 Share Posted July 19, 2022 I'm trying to make a quest where you have to heal an injured miner, but I cannot get the ModCurrentHealth function to work, I encountered it in Morrowind Scripting for Dummies. I want to lower the npc's health from 100 down to 15, without lower it's max health but i don't know how to do this. I have also tried using the CurrentHealthReatio function but I couldn't get that to work either.Does anybody know how I can make an NPC with lowered health, so that it's injured? Here is the script down below, I keep getting an expression error even though the MWEdit compiler says it has no errors. Maybe I'll have to reload an older version of the mod before I made this script and start over? begin ABE_LalaivaScriptShort DoOnceFloat CurrentHealthRatioIf (OnDeath == 1) If (DoOnce < 2) journal "ABE_HDHSEM" 40 set DoOnce to 2 EndifEndifIf (GetJournalIndex "ABE_HDHSEM" == 10) If (DoOnce == 0) ModCurrentHealth, 15 set DoOnce to 1 Elseif (DoOnce == 1) return EndifEndifif (DoOnce == 2) returnEndifEnd ABE_LalaivaScript Link to comment Share on other sites More sharing options...
FIMzzZzz Posted July 19, 2022 Share Posted July 19, 2022 (edited) from sfd (so doing ModCurrentHealth, 10000 to an Actor with 70 Health and a current health of 35 wouldset Health to 70 means your script would heal the npc for 15 if below 100hp this worked for me begin zscript short DoOnce if ( menumode == 1 ) return endif if ( DoOnce == 2 ) return endif if ( OnDeath > 0 ) if ( DoOnce == 1 ) journal "zjournal" 20 set DoOnce to 2 endif endif if ( doOnce == 0 ) if ( GetJournalIndex "zjournal" == 10 ) modcurrenthealth -200 set DoOnce to 1 endif endif end Edited July 19, 2022 by FIMzzZzz Link to comment Share on other sites More sharing options...
Eluwil Posted July 19, 2022 Author Share Posted July 19, 2022 (edited) I'm still getting an expression error in the right eval. I have copied your script and changed it to my journal, etc but it's still not working. I made a new script and called it ABE_LScript to see if the script was bugged but that doesn't make a difference. Maybe it's the NPC itself? Once again MWEdit compiler says there are 0 errors for the script below. I really don't understand why it won't work. begin ABE_LalaivaScriptshort DoOnceif ( menumode == 1 ) returnendifif ( DoOnce == 2 ) returnendifif ( OnDeath > 0 ) if ( DoOnce == 1 ) journal "ABE_HDHSEM" 40 set DoOnce to 2 endifendifif ( doOnce == 0 ) if ( GetJournalIndex "ABE_HDHSEM" == 10 ) modcurrenthealth -85 set DoOnce to 1 endifendifend I also used the Error Check Results button (didn't save afterwards) and that says: Script Error Script Dialogue CompileAndRunDialogue topic ABE_HDHSEM was not found on line 4Compiled script not saved! but ABE_HDHSEM is a journal ID and not a dialogue topic, so what's happened here? Edited July 19, 2022 by Eluwil Link to comment Share on other sites More sharing options...
FIMzzZzz Posted July 19, 2022 Share Posted July 19, 2022 where do you get this error? TESCS, MWedit or ingame? i use TESCS, put the script on an NPC and a creature and it changed health on both. but my first test journal was called "a1" this gave me an error ingame. btw if it's possible to fail this quest by having the NPC die or succeeding by healing it, you might want to change this part to your original. if ( OnDeath > 0 ) if ( DoOnce == 1 ) journal "zjournal" 20 set DoOnce to 2 endif endif to if ( OnDeath > 0 ) if ( DoOnce < 2 ) journal "zjournal" 20 set DoOnce to 2 endif endif Link to comment Share on other sites More sharing options...
Eluwil Posted July 19, 2022 Author Share Posted July 19, 2022 (edited) I get the error in-game. Once i walk out of the census and excise office, I coc to shulk egg mine, mining camp. where the npc is located, if that works without an expression error I'll play through the quest and see if it changes her health. It is indeed possible to fail or succeed by healing the npc or killing her. I edited my last comment, not sure if you read it: I also used the Error Check Results button (didn't save afterwards) and that says: Script Error Script Dialogue CompileAndRunDialogue topic ABE_HDHSEM was not found on line 4Compiled script not saved! but ABE_HDHSEM is a journal ID and not a dialogue topic, so what's happened here? Edited July 19, 2022 by Eluwil Link to comment Share on other sites More sharing options...
FIMzzZzz Posted July 19, 2022 Share Posted July 19, 2022 looks like something i had with the journal "a1" that didn't work, made an other "zjournal" that did work... no idea why oO Link to comment Share on other sites More sharing options...
Oblivionaddicted Posted July 19, 2022 Share Posted July 19, 2022 (edited) Why don't you add the NPC a drain health ability and remove it through a script? Edited July 27, 2022 by Oblivionaddicted Link to comment Share on other sites More sharing options...
Eluwil Posted July 24, 2022 Author Share Posted July 24, 2022 (edited) Looks like I had to declare the short OnDeath in order for it to work, such a silly mistake, I didn't see it declared in morrowind scripting for dummies so that's why I left it out. Thanks for your help, now it does exactly what I want it to! Edited July 24, 2022 by Eluwil Link to comment Share on other sites More sharing options...
Recommended Posts