Developer Store
Support
Member Forums

Screenshots
FAQ
Documentation
License
Known Issues
Downloads

MMOWorkshop.com Store Opened!
Torque MMO Kit - Open Sourced!
Torque MMO Kit - 1.5.2 Port Alpha Test
Torque MMO Kit - OSX Status

GarageGames.com irc.prairiegames.com
#mmoworkshop

PyTorque
TGB Web Browser


Prairie Games

hallsofvalhalla - After a long epiphany
Leathel - FoHO pre-Alpha 2.42
OldRod - More Musings on the MMO Industry
xapken - nice
J.C. Smith - 0.0.4.1 Build Notes
Wolf Dreamer - Pointless blog of pointless things
AthlonJedi2 - Server Nuked !!!!!
gamer_goof - New character model GIRL1 available only $4
... MORE BLOGS!

Mob chase range?
Auction House + Internal Mail Sy...
Crafting Wiki
Every Day a new question... :)
Lets talk skills.
Web Host
Seeking experienced programmer
Integrating Green-Ear SDK (paid)
where character information is s...
Spells Problem...

Spells Tutorial

STEP ONE: Creating New Spells

Simple - Direct Damage Spell

In this tutorial we are going to create a new level 1 Wizard spell called Arcane Blast.

1. Load the Torque MMO Kit IDE. Select File -> New choose the Python option and click 'Ok'.



2. Add the following text to the file and save it as: ~\test.game\genesis\spell\wizard.py

from genesis.dbdict import *
from mud.world.defines import *

durSecond = 6
durMinute = durSecond * 60
durHour = durMinute * 60


3. Open ~\test.game\genesis\spell\spellmain.py add the following text and save the file:

import wizard


4. Go back to wizard.py and we'll first create the effect:

effect = DBEffectProto(name="Arcane Blast")
effect.addDamage(RPG_DMG_MAGICAL,100)
effect.resist = RPG_RESIST_MAGICAL

The above effect can inflict up to 100 points of damage, however it can be resisted by mobs/players with a magical resistance. Remember, when creating spells that players can use these on mobs but mobs can also use them on players.

5. Now, let's create the spell and assign the effect to it.

We'll start by creating the spell prototype:

spell = DBSpellProto()
spell.name = "Arcane Blast"

Next, we'll assign a Spellbook picture. All icons can be found here: ~\test.game\data\ui\icons\

spell.spellbookPic = "SPELLICON_1_25"

Now, we'll assign particles, particle emitters, and sounds to the casting and beginning of the spell as well as a message displayed in the combat window when the spell hits the target:

spell.particleTextureCasting = "staticring"
spell.particleCasting = "ChimneySmokeEmitter"
spell.sndCasting = "sfx/MagicSpell_CastingLoop2.ogg"
spell.particleTextureBegin = "staticring"
spell.particleBegin = "ChimneyFireEmitter"
spell.sndBegin = "sfx/DarkMagic_SpellImpact01.ogg"
spell.beginMsg = "$tgt is struck by an arcane blast."

********** add some spell sound effects to test.game ******************

Notes:

  • other particles can be found here: ~\test.game\data\shapes\particles\
  • the use of '$tgt' inside of the message will automatically get replaced by the name of the mob

Now, we can add target information, spell duration, the range of the spell, how long it takes to cast the spell, how long the player/mob has to wait before the spell can be recast, a spell description which will show up when the spell is 'investigated', and the skill this spell uses:

spell.target = RPG_TARGET_OTHER
spell.duration = 0
spell.castRange = 20
spell.castTime = durSecond * 4
spell.recastTime = durSecond * 6
spell.harmful = True
spell.desc = "Damages a single target with a magical blast."
spell.skillname = "Evocation"

Finally, we need to assign the effect to the spell and limit the spell to the Wizard class, level 1 and greater:

spell.addEffect("Arcane Blast")
spell.addClass("Wizard", 1)


6. Save the file, select World -> Compile World and verify that there are no errors in the message window.

7. You will need to add a tome icon to your game. Find a scroll that you can use with the game (search online if you need). Save it and open it with a graphical editor and resize it to 256x256 and save it as a png to the following location:

test.game\data\ui\items\stuff\2\0_0_0.png



8. From inside the Torque MMO Kit IDE select World -> Edit Zone and choose one of your zones. Use /imm gimme Scroll of Arcane Blast. Ctrl-doubleclick the scroll in your inventory to scribe it to your spellbook, open your spellbook and click on the spell to test it.

Intermediate - AoE Drain Spell

Now, we are going to build upon the spell we created above. We are going to change the spell from a direct damage spell to an Area of Effect spell that drains the target of health over time.

Let's rename this Arcane Storm...replace the word 'blast' with 'storm' in the effect name and spell name.

1. First, we are going to change the effect prototype. Delete the addDamage line and replace it with the following:

effect.drainType = "health"
effect.drainTick = 20
effect.drainTickRate = durSecond * 6

