Page 12 of 21

Re: New Spells >> show them off here

Posted: Sat Nov 17, 2012 10:58 am
by akroma222
TRANSMUTE SOUL
Here is a spell based on Flatline's Calignous Curse and Cromcrom's AOE scripts. This spell will damage the party and surrounding enemies (2 space radius) and then will restore energy for the whole party.
Easy set up:

1. Paste this into objects.lua (altering runes/skill/costs to your liking):
SpoilerShow

Code: Select all

 defineSpell{
   name = "transmute_soul",
   uiName = "Transmute Soul",
   skill = "spellcraft",
   level = 0,
   runes = "DEFH",
   manaCost = 5,
   onCast = function(champ, x, y, direction, skill)
   party:playScreenEffect("cold_glow_magicshield")
   playSoundAt("read_tome",party.level,party.x,party.y)
   hudPrint(champ:getName().." drains surrounding life force and transmutes it to pure energy")
   
 for i = x-2,x+2 do 
      for j = y-2,y+2 do
      damageTile(party.level, i,j, party.facing, 1, "physical", math.random(1,10)*(skill*2))
      end
end
      for i = 1,4 do
      party:getChampion(i):modifyStat("energy", math.random(1,10)*(skill*4))   
      end
   end, 
}
Hope you enjoy!! :D
EDIT: Cromcrom's new script replaced old one

Re: New Spells >> show them off here

Posted: Sat Nov 17, 2012 12:14 pm
by cromcrom
Great, thanks for sharing. You could probably change this spell so that the amount of energy/health depends on the amount of monsters hit with the spell.
And if you want to damage the party in the process, the script could be much much cleaner than the one I told you.
Please consider this:
SpoilerShow

Code: Select all

 defineSpell{
   name = "transmute_soul",
   uiName = "Transmute Soul",
   skill = "spellcraft",
   level = 0,
   runes = "DEFH",
   manaCost = 5,
   onCast = function(champ, x, y, direction, skill)
   party:playScreenEffect("cold_glow_magicshield")
   playSoundAt("read_tome",party.level,party.x,party.y)
   hudPrint(champ:getName().." drains surrounding life force and transmutes it to pure energy")
   
 for i = x-2,x+2 do 
      for j = y-2,y+2 do
      damageTile(party.level, i,j, party.facing, 1, "physical", math.random(1,10)*(skill*2))
      end
end
      for i = 1,4 do
      party:getChampion(i):modifyStat("energy", math.random(1,10)*(skill*4))   
      end
   end, 
}

Re: New Spells >> show them off here

Posted: Sat Nov 17, 2012 1:50 pm
by akroma222
Yup! Works perfectly, I will replace the old script with your new version. Thanks again Cromcrom :D

Re: New Spells >> show them off here

Posted: Sat Nov 17, 2012 1:56 pm
by Grimwold
Excellent work on all your new spells. I have yet to try them, but sound really good.

Your Stat-buffing spells look like they function in a similar way to the ManaShield spell I helped write for Flatline... viewtopic.php?f=14&t=4108#p43041

Re: New Spells >> show them off here

Posted: Sat Nov 17, 2012 2:02 pm
by Grimwold
akroma222 wrote: 3. Create 3 timers next to "buffing_scripts", named ("timer_magicshield", "timer_reflexion" and "timer_repelmagic"). Set the timers for the period you wish the buffing spell to stay in place for (I find the spells stay in effect for roughly twice as long as the time I have set them to)... or maybe that is just my warped sense of time?
Just a quick note here on time... if the timers are on the same level as the party, they are updated every second, however if they are 1 level above or below they are done on alternate seconds (making timers last twice as long!).. higher or lower than that and they are done on an as and when basis.
For that reason, for any timed spells, I have been spawning the timers on the party level at the moment the spells are cast and destroying them... this reduces the chance that the timer will be on a different level of the dungeon than the party. (still open to abuse if players cast spells and then deliberately change levels, but without a lot of extra coding to move timers between levels, that's hard to fix)

Re: New Spells >> show them off here

Posted: Sat Nov 17, 2012 2:08 pm
by crisman
That's a thing I completely forgot when developing that...
I'll have to fix it asap.

Re: New Spells >> show them off here

Posted: Sat Nov 17, 2012 2:40 pm
by akroma222
Interesting indeed.. thanks Grimwold ;) (I will change explanation on the post)
EDIT - and yes!! the buffing spells are very very similar to the one outlined in that thread..

Just a couple of questions (that might be bleedingly obvious) regarding the damage tile/ EXP system..
-if our custom spells have to do physical damage through these tiles in order to get EXP, then a lot of monster magic immunities are going to become redundant, right??
also... does anyone know how to get burst spells and or the aforementioned area of effect spells to work with damage tiles? (I am currently experimenting....)

Re: New Spells >> show them off here

Posted: Sat Nov 17, 2012 3:12 pm
by Grimwold
The damageTile() doesn't have to do physical damage.. my Burn Monster spell does fire damage.. the important thing is that using damageTile() provides a link between Caster and target.

If I understand what your asking regarding burst spells... you could use damageTile to actually deal the damage, but spawn a particle effect separately to create the look of the spell. I was going to do that for Burn Monster, but because I was dealing fire damage with damageTile() it came with it's own flame effect on the monster, so looked alright without.

Re: New Spells >> show them off here

Posted: Sun Nov 18, 2012 5:30 am
by akroma222
Ahh yes Grimwold, of course! I now have the damageTiles doing what I need them to for projectile spells (for some reason I remember reading that it had to be physical damage - but clearly not!!)

I am still curious about spells like fan of knives and whipping rocks though... I am trying to use "spellCaster = caster:getOrdinal" to set up for the damageTile but upon casting those spells, the preview just stops? (is it because there are multiple projectiles?? or something else...? hmm)

Regarding the burst spells (specifically, spells like flame wind, sheet lightning - as above^^)- I am just unsure of how to set up a scripted function to get the damage tile going.... would I use an onDamage hook for the monster? (as I obviously would not use onProjectileHit).. and if so, how would I tell it to check for what kind of spell was doing the damage? I tried improvising on your burn monster tile damage set up but it isnt really the same thing... I am actually quite lost on this one :?

Re: New Spells >> show them off here

Posted: Sun Nov 18, 2012 1:56 pm
by Grimwold
Just so I'm clear.. the area effect spells target each of the 8 squares around the party e.g

Code: Select all

XXX
XPX
XXX
If so, you can simply call damageTile() on each of the 8 spaces and at the same time spawn an fx that uses the appropriate spell effect particle system. e.g.

Code: Select all

  spawn("fx", party.level, x+dx, y+dy, facing)
    :setParticleSystem("fireburst")
The particle system creates the look, and the damageTile() deals the damage.


If you're having trouble debugging spells because the editor is freezing/crashing, you are best to move all code into a script entity in the dungeon... that way the editor will take you to the line that is causing the problem instead of just crashing.


sorry I don't have more time to go in depth.. the kids are nagging me.. I'll try and write more later.