Jump to content

Recommended Posts

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_LalaivaScript

Short DoOnce
Float CurrentHealthRatio

If (OnDeath == 1)
If (DoOnce < 2)
journal "ABE_HDHSEM" 40
set DoOnce to 2
Endif
Endif

If (GetJournalIndex "ABE_HDHSEM" == 10)
If (DoOnce == 0)
ModCurrentHealth, 15
set DoOnce to 1
Elseif (DoOnce == 1)
return
Endif
Endif

if (DoOnce == 2)
return
Endif

End ABE_LalaivaScript

 

Link to comment
Share on other sites

from sfd

 

 

(so doing ModCurrentHealth, 10000 to an Actor with 70 Health and a current health of 35 would
set 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 by FIMzzZzz
Link to comment
Share on other sites

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_LalaivaScript

short DoOnce

if ( menumode == 1 )
return
endif

if ( DoOnce == 2 )
return
endif

if ( OnDeath > 0 )
if ( DoOnce == 1 )
journal "ABE_HDHSEM" 40
set DoOnce to 2
endif
endif

if ( doOnce == 0 )
if ( GetJournalIndex "ABE_HDHSEM" == 10 )
modcurrenthealth -85
set DoOnce to 1
endif
endif

end

 

 

I also used the Error Check Results button (didn't save afterwards) and that says:

 

Script Error

 

Script Dialogue CompileAndRun

Dialogue topic ABE_HDHSEM was not found on line 4

Compiled script not saved!

 

but ABE_HDHSEM is a journal ID and not a dialogue topic, so what's happened here?

Edited by Eluwil
Link to comment
Share on other sites

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

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 CompileAndRun

Dialogue topic ABE_HDHSEM was not found on line 4

Compiled script not saved!

 

but ABE_HDHSEM is a journal ID and not a dialogue topic, so what's happened here?

Edited by Eluwil
Link to comment
Share on other sites

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 by Eluwil
Link to comment
Share on other sites

  • Recently Browsing   0 members

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