How to make a custom spell

Post » Sun Aug 08, 2010 11:56 am

Hello!
I m trying to make a custom spell, that will be added to player's spellbook abd when he casts it on an NPC, that will turn NPC's stats on in a texbox.
I have made the script atm using GetContainer function which gives me results when i enter NPC's invtentory.
Example:

ScriptName REPORT

ref ReportTarget
String_var NPCName
Short NPCBaseHealth

Begin GameMode
set ReportTarget to getcontainer

Set NPCName to ReportTarget.GetName

Set NPCHealth to ReportTarget.GetActorValue Health

End

but i really want to change it and be activated when player cast a spell on the chanracter.
I searched a lot but cant find the correct expression to replace the set ReportTarget to getcontainer.
Can anyone help?
User avatar
sara OMAR
 
Posts: 3451
Joined: Wed Jul 05, 2006 11:18 pm

Post » Sun Aug 08, 2010 1:42 pm

Using Player.GetCrosshairRef would work.
User avatar
Jah Allen
 
Posts: 3444
Joined: Wed Jan 24, 2007 2:09 am

Post » Sun Aug 08, 2010 10:07 pm

GetSelf worked!
User avatar
leigh stewart
 
Posts: 3415
Joined: Mon Oct 23, 2006 8:59 am

Post » Sun Aug 08, 2010 11:41 am

I m trying to make a the spell appear textboxes with choices but is doesnt work properly.

I used the following example script i found on net, on casting a spell
When i cast the spell, i get the choices, but when i select one of them i get nothing back.
If i change the ScriptEffectFinish to OnActivate and run the same code from a chest it works fine!
Really i cant find a solution.

ScriptName RiddleChestScript

Short controlvar
Short button

Begin ScriptEffectFinish
If ( controlvar == 0 )
MessageBox "Voiceless it cries, wingless flutters, toothless bites, mouthles mutters. What is it?", "Bat", "Old woman", "Wind", "Wraith"
Set controlvar to 1
ElseIf ( controlvar > 1 )
Activate
EndIf
End

Begin GameMode
If ( controlvar == 1 )
Set button to GetButtonPressed
If ( button == -1 )
Return
ElseIf ( button == 2)
MessageBox "Your answer was correct."
Activate
Set controlvar to 2
Else
MessageBox "Your answer was wrong."
Set controlvar to -1
EndIf
EndIf
End
User avatar
adame
 
Posts: 3454
Joined: Wed Aug 29, 2007 2:57 am


Return to IV - Oblivion