how to force npc
cast a spell in dialogue.
examples of OK cutscenes.
Garius kill Lorne or Qara make fireball.
Many thanks!
Thanks in advance for your time and
any advice.
I understand scripting very badly
I can only make change scripts a little
spell script
void ActionCastSpellAtObject(int n808, object oLorne, int nMetaMagic=METAMAGIC_ANY, int bCheat=TRUE, int nDomainLevel=3, int nProjectilePathType=PROJECTILE_PATH_TYPE_DEFAULT, int bInstantSpell=TRUE);
i know sheme how to create script (i only began read book
https://neverwintervault.org/project/nwn2/other/scripting-tutorial-beginners-nwn2 )
STEP ONE: What does your script do?
STEP TWO: Which approach should we take?
STEP THREE: Think about the variables we will be working with.
STEP FOUR: Declaring Variables
STEP FIVE: Add More Features
STEP SIX: Adding More Features
STEP SEVEN: LOOP
but
i dont know all scripting rules
so i tried do this
STEP ONE: What does your script do?
script must create animation cast spells and create vfx.
script must run when on conversation. when npc_garious say
keyphrase(something like :pizza time!)
(donāt know wherte find event hook
on user defined event script ?
STEP TWO: Which approach should we take?(donāt know)
STEP THREE: Think about the variables we will be working with.(donāt know)
STEP FOUR: Declaring Variables(Y=keyphrase)
STEP FIVE: Add More Features(donāt know)
STEP SIX: Adding More Features(donāt know)
STEP SEVEN: LOOP(how?)
judging because the function exists it should work
why is this script not working? (i put it in actions in dialog)
or maybe this function not working in cutscenes.(or becasuse i donāt have event hook ad other steps)
i hope spell script ok
but i think need make check tag speaker
need make this
Declaring Variables
need Variable Y
when Y true npc_garious said keyphrase;= true run script;
when Y false npc_garious donāt say keyphrase;=make DelayComand ;
maybe Y must be string variable but i donāt know how to check this in script language.
so what i get
i have
1 condition
need check Y
if Y true
run spell script
if Y false
return)
how to put this all together?
i try also use ga_cast_fake_spell_at_object but it not work donāt know why .
Many thanks!
example
// 20_cs_trialend
//
// Black Garius chides his minions for a job poorly done
// EPF 1/5/06
#include āginc_debugā
void MyPlayCustomAnimation(object oObj, string sAnim, int bLoop)
{
PlayCustomAnimation(oObj,sAnim,bLoop);
}
void main(int nScene)
{
object oPC = GetPCSpeaker();
object oBG = GetNearestObjectByTag("garius",oPC);
object oLorne = GetNearestObjectByTag("lorne",oPC);
object oTorio = GetNearestObjectByTag("torio",oPC);
object oSound;
effect eIgnition = EffectNWN2SpecialEffectFile("fx_ignition_red");
switch(nScene)
{
case 1:
break;
case 2: //garius kills Lorne
// AssignCutsceneActionToObject(oBG, ActionCastFakeSpellAtLocation(SPELL_FIREBALL,GetLocation(oLorne)));
// ActionCastSpellAtObject(SPELL_FINGER_OF_DEATH, oLorne,METAMAGIC_NONE,TRUE,9);
// AssignCommand(oBG, ClearAllActions(TRUE));
AssignCommand(oLorne, SetIsDestroyable(FALSE,FALSE,FALSE));
ActionPauseCutscene(9000);
AssignCutsceneActionToObject(oBG, ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectSavingThrowDecrease(SAVING_THROW_ALL,100), oLorne));
AssignCutsceneActionToObject(oBG, ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectSpellResistanceDecrease(100), oLorne));
//cast 1: lorne lifted off the ground
//AssignCutsceneActionToObject(oBG, ActionPlayAnimation(ANIMATION_LOOPING_CAST1, 1.f, 2.f));
PlayCustomAnimation(oBG, "gen_conjureloop",TRUE);
AssignCutsceneActionToObject(oBG, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectNWN2SpecialEffectFile("sp_necromancy_cast"),OBJECT_SELF));
DelayCommand(0.3, MyPlayCustomAnimation(oLorne,"mjr_conjureloop",TRUE));
//cast 2: lorne is ignited
oSound = GetNearestObjectByTag("20_sfx_lorne_scream",oLorne);
DelayCommand(0.8f, MyPlayCustomAnimation(oBG,"%",FALSE));
DelayCommand(1.f, MyPlayCustomAnimation(oBG,"sp_touch",FALSE));
DelayCommand(1.3f, AssignCutsceneActionToObject(oBG,ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eIgnition,oLorne,2.9f)));
DelayCommand(1.5f, SoundObjectPlay(oSound)); //Lorne screams
//cast 3: bg casts finger of death
DelayCommand(4.f, MyPlayCustomAnimation(oBG, "sp_lightning", FALSE));
DelayCommand(4.2f, AssignCutsceneActionToObject(oBG,ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectNWN2SpecialEffectFile("sp_finger_of_death"),oLorne)));
DelayCommand(4.4f, MyPlayCustomAnimation(oLorne,"%",FALSE));
DelayCommand(4.5f, MyPlayCustomAnimation(oLorne,"collapseB",FALSE));
DelayCommand(5.2f, AssignCommand(oLorne, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(GetCurrentHitPoints(oLorne) + 11), oLorne)));
// AssignCutsceneActionToObject(oBG, ActionCastSpellAtObject(SPELL_FINGER_OF_DEATH, oLorne,METAMAGIC_NONE,TRUE,9));
// AssignCutsceneActionToObject(oBG, ActionCastFakeSpellAtLocation(SPELL_FINGER_OF_DEATH,GetLocation(oLorne)));
AssignCutsceneActionToObject(oBG, ActionWait(9.f));
// PrettyDebug("BGās tag = " + GetTag(oBG));
// PrettyDebug(āCurrent garius action is " + IntToString(GetCurrentAction(oBG)));
// PrettyDebug(āGarius has " + IntToString(GetNumActions(oBG)) + " actions pending.ā);
// PrettyDebug(IntToString(GetNumCutsceneActionsPending()) + " cutscene actions.ā);
//just in case he resists
// DelayCommand(2.f, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_HIT_SPELL_NECROMANCY),oLorne));
break;
}
}
Many thanks!
Thanks in advance for your time and
any advice.