Here's the scenario,
You want to join the wizards guild. One requirement is a demonstration of your skill, so you must cast a specified spell at a target statue.
I used my meager scripting abilities, and a SpellCastAtItem template, to come up with this;
// i_b51_statue_ci
/*
Template for Casting Spell on item script.
This script runs when a spell is cast on an item.
This script will be called automatically (by defualt) whether it exists or not. If if does not exist, nothing happens.
Note: this script runs on the character who cast the spell on the item.
-ChazM
*/
// bealzebub 3/23/2012
/* spells.2da constants
875 Disintegrate lvl 6
440 Firebrand lvl 5
*/
#include "x2_inc_switches"
void main()
{
object oPC = OBJECT_SELF; // The player who cast the spell
object oItem = GetSpellTargetObject(); // The item targeted by the spell
int iSpell = GetSpellId(); // Spell Constant
object oSpeaker = GetNearestObjectByTag("b51_examiner", oPC);
FloatingTextStringOnCreature("DEBUG", oPC);
if (iSpell == 875)
{
int DoOnce = GetLocalInt(oItem, "DoOnce");
if (DoOnce==TRUE) return;
SetLocalInt(oItem,"DoOnce", TRUE);
SetLocalInt(oSpeaker,"SpellCast", 875);
DelayCommand(3.0, AssignCommand(oSpeaker, ActionStartConversation(oPC, "b51_examiner", FALSE, FALSE)));
SetExecutedScriptReturnValue(X2_EXECUTE_SCRIPT_END);
return;
}
if (iSpell == 440)
{
int DoOnce = GetLocalInt(oItem, "DoOnce");
if (DoOnce==TRUE) return;
SetLocalInt(oItem,"DoOnce", TRUE);
SetLocalInt(oSpeaker,"SpellCast", 440);
DelayCommand(3.0, AssignCommand(oSpeaker, ActionStartConversation(oPC, "b51_examiner", FALSE, FALSE)));
SetExecutedScriptReturnValue(X2_EXECUTE_SCRIPT_END);
return;
}
}
seemed simple enough, cast spell = set int., start conversation.
The problem is that nothing happens. Can anyone spot my problem?
Tag based- OnSpellCastAt
Débuté par
bealzebub
, mars 25 2012 12:46





Retour en haut






