Jump to content

NPC Cast Spell Script Error "Invalid Reference"


sgtchubs

Recommended Posts

Hey all! I'm trying to port Kim from Nehrim as a follower into Oblivion and I've gotten most things working but her script to heal the player isn't working.

 

 

scn OKimFScript

short HelpPlayer
short PlayerBaseHealth
float HelpTimer
Begin GameMode
if ( OKimFRef.getCurrentAIPackage != 6 )
;KIM HELP THE PLAYER IF LOW HEALTH
if ( GetDistance Player <= 700 ) && ( GetStage mq04 >= 70 ) && ( KimFermaleRef.GetFriendHit Player < 4 ) && ( GetCombatTarget != player )
set PlayerBaseHealth to player.getbaseactorvalue health
if ( Player.GetLevel <= 15 ) && ( Player.GetActorValue Health < 65 ) && ( HelpPlayer == 0 ) && ( Player.GetActorValue Health < 0.5 * PlayerBaseHealth )
OKimFRef.Cast "aaaOKimPlayerHeal01" Player
Set HelpPlayer to 1
elseif ( Player.GetLevel > 15 ) && ( Player.GetActorValue Health < 155 ) && ( HelpPlayer == 0 ) && ( Player.GetActorValue Health < 0.5 * PlayerBaseHealth )
OKimFRef.Cast "aaaOKimPlayerHeal02" Player
Set HelpPlayer to 1
elseif ( Player.GetLevel > 20 ) && ( Player.GetActorValue Health < 200 ) && ( HelpPlayer == 0 ) && ( Player.GetActorValue Health < 0.5 * PlayerBaseHealth )
OKimFRef.Cast "aaaOKimPlayerHeal02" Player
Set HelpPlayer to 1
endif
endif
if ( GetDistance Player > 700 ) && ( HelpPlayer == 1 )
Set HelpPlayer to 0
EVP
;KimFermaleRef.MoveTo Player 32, 0, 0
endif
if ( HelpPlayer == 1 )
Set HelpTimer to HelpTimer + GetSecondsPassed
if ( HelpTimer >= 2 )
Set HelpTimer to 0
Set HelpPlayer to 0
endif
endif
endif
End
I'm getting an error at "OKimFRef.Cast "aaaOKimPlayerHeal01" Player" and I have no idea why. I've tried switching the ref with other characters and sometimes it would work, and sometimes I'd get the same error.

 

Script 'OKimFScript', line 17:

Syntax error. Invalid reference 'OKimRef' (only object refrerences and reference variables are allowed in this context)

 

1PtHqDL.png

 

Thanks!

Link to comment
Share on other sites

The spell does exist. The problem seems to be coming from the NPC ref. Like for example when I put

 

Baurusref.Cast "aaaOKimPlayerHeal01" Player

there is no error, but there is for OKimF. There is even errors if I put in other Vanilla NPCs

 

LyndaCarterTestref.Cast "aaaOKimPlayerHeal01" Player

spits out the same error. I'm thinking I'm missing something with the OKimF npc, but I don't know what.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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