My first attempt at making a spell - need input from community

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
//*:**********************************************

}
//:**************************************************************************
//
:****************************************************************

I tried to find the spells it calls from in the script: “SPELL_GR_OPEN” and “SPELL_GR_CLOSE”…but could not find them. So maybe they need to be recreated??

Did you amend the spells.2da?

yup…changed only the name of the spell script from: “GR_S0_OPENCLOSE” to “JD_S0_OPENCLOSE”…so it would call only from my new script…once I get this to work

Mmmmh, I’m not familiar with creating spells, I only know where to look, if I need one. There is the module “Tale of a mage (part 2)” which has several custom spells, and maybe somewhere a tutorial too.

1 Like

Cool I will take a look at it…I love incorporating new spells into my module. Too bad the Grimoire spells by Syrus Greaycloak (where I got this spell from) don’t work…so many great spells in there

I looked at the spells in that module you suggested. I have them already, but thanks anyways :slight_smile:

This is not a question of “to have or not to have”, it’s just an easy way to learn, how to get working custom spells.

But it’s still easier. I’ve made a spell for you. Yes, yes! The name of the spell is “The Fetters of Rhyme”. A level 1 spell for Sorc/Wiz.

Copy the Scripts into a module (Best is to test it with a new module.)
Put the 2da-line into your spell.2da and create a new hak for it.
Copy the tlk into the tlk directory.

That’s all you need. Prepearing the mod with the hak for the spells.2da and the tlk and a proper encounter is most of the work. Now launch the mod. Your wiz first needs to learn the spell, so level him up. Then trigger the encounter and cast it on the nearest enemy …

Fetters.7z (30.6 KB)

Thanks Mmat…cool…I will add it. I have always wondered what a .ncs is? Also, do you have the spell icon tga for this spell?

I just opened the tlk. There is no description of what the spell is

No, it’s quick and dirty. Just try it.

(I thought, everybody knows “Fetters” :smiley:)

Ah crap…I guess my goal to create spells is shattered. I looked up what an .ncs is…I have no idea how to script let alone create one of those .ncs files. I can only see that the spell you created is a spell that paralyzes? Looked at your .nss spell script.

My goal for this spell above for opening and closing doors…as simple as I can think…is pfft…non achievable.

a NCS is a Newerwinter Compiled Script. Actually you need only top copy the text from the nss into the script editor and the ncs will be generated on save.

Also, do you have the spell icon tga for this spell?

Noe, it’s quick and dirty. It uses a bio-icon

1 Like

Opening a door shouldn’t be hard. Somehow you only need to identify the object type of the target, if it is a door, then “AssignCommand (oTarget, ActionOpen(oTarget));”

I can have a look on it, but tomorrow …

Thanks Mmat. the one above should open and close the door and be set as a zero level spell.

I’m still working on the spell you gave me. Put the lines on my tlk and need to figure out a spell description once I figure out what this spell of yours does. I noticed you have a tlk line reference in your spell 2da that is the 6th line from the end of the spell 2da…as “alt description”…don’t know what I would put in there. Spell description is straight forward.

I would like to know if there is a program that would allow me to make a coloured icon for spells. If you know of one please let me know.

Just tested your spell. It paralyzes …but the creature permanently stays that way. Spell does not wear off. Is there even a saving throw for it?

Maybe as a 1st level spell it should only paralyze for say 1 round with no saving throw allowed. So this could still be a useful spell at higher levels…almost like the cleric spell command.

I only set a proper name, the description points to some irrelevant text. I took just an existing tlk which was very short.

Just try the spell, you’ll see what he does.

I did test it…only paralyzes. No set duration set on it.

Irfanview :slight_smile:
Paint.net :smiley:

Actually any program which can handle tga. But there’s no sofware, which does the actual painting for you, too bad …