Hi there,
I've wrote a script which should in theory allow the player to talk to a healer npc, ask for healing and be fully healed.
Here is what should happen:
Player talks to the healer.
If player asks for healing, the global 'NON_ESHealStat' in the script below (I've marked it out) is set to 1, the script is started and dialogue is exited via 'goodbye'.
Here's the script:
Float Timer
If ( NON_ESHealStat == 1 ) ; this is a global which is set to 1 if the player requests healing through dialogue
FadeOut, 1.0
DisablePlayerControls
Set Timer to ( Timer + GetSecondsPassed )
If ( Timer > 3 )
MessageBox "Jocelyn attempts to heal you with a mixture of alchemical medicine and restoration spells..."
"NON_ESGuardStatHealer"->Cast, "NON_ESHealing2", "Player" ; this gets a nearby NPC to cast a spell to cure all diseases on the player
Player->AddSpell "NON_ESHealing1" ; this is an ability which rapidly restores player's health and fatigue
Player->AddSpell "NON_ESHealing2" ; same as above but for attributes
Set Timer to 0
Set NON_ESHealStat to 2
Endif
ElseIf ( NON_ESHealStat == 2 )
Set Timer to ( Timer + GetSecondsPassed )
If ( Timer > 3 )
Player->RemoveSpell "NON_ESHealing1"
Player->RemoveSpell "NON_ESHealing2"
Set GameHour to ( GameHour + 1.5 )
EnablePlayerControls
MessageBox "Jocelyn: I've done all I can for you"
FadeIn, 1.5
Set Timer to 0
Set NON_ESHealStat to 3
Endif
ElseIf ( NON_ESHealStat == 3 )
Set NON_ESHealStat to 0
StopScript NON_ESFullHealing
Endif
End
It works perfectly except for one thing: for some reason, right after the screen fades in at the end of the script, the screen fades out again immediately after and remains permanently black. I know the script isn't repeating itself because the messageboxes aren't being spammed.
Just in case I haven't been clear, the problem is: script fades screen out, does its stuff, fades the screen back in and finishes, but for some reason the screen fades back out immediately after fading back in and stays that way.
I've rewrote it a few times and swapped the 'FadeIn/Outs' to 'FadeTo' commands but I can't seem to get it to work. I'd really appreciate some help!