The above says that we are going to drain 20 points of health from the target (as opposed to mana) every 6 seconds.

2. Now, we need to increase the duration of the spell since it is currently set to 0. Let's change it to last for one minute so the total amount that the spell will drain the target for will be 200 points of health:

spell.duration = durMinute * 1


3. Let's assign the range of the area of effect:

spell.aoeRange = 10

This means that the spell has a cast range of 20 but everything within a range of 10 will also be affected by this spell.

4. The last thing we need to do is provide visual queues to the target so that they know a negative effect has been applied to them as well as when it wears off. So, first we need to add an iconDst to the spell:

spell.iconDst = "SPELLICON_1_25"

The above will show up in their buff window with a time remaining ticker viewable.

Finally we need to add an endMsg that displays when the spell wears off, a new begin message, and an updated spell description:

spell.beginMsg = "$tgt is struck by an arcane storm."
spell.desc = "Damages surrounding enemies by a magical storm."
spell.endMsg = "$tgt is no longer affected by the arcane storm."

The spell should now look like this:

effect = DBEffectProto(name="Arcane Storm")
effect.drainType = "health"
effect.drainTick = 20
effect.drainTickRate = durSecond * 6
effect.resist = RPG_RESIST_MAGICAL

spell = DBSpellProto()
spell.name = "Arcane Storm"
spell.spellbookPic = "SPELLICON_1_25"
spell.iconDst = "SPELLICON_1_25"
spell.particleTextureCasting = "staticring"
spell.particleCasting = "ChimneySmokeEmitter"
spell.sndCasting = "sfx/MagicSpell_CastingLoop2.ogg"
spell.particleTextureBegin = "staticring"
spell.particleBegin = "ChimneyFireEmitter"
spell.sndBegin = "sfx/DarkMagic_SpellImpact01.ogg"
spell.beginMsg = "$tgt is struck by an arcane storm."
spell.target = RPG_TARGET_OTHER
spell.duration = durMinute * 1
spell.castRange = 20
spell.castTime = durSecond * 4
spell.recastTime = durSecond * 6
spell.harmful = True
spell.aoeRange = 10
spell.desc = "Damages surrounding enemies by a magical storm."
spell.endMsg = "$tgt is no longer affected by the arcane storm."
spell.skillname = "Evocation"
spell.addEffect("Arcane Storm")
spell.addClass("Wizard", 1)


5. Save the file, select World -> Compile World and verify that there are no errors in the message window.

6. From inside the Torque MMO Kit IDE select World -> Edit Zone and choose one of your zones. Use /imm gimme Scroll of Arcane Storm. Ctrl-doubleclick the scroll in your inventory to scribe it to your spellbook, open your spellbook and click on the spell to test it.

STEP TWO: Acquiring Spell Scrolls

Adding Spell Scrolls to Vendors

1. Create a new file called: ~\test.game\genesis\vendor\vendormain.py, add the following text to the file and save:

from genesis.dbdict import DBSpellProto
from mud.world.defines import *

import spellvendor

Next, we'll create the module that it will look to import.

2. Create a new file called: ~\test.game\genesis\vendor\spellvendor.py, add the following text to the file and save:

from genesis.dbdict import DBVendorProto,DBItemProto,DBDict
from mud.world.defines import *


3. Open ~\test.game\genesis\main.py, add the following text to the file and save:

import vendor.vendormain


4. Now we'll create the spell vendor in the spellvendor.py file. Add the following text and save:

vendor = DBVendorProto(name="Wizard Spell Dealer")
for s in spells:
    vendor.addItem("Scroll of %s"%s)

This defines the vendor as the Wizard Spell Dealer and will replace all items in its list by adding 'Scroll of' to the beginning of the spell name.

5. Add the scroll to their list of items by creating a list prior to the vendor proto:

spells = ["Arcane Storm"]

Note: make sure that spell names are in quotation marks and are separated by commas, if there is more than one.

Save the file.

6. Now, we need to add this vendor to an NPC. Let's add this to Guard Andarry in Zone One. Open ~\test.game\genesis\zone\zoneone\spawns.py and add the following line to his spawn information:

spawn.vendor = "Wizard Spell Dealer"


7. Save the file. Select World -> Compile World and verify that there are no errors in the message window. Select World -> Edit zone and load zoneone. Speak to Guard Andarry to purchase the Arcane Storm spell.

Adding Spell Scrolls to Mobs

Instead of purchasing items from vendors they can be added to Loot Tables as drops from corpses. Let's add this scroll to Radothe the wolf spawn that we created previously.

1. Open ~\test.game\genesis\zone\zoneone\spawns.py

2. Locate Radothe's spawn info.

3. Add the following text to his loot table:

loot.addItem("Scroll of Arcane Storm", RPG_FREQ_ALWAYS)


4. Save the file. Select World -> Compile World and verify that there are no errors in the message window.

5. Select World -> Edit zone and load zoneone. Spawn Radothe using /imm spawn Radothe, kill him, and loot the scroll.




Return to Tutorials

Attachments