Hi everyone:
I am trying a simple spell…I copied one of Syrus Greycloak’s spells from his Grimoire. It does not work as it is…well at least in my module. So I took his spell
//:**************************************************************************
//:* GR_S0_OPENCLOSE.NSS
//:**************************************************************************
//:* Open/Close
//: Created By: Karl Nickels (Syrus Greycloak) Created On: April 8, 2008
//: 3.5 Player’s Handbook (p. 258)
//*:**************************************************************************
//:**************************************************************************
//:* Include the following files
//:**************************************************************************
//:* Game Libraries
//:*********************************************
//: Function Libraries
#include “GR_IN_SPELLS”
#include “GR_IN_SPELLHOOK”
//: #include “GR_IN_ENERGY”
//:**************************************************************************
//:* Main function
//:**************************************************************************
void main() {
//:**********************************************
//: Declare major variables
//:*********************************************
object oCaster = OBJECT_SELF;
struct SpellStruct spInfo = GRGetSpellStruct(GetSpellId(), oCaster);
//*:* int iDieType = 0;
//*:* int iNumDice = 0;
//*:* int iBonus = 0;
//*:* int iDamage = 0;
//*:* int iSecDamage = 0;
//*:* int iDurAmount = spInfo.iCasterLevel;
//*:* int iDurType = DUR_TYPE_ROUNDS;
//*:* spInfo = GRSetSpellDamageInfo(spInfo, iDieType, iNumDice, iBonus);
//*:* spInfo = GRSetSpellDurationInfo(spInfo, iDurAmount, iDurType);
//*:**********************************************
//*:* Set the info about the spell on the caster
//*:**********************************************
GRSetSpellInfo(spInfo, oCaster);
//*:**********************************************
//*:* Energy Spell Info
//*:**********************************************
//*:* int iEnergyType = GRGetEnergyDamageType(GRGetSpellEnergyDamageType(spInfo.iSpellID, oCaster));
//*:* int iSpellType = GRGetEnergySpellType(iEnergyType);
//*:* spInfo = GRReplaceEnergyType(spInfo, GRGetSpellEnergyDamageType(spInfo.iSpellID, oCaster), iSpellType);
//*:**********************************************
//*:* Spellcast Hook Code
//*:**********************************************
if(!GRSpellhookAbortSpell()) return;
spInfo = GRGetSpellInfoFromObject(spInfo.iSpellID, oCaster);
//*:**********************************************
//*:* Declare Spell Specific Variables & impose limiting
//*:**********************************************
//*:* float fDuration = GRGetSpellDuration(spInfo);
//*:* float fDelay = 0.0f;
//*:* float fRange = FeetToMeters(15.0);
//*:**********************************************
//*:* Resolve Metamagic, if possible
//*:**********************************************
//*:* if(GRGetMetamagicUsed(spInfo.iMetamagic, METAMAGIC_EXTEND)) fDuration *= 2;
//*:* if(GRGetMetamagicUsed(spInfo.iMetamagic, METAMAGIC_WIDEN)) fRange *= 2;
//*:* iDamage = GRGetSpellDamageAmount(spInfo, SPELL_SAVE_NONE, oCaster, SAVING_THROW_TYPE_NONE, fDelay);
/* if(GRGetSpellHasSecondaryDamage(spInfo)) {
iSecDamage = GRGetSpellSecondaryDamageAmount(iDamage, spInfo, SPELL_SAVE_NONE, oCaster, SAVING_THROW_TYPE_NONE, fDelay);
if(spInfo.iSecDmgAmountType==SECDMG_TYPE_HALF) {
iDamage = iSecDamage;
}
}*/
//*:**********************************************
//*:* Effects
//*:**********************************************
//*:* write effects here
//*:**********************************************
//*:* Apply effects
//*:**********************************************
if(GetObjectType(spInfo.oTarget)==OBJECT_TYPE_DOOR) {
SignalEvent(spInfo.oTarget, EventSpellCastAt(oCaster, spInfo.iSpellID));
switch(spInfo.iSpellID) {
case SPELL_GR_OPEN:
if(!GetLocked(spInfo.oTarget)) {
AssignCommand(spInfo.oTarget, ActionOpenDoor(spInfo.oTarget));
}
break;
case SPELL_GR_CLOSE:
if(GetIsOpen(spInfo.oTarget)) {
AssignCommand(spInfo.oTarget, ActionCloseDoor(spInfo.oTarget));
}
break;
}
}
if(spInfo.iXPCost>0) GRApplyXPCostToCaster(spInfo.iXPCost);
//*:**********************************************
//*:* Remove spell info from caster
//*:**********************************************
GRClearSpellInfo(spInfo.iSpellID, oCaster);
}
//:**************************************************************************
//:**************************************************************************
And I took out the includes thinking that is what may be causing it not to work as his spells all depend on those. I took what I thought was useless stuff out of the script and left the script as per below…but it does not compile…any help would be appreciated. The spell is a zero level spell to open and close doors.
//:**************************************************************************
//:* JD_S0_OPENCLOSE.NSS
//:**************************************************************************
//:* Open/Close
//:**************************************************************************
//:* Main function
//*:**************************************************************************
void main() {
object oCaster = OBJECT_SELF;
{
if(GetObjectType(spInfo.oTarget)==OBJECT_TYPE_DOOR) {
SignalEvent(spInfo.oTarget, EventSpellCastAt(oCaster, spInfo.iSpellID));
switch(spInfo.iSpellID) {
case SPELL_GR_OPEN:
if(!GetLocked(spInfo.oTarget)) {
AssignCommand(spInfo.oTarget, ActionOpenDoor(spInfo.oTarget));
}
break;
case SPELL_GR_CLOSE:
if(GetIsOpen(spInfo.oTarget)) {
AssignCommand(spInfo.oTarget, ActionCloseDoor(spInfo.oTarget));
}
break;
}
}
//*:**********************************************
//*:* Remove spell info from caster
//*:**********************************************
}
//:**************************************************************************
//:****************************************************************