New Spells >> show them off here

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: New Spells >> show them off here

Post by Grimwold »

I've changed the runes for the healing spells, to allow the use of Heal Party and Heal Champion in the same mod... There's also the Combined Heal spell which 'graduates' from Champion to Party healing based on the caster's level (which should be used instead of the other two spells). I also changed the runes for Push monster as it actually shared runes with Shock Shield...

Heal Party - BEF (life; balance; physicality)
Heal Champ - BF (life; physicality)
Combined Heal - BF (life; physicality)
Push Monster - CF (air; physicality)
Hold Monster - FG (physicality; earth)
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: New Spells >> show them off here

Post by akroma222 »

HASTE & BESERK SPELLS

Hey folks, I just created these two as it would be lovely to have a full party haste and beserk spells. I have set the skill to 0 and energy cost to 1 (modify at will for your purposes obviously!)..
Personally I think they both belong in the fire realm (and that works out balanced for me as other new spells have been loaded into ice, air, earth and spellcraft)...

HASTE
SpoilerShow

Code: Select all

defineSpell{
   name = "haste",
   uiName = "Haste",
   skill = "fire_magic",
   level = 0,
   runes = "ACE",
   manaCost = 1,
   onCast = function(self, champion) 
	for i = 1,4 do
         party:getChampion(i):setCondition("haste", 50) 
   end
   playSound("heal_party")
        return true
   end
}
and BESERK
SpoilerShow

Code: Select all

defineSpell{
   name = "beserk",
   uiName = "Beserk",
   skill = "fire_magic",
   level = 0,
   runes = "AFG",
   manaCost = 1,
   onCast = function(self, champion) 
	for i = 1,4 do
         party:getChampion(i):setCondition("rage", 50) 
   end
   playSound("heal_party")
        return true
   end
}
Enjoy... let me know if there are any dramas with these two :)
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: New Spells >> show them off here

Post by akroma222 »

Having said that, if one were to put them both in the same spell realm, it does have the potential to be abused if both are used at the same time. To prevent this, split them into diff realms maybe?? Or make their costs quite high (high enough to restrict offensive spell casting straight after).... Haste could also be placed in AIR and/or Beserk could go to EARTH.... (It is all up to you :D )
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: New Spells >> show them off here

Post by Grimwold »

A new one from me... this time a fire based attack spell that deals damge and grants XP (thanks to JKos explaining the damageTile() function).

Burn Monster
This spell will target a monster in front of the party and burn it every 2 seconds for a length of time based on the casters skill - 11 secs, 21, 31, 41 etc. at the moment it does ~5 hp of fire damage per hit, but I may modify that.

Define the spell in spells.lua

Code: Select all

-- Burn Monster Spell
defineSpell{
  name = "burn_monster",
  uiName = "Burn Monster",
  skill = "fire_magic",
  level = 5,
  runes = "AGH",
  manaCost = 30,
  onCast = function(caster, x, y, direction, skill)
    return burn_monster_spell_script.startBurn(caster,x,y,direction,skill)
  end,
}
Add the scroll in items.lua

Code: Select all

defineObject{
  name = "scroll_burn_monster",
  class = "Item",
  uiName = "Scroll of Burn Monster",
  model = "assets/models/items/scroll_spell.fbx",
  gfxIndex = 113,
  scroll = true,
  spell = "burn_monster",
  weight = 0.3,
}

Add a script entity in your dungeon called burn_monster_spell_script

Code: Select all

burnd_monster = ""
burn_caster_ord = 1

function isInTable(table, element)
  for _,value in pairs(table) do
    if value == element then
      return true
    end
  end
  return false
end

function whichMonster(level,eggs,why)
  for i in entitiesAt(level,eggs,why) do
    if isInTable(allMonsters,i.name) then
      return i.id
    end
  end
  return ""
end

-- Burn Monster functions --

function startBurn(caster,x,y,dir,skill)
  burn_caster_ord = caster:getOrdinal()
  local duration = math.ceil(skill/10)*10 +1
 -- hudPrint(tostring(duration) .. " seconds")
  local burn_timer_list = {"burn_timer","burn_stop_timer"}
  for _,itimer in ipairs(burn_timer_list) do
    local burn_timer = findEntity(itimer)
    if burn_timer ~= nil then
      burn_timer:destroy()
    end
  end
  local dx,dy = getForward(party.facing)
  burnd_monster = whichMonster(party.level,party.x+dx,party.y+dy)
  if burnd_monster == "" then
    hudPrint("There's no monster to Burn")
    return true
  end
  playSound("fireburst")
  burnDamage()
  spawn("timer", party.level, party.x, party.y, party.facing, "burn_timer")
    :setTimerInterval(2)
    :activate()
    :addConnector("activate","burn_monster_spell_script","burnDamage")
  spawn("timer", party.level, party.x, party.y, party.facing, "burn_stop_timer")
    :setTimerInterval(duration)
    :activate()
    :addConnector("activate","burn_monster_spell_script","endBurn")
  return true
end

function burnDamage()
  local burnd_mon = findEntity(burnd_monster)
  if burnd_mon ~= nil then
    local originator = 2 ^ (burn_caster_ord+1)
    damageTile(burnd_mon.level,burnd_mon.x,burnd_mon.y,(burnd_mon.facing + 2)%4,originator+1, 'fire',5)
  end
end

function endBurn()
  burn_timer:deactivate()
  burn_stop_timer:deactivate()
end

When I get chance I will add this to my Magic Pack at Nexus - http://grimrock.nexusmods.com/mods/70
Last edited by Grimwold on Wed Nov 28, 2012 1:45 pm, edited 2 times in total.
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: New Spells >> show them off here

Post by Neikun »

Grimwold wrote: runes = "AGH",
I LOLED.
Caster: "I can't remember how to cast that spell...AGH! *kaboom*"
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
forcommenting
Posts: 3
Joined: Sun Oct 21, 2012 4:26 pm

Re: New Spells >> show them off here

Post by forcommenting »

Grimwold wrote:I tested it again in a fresh dungeon and the spell worked absolutely fine. If you still can't get it to work in a new dungeon of your own let me know and I can provide the source of my new test dungeon for you to look at.
Finally got back to tell you I realized what I did wrong with your push spell. I had created a new monster copy of an ogre and forgot that I had done that, so I was thinking it was an 'ogre' and the game saw it as a 'strong_ogre' two completely different things. :lol: Great stuff
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: New Spells >> show them off here

Post by akroma222 »

Hi folks,
Just throwing this one out there - and hoping for some guidance... I am keen to create a spell for each element that will damage all creatures in a 1 space radius around the party.
I figured that the spell could just spawn multiple burst spells in each space surrounding the party... Similar to how Flatline's Calignous Curse damages monsters surrounding the party.
I tried modifying the Calignous Curse script to get this effect for 8 firebursts to go off (1 in each space surrounding the party)... but failed terribly :oops:
Not even quite sure if this is the way to go about it.....

Could anyone suggest a way to get this to work... or share a pre-existing script they have for a similar spell??
I realise people are very busy with their own projects and modds - so I am happy to create requested monsters/items/icons etc or play test dungeons in return for good help.. :)
User avatar
cromcrom
Posts: 549
Joined: Tue Sep 11, 2012 7:16 am
Location: Chateauroux in a socialist s#!$*&% formerly known as "France"

Re: New Spells >> show them off here

Post by cromcrom »

Its ugly (some code optimizers will probably make it shiny clean ^^) but it works:

Code: Select all

defineSpell{
  name = "burn_around", --or whatever
  uiName = "Burn Around", --or whatever
  skill = "fire_magic",
  level = 1,
  runes = "A",
  manaCost = 30,
  onCast = function(caster, x, y, direction, skill)
for i = x-1,x+1 do 
for j = y-1,y-1 do
spawn("fireburst",party.level,i,j,direction)
end
end
for i = x-1,x+1 do 
for j = y+1,y+1 do
spawn("fireburst",party.level,i,j,direction)
end
end
spawn("fireburst",party.level,x-1,y,direction)
spawn("fireburst",party.level,x+1,y,direction)
 end,
}
The trick here was that the usual

Code: Select all

for i = x-1,x+1 do 
for j = y-1,y+1 do 
spawn("fireburst",party.level,i,j,direction)
end
end
would also spawn the fireburst on the party...
And I am adding this one to TLC, its pretty neat :-) (I put you in the credits, nice idea and Haste and Berzerk spells :-) )
A trip of a thousand leagues starts with a step.
User avatar
cromcrom
Posts: 549
Joined: Tue Sep 11, 2012 7:16 am
Location: Chateauroux in a socialist s#!$*&% formerly known as "France"

Re: New Spells >> show them off here

Post by cromcrom »

Grimwold, I am adding your spells to TLC. Credits already given, and I will rename the spells with your name, it sounds good as an Archmage 's name ^^. Thanks for sharing :-)
A trip of a thousand leagues starts with a step.
CrazyGage
Posts: 2
Joined: Tue Nov 13, 2012 9:56 pm

Re: New Spells >> show them off here

Post by CrazyGage »

Wizard's Fire / Wizard's Life Fire

These spells are based on, and sort of a homage to, Terry Goodkind's Sword of Truth book series. Both are very powerful fire-based spells, but using them has dire consequences.

Wizard's Fire
Wizard's Fire uses up the caster's entire supply of energy, regardless of how much there is available, and fires with an attack power of (consumed energy - 10) * 3 for Fire Magic >=5 or attack power = 50 if Fire Magic < 5. It is a good spell for helping defeat tough enemies and is generally a "Oh crap, get out of here" sort of thing as the caster will not be able to cast any additional spells until energy is recovered.

Image

Wizard's Life Fire
Wizard's Life Fire is the super-amped up version of Wizard's Fire. The caster gives up his soul, and thus dies, to cast this spell. It can even be cast with no energy available. It is huge, bright and does a massive amount of damage with an attack power of (100 * Fire Magic Skill Level). It can dispatch most enemies in a single blast, but is very much a last-ditch effort to save the group.

Image

How to Implement
SpoilerShow
First, you will need to downoad the assets for the spell (https://dl.dropbox.com/u/25424803/Legen ... s_fire.zip) which includes two models, a sound effect, and a few texture files. This archive can be unpacked directly into your mod_assets folder.

These spell effects are based off of the projectile spell tutorial (viewtopic.php?f=14&t=3910) which I modified slightly. So you will need to create a script entity in your map named fxScripts with the following code:

Code: Select all

projectiles = {}
function addProjectileEffect(projectile,effectName,speed,onHitEffectName)
   local timer = spawn('timer',projectile.level,projectile.x,projectile.y,projectile.facing)
   local effect = spawn('fx',projectile.level,projectile.x,projectile.y,projectile.facing)
   projectiles[timer.id] = {}
   projectiles[timer.id].projectile_id = projectile.id
   projectiles[timer.id].effect_id =  effect.id
   projectiles[timer.id].level = projectile.level
   projectiles[timer.id].x = 0
   projectiles[timer.id].y = 0
   projectiles[timer.id].facing = projectile.facing
   projectiles[timer.id].onHitEffect= onHitEffectName
   
   local dx,dy = getForward(projectile.facing)
   dy = -1 * dy

   projectiles[timer.id].x = dx * 0.5
   projectiles[timer.id].y = dy * 0.5

   timer:addConnector('activate','fxScripts','move_effect')
   timer:setTimerInterval(0.5/speed)
   local light = getLightPreset(effectName)
   if light then
      effect:setLight(unpack(light))
   end
   
   effect:translate(0.5*dx,1,0.5*dy)
   effect:setParticleSystem(effectName)
   timer:activate()
   return effect
end

function addProjectileManualHit(caster, projectile, damageAmount, damageType, radius)

	for key,value in pairs(projectiles) do
		if value.projectile_id == projectile.id then
			if caster then
				projectiles[key].caster = caster:getOrdinal()
			end
			projectiles[key].damage = damageAmount
			projectiles[key].damageType = damageType
			projectiles[key].radius = radius
		
		end
	end

end

function getLightPreset(preset)
   --FX:setLight(red, green, blue, brightness, range, time, castShadow)
   local s = {}
   s['fireball'] = {1, 0.5, 0.25,15,7,200,true} 
   s['fireball_hit'] = {1, 0.5, 0.25,40,7,1,true}
   s['magic_missile'] = {1, 1, 1,15,7,200,true}
   s['poison_bolt'] = {0.25, 0.6, 0.2,4,4,200,true}
   s['lightning_bolt'] = {0.25, 0.5, 1,30,5,1,true}
   s['lightning_bolt_hit'] = {0.25, 0.5, 1,100,5,0.5,true}
   s['magic_missile_hit'] = {1, 1, 1,40,10,1,true}
   s['wizards_fire'] = {1, 0.9, 0.5,40,10,1,true}
   s['wizards_life_fire'] = {1, 1, 1,120,10,1,true}
   s['wizards_fire_hit'] = {1, 1, 0.95, 150,10,0.6,true}
   
   local l = s[preset]
   
   if not l then
      l = {0, 0, 0, 0, 0, 0, false}
   end
   
   return l
   
end

function applyDamage(monster, weapon)
	for key,value in pairs(projectiles) do
		if value.projectile_id == weapon.id then
		  local e=projectiles[key]
		  -- add hit damage/exp if specified
		  if e.damage then
			local r = 0
			local dType = "physical"
			local damageFlag = 0
			
			-- get radius
			if e.radius and e.radius > 1 then
				r = e.radius - 1
			end
			--get damage type
			if e.damageType then
				dType = e.damageType
			end
			
			-- figure out which party member should get the experience
			if e.caster ~= nil and e.caster > 0 then
				damageFlag = 2 ^ (e.caster + 1)
			end
			
			for x=monster.x-r,monster.x+r do
				for y=monster.y-r,monster.y+r do
					--print("damage: " .. e.damage .. " " .. dType .. " l:" .. e.level .. " x:" .. x .. ", y:" .. y)
					damageTile(e.level, x, y, (e.facing+2)%4, damageFlag, dType, e.damage)
				end
			end
		  end
		  return false
		end
	end
	
	return true
end


function move_effect(timer)
   local e = projectiles[timer.id]
   local p = findEntity(e.projectile_id)
   local fx = findEntity(e.effect_id)
   
   if not p then
      if e.onHitEffect then
         local ohfx = spawn('fx',e.level,e.px,e.py,e.facing)
         ohfx:setParticleSystem(e.onHitEffect)
         ohfx:translate(0, 1, 0)
         local light = getLightPreset(e.onHitEffect)
         if light then
            ohfx:setLight(unpack(light))
         end         
      end
	  	
      projectiles[timer.id] = nil
      timer:deactivate()
      timer:destroy()
      fx:destroy()  
      return
   end
   e.px = p.x
   e.py = p.y 
   fx:translate(e.x,0,e.y)
end
There are a series of objects and materials that need to be set up as well.

In init.lua:

Code: Select all

import "mod_assets/scripts/particles.lua"

In objects.lua:

Code: Select all

defineObject{
	name = "spell_projectile",
	class = "Item",
	uiName = "Spell projectile",
	model = "mod_assets/models/spell_projectile.fbx",
	gfxIndex = 109,
	attackPower = 1,
	impactSound = "fireball_hit",
	stackable = false,
	sharpProjectile = false,
	projectileRotationY = 0,
	weight = 0,	
}

cloneObject{
	name = "invisible_spell_projectile",
	baseObject = "spell_projectile",
	model = "mod_assets/models/spell_projectile2.fbx",
}

cloneObject{
    name = "wizards_fire_ball",
    baseObject = "invisible_spell_projectile",
    attackPower = 60,
    damageType = "fire",
}

cloneObject{
    name = "wizards_life_fire_ball",
    baseObject = "invisible_spell_projectile",
    sharpProjectile = false,
    attackPower = 60,
    damageType = "fire",
}

In materials.lua:

Code: Select all

defineMaterial{
	name = "invisible",
	diffuseMap = "assets/textures/common/black.tga",
	specularMap = "assets/textures/common/black.tga",
	normalMap = "assets/textures/common/black.tga",
	doubleSided = false,
	lighting = false,
	alphaTest = false,
	blendMode = "Additive",
	textureAddressMode = "Wrap",
	glossiness = 0,
	depthBias = 0,
}

In particles.lua: (new file in the scripts folder)

Code: Select all

defineParticleSystem{
	name = "wizards_fire",
	emitters = {
		-- smoke
		{
			emissionRate = 30,
			emissionTime = 0,
			maxParticles = 100,
			boxMin = {0.0, 0.0, 0.0},
			boxMax = {0.0, 0.0, 0.0},
			sprayAngle = {0,360},
			velocity = {0.1,0.1},
			texture = "assets/textures/particles/smoke_01.tga",
			lifetime = {1,1.25},
			color0 = {0.25, 0.25, 0.25},
			opacity = 1,
			fadeIn = 0.1,
			fadeOut = 0.9,
			size = {0.8, 1.1},
			gravity = {0,0,0},
			airResistance = 0.1,
			rotationSpeed = 1,
			blendMode = "Translucent",
		},

		-- flames
		{
			emissionRate = 100,
			emissionTime = 0,
			maxParticles = 100,
			boxMin = {-0.03, -0.03, 0.03},
			boxMax = { 0.03, 0.03,  -0.03},
			sprayAngle = {0,360},
			velocity = {0.5, 0.7},
			texture = "assets/textures/particles/torch_flame.tga",
			frameRate = 35,
			frameSize = 64,
			frameCount = 16,
			lifetime = {0.8, 0.8},
			colorAnimation = true,
			color0 = {2, 2, 2},
			color1 = {1.0, 1.0, 1.0},
			color2 = {1.0, 0.5, 0.25},
			color3 = {1.0, 0.3, 0.1},
			opacity = 1,
			fadeIn = 0.15,
			fadeOut = 0.3,
			size = {0.25, 0.35},
			gravity = {0,0,0},
			airResistance = 1,
			rotationSpeed = 1,
			blendMode = "Additive",
			objectSpace = true,
		},
        
        -- lightning rim
		{
			emissionRate = 20,
			emissionTime = 0,
			maxParticles = 15,
			boxMin = { 0,0,0 },
			boxMax = { 0,0,0 },
			sprayAngle = {0,360},
			velocity = {0,0},
			texture = "mod_assets/textures/lightning_ball_blue.tga",
			lifetime = {0.5,1},
			colorAnimation = false,
			color0 = {1, 1, 1},
			opacity = 1,
			fadeIn = 0.1,
			fadeOut = 0.3,
			size = {0.7, 0.8},
			gravity = {0,0,0},
			airResistance = 5,
			rotationSpeed = 2,
			blendMode = "Additive",
			objectSpace = true,
		},
        -- lightning core
		{
			emissionRate = 20,
			emissionTime = 0,
			maxParticles = 3,
			boxMin = { 0,0,0 },
			boxMax = { 0,0,0 },
			sprayAngle = {0,360},
			velocity = {0,0},
			texture = "mod_assets/textures/lightning_ball.tga",
			lifetime = {0.4,0.5},
			colorAnimation = false,
			color0 = {1, 1, 1},
			opacity = 1,
			fadeIn = 0.1,
			fadeOut = 0.3,
			size = {0.7, 0.75},
			gravity = {0,0,0},
			airResistance = 5,
			rotationSpeed = -2,
			blendMode = "Additive",
			objectSpace = true,
		},

		-- glow
		{
			spawnBurst = true,
			emissionRate = 1,
			emissionTime = 0,
			maxParticles = 1,
			boxMin = {0,0,0.0},
			boxMax = {0,0,0.0},
			sprayAngle = {0,30},
			velocity = {0,0},
			texture = "assets/textures/particles/glow.tga",
			lifetime = {1000000, 1000000},
			colorAnimation = false,
			color0 = {0.25,0.32,0.5},
			opacity = 0.3,
			fadeIn = 0.1,
			fadeOut = 0.1,
			size = {1.0, 1.0},
			gravity = {0,0,0},
			airResistance = 1,
			rotationSpeed = 2,
			blendMode = "Additive",
			objectSpace = true,
		},

		-- flame trail
		{
			emissionRate = 80,
			emissionTime = 0,
			maxParticles = 100,
			boxMin = {0.0, 0.0, 0.0},
			boxMax = {0.0, 0.0, 0.0},
			sprayAngle = {0,360},
			velocity = {0.1, 0.3},
			texture = "assets/textures/particles/torch_flame.tga",
			frameRate = 35,
			frameSize = 64,
			frameCount = 16,
			lifetime = {0.15, 0.25},
			colorAnimation = true,
			color0 = {2, 2, 2},
			color1 = {1.0, 1.0, 1.0},
			color2 = {1.0, 0.5, 0.25},
			color3 = {1.0, 0.3, 0.1},
			opacity = 1,
			fadeIn = 0.15,
			fadeOut = 0.3,
			size = {0.4, 0.9},
			gravity = {0,0,0},
			airResistance = 1.0,
			rotationSpeed = 1,
			blendMode = "Additive",
		},
	}
}

defineParticleSystem{
	name = "wizards_life_fire",
	emitters = {
		-- smoke
		{
			emissionRate = 30,
			emissionTime = 0,
			maxParticles = 100,
			boxMin = {0.0, 0.0, 0.0},
			boxMax = {0.0, 0.0, 0.0},
			sprayAngle = {0,360},
			velocity = {0.1,0.1},
			texture = "assets/textures/particles/smoke_01.tga",
			lifetime = {2,3},
			color0 = {0.25, 0.25, 0.25},
			opacity = 1,
			fadeIn = 0.1,
			fadeOut = 0.9,
			size = {1.8, 2.5},
			gravity = {0,0,0},
			airResistance = 0.1,
			rotationSpeed = 1,
			blendMode = "Translucent",
		},

		-- flames
		{
			emissionRate = 100,
			emissionTime = 0,
			maxParticles = 100,
			boxMin = {-0.4, -0.4, 0.4},
			boxMax = { 0.4, 0.4,  -0.4},
			sprayAngle = {0,360},
			velocity = {0.5, 0.7},
			texture = "assets/textures/particles/torch_flame.tga",
			frameRate = 35,
			frameSize = 64,
			frameCount = 16,
			lifetime = {0.8, 0.8},
			colorAnimation = true,
			color0 = {2, 2, 2},
			color1 = {1.0, 1.0, 1.0},
			color2 = {1.0, 0.5, 0.25},
			color3 = {1.0, 0.3, 0.1},
			opacity = 1,
			fadeIn = 0.15,
			fadeOut = 0.3,
			size = {0.75, 0.95},
			gravity = {0,0,0},
			airResistance = 1,
			rotationSpeed = 1,
			blendMode = "Additive",
			objectSpace = true,
		},
        
        -- lightning rim
		{
			emissionRate = 20,
			emissionTime = 0,
			maxParticles = 15,
			boxMin = { 0,0,0 },
			boxMax = { 0,0,0 },
			sprayAngle = {0,360},
			velocity = {0,0},
			texture = "mod_assets/textures/lightning_ball_blue.tga",
			lifetime = {0.5,1},
			colorAnimation = false,
			color0 = {1, 1, 1},
			opacity = 1,
			fadeIn = 0.1,
			fadeOut = 0.3,
			size = {1.8, 2.0},
			gravity = {0,0,0},
			airResistance = 5,
			rotationSpeed = 2,
			blendMode = "Additive",
			objectSpace = true,
		},
        -- lightning core
		{
			emissionRate = 20,
			emissionTime = 0,
			maxParticles = 3,
			boxMin = { 0,0,0 },
			boxMax = { 0,0,0 },
			sprayAngle = {0,360},
			velocity = {0,0},
			texture = "mod_assets/textures/lightning_ball.tga",
			lifetime = {0.4,0.5},
			colorAnimation = false,
			color0 = {1, 1, 1},
			opacity = 1,
			fadeIn = 0.1,
			fadeOut = 0.3,
			size = {1.6, 1.8},
			gravity = {0,0,0},
			airResistance = 5,
			rotationSpeed = -2,
			blendMode = "Additive",
			objectSpace = true,
		},

		-- glow
		{
			spawnBurst = true,
			emissionRate = 1,
			emissionTime = 0,
			maxParticles = 1,
			boxMin = {0,0,0.0},
			boxMax = {0,0,0.0},
			sprayAngle = {0,30},
			velocity = {0,0},
			texture = "assets/textures/particles/glow.tga",
			lifetime = {1000000, 1000000},
			colorAnimation = false,
			color0 = {0.25,0.32,0.5},
			opacity = 0.3,
			fadeIn = 0.1,
			fadeOut = 0.1,
			size = {2.0, 2.2},
			gravity = {0,0,0},
			airResistance = 1,
			rotationSpeed = 2,
			blendMode = "Additive",
			objectSpace = true,
		},

		-- flame trail
		{
			emissionRate = 80,
			emissionTime = 0,
			maxParticles = 100,
			boxMin = {0.0, 0.0, 0.0},
			boxMax = {0.0, 0.0, 0.0},
			sprayAngle = {0,360},
			velocity = {0.1, 0.3},
			texture = "assets/textures/particles/torch_flame.tga",
			frameRate = 35,
			frameSize = 64,
			frameCount = 16,
			lifetime = {0.25, 0.4},
			colorAnimation = true,
			color0 = {2, 2, 2},
			color1 = {1.0, 1.0, 1.0},
			color2 = {1.0, 0.5, 0.25},
			color3 = {1.0, 0.3, 0.1},
			opacity = 1,
			fadeIn = 0.15,
			fadeOut = 0.3,
			size = {1.6, 1.8},
			gravity = {0,0,0},
			airResistance = 1.0,
			rotationSpeed = 1,
			blendMode = "Additive",
		},
	}
}

defineParticleSystem{
	name = "wizards_fire_hit",
	emitters = {
		-- smoke
		{
			emissionRate = 20,
			emissionTime = 0.3,
			maxParticles = 100,
			boxMin = {0.0, 0.0, 0.0},
			boxMax = {0.0, 0.0, 0.0},
			sprayAngle = {0,100},
			velocity = {0.1, 0.5},
			texture = "assets/textures/particles/smoke_01.tga",
			lifetime = {0.8,1.1},
			color0 = {0.25, 0.20, 0.17},
			opacity = 1,
			fadeIn = 0.3,
			fadeOut = 0.9,
			size = {2, 3},
			gravity = {0,0,0},
			airResistance = 0.1,
			rotationSpeed = 0.5,
			blendMode = "Translucent",
		},

		-- flames
		{
			spawnBurst = true,
			maxParticles = 50,
			boxMin = {0.0, 0.0, 0.0},
			boxMax = {0.0, 0.0, 0.0},
			sprayAngle = {0,360},
			velocity = {0,3},
			objectSpace = true,
			texture = "assets/textures/particles/torch_flame.tga",
			frameRate = 35,
			frameSize = 64,
			frameCount = 16,
			lifetime = {0.4,0.6},
			color0 = {1, 0.9, 0.7},
			opacity = 1,
			fadeIn = 0.1,
			fadeOut = 0.3,
			size = {1, 2},
			gravity = {0,0,0},
			airResistance = 0.5,
			rotationSpeed = 2,
			blendMode = "Additive",
		},

		-- glow
		{
			spawnBurst = true,
			emissionRate = 1,
			emissionTime = 0,
			maxParticles = 1,
			boxMin = {0,0,-0.1},
			boxMax = {0,0,-0.1},
			sprayAngle = {0,30},
			velocity = {0,0},
			texture = "assets/textures/particles/glow.tga",
			lifetime = {0.5, 0.5},
			colorAnimation = false,
			color0 = {1.500000, 1, 1},
			opacity = 1,
			fadeIn = 0.01,
			fadeOut = 0.5,
			size = {4, 4},
			gravity = {0,0,0},
			airResistance = 1,
			rotationSpeed = 2,
			blendMode = "Additive",
		}
	}
}

In items.lua:

Code: Select all

defineObject{
	name = "scroll_wizards_fire",
	class = "Item",
	uiName = "Scroll of Wizard's Fire",
	description = "A very powerful fire blast eminating from the fingers of a wizard.\n\nUses all remining energy with an attack power based on the\nenergy consumed.",
	model = "assets/models/items/scroll_spell.fbx",
	gfxIndex = 113,
	scroll = true,
	spell = "wizards_fire",
	weight = 0.3
}

defineObject{
	name = "scroll_wizards_life_fire",
	class = "Item",
	uiName = "Scroll of Wizard's Life Fire",
	description = "An incredibly powerful fire blast summoned when a wizard\ngives up their very soul to fuel the blast.",
	model = "assets/models/items/scroll_spell.fbx",
	gfxIndex = 113,
	scroll = true,
	spell = "wizards_life_fire",
	weight = 0.3
}

In sounds.lua:

Code: Select all

defineSound{
    name = "wizards_fire",
    filename = "mod_assets/sounds/wizards_fire.wav",
    loop = false,
    volume = 0.5,
    minDistance = 1,
    maxDistance = 5,
}

In monsters.lua:

Code: Select all

local monstersList = {"crab","crowern","cube","goromorg","green_slime","herder","herder_big","herder_small","herder_swarm","ice_lizard","ogre","scavenger","scavenger_swarm","shrakk_torr","skeleton_archer","skeleton_archer_patrol","skeleton_patrol","skeleton_warrior","snail","spider","tentacles","uggardian","warden","wyvern"
}

for i=1,# monstersList do
  cloneObject{
    name = monstersList[i],
    baseObject = monstersList[i],
    onProjectileHit = function(monster, weapon)
      return fxScripts.applyDamage(monster, weapon)
    end,
  }
end

The final step is to create the actual spells, so in spells.lua:

Code: Select all

defineSpell{
   name = "wizards_fire",
   uiName = "Wizard's Fire",
   skill = "fire_magic",
   level = 0,
   runes = "AF",
   manaCost = 10,
   onCast = function(caster, x, y, direction, skill)
        playSound("fireball_launch", party.level, x, y)
        playSound("wizards_fire", party.level, x, y)
        local dx,dy = getForward(party.facing)
        local e = caster:getStat("energy")
        shootProjectile("wizards_fire_ball", party.level, x,y, direction, 20, 0, 0, 0, 0, 0, 0, party, true)
        caster:setStat("energy", 0)
        for ent in entitiesAt(party.level, party.x, party.y) do
            if ent.name == "wizards_fire_ball" then
                fxScripts.addProjectileEffect(ent, "wizards_fire", 20, "wizards_fire_hit")
				if skill >= 5 then
					fxScripts.addProjectileManualHit(caster, ent, e * 3, "fire", 1)
				else
					fxScripts.addProjectileManualHit(caster, ent, 50, "fire", 1)
				end
            end
        end
    end,
}

defineSpell{
   name = "wizards_life_fire",
   uiName = "Wizard's Life Fire",
   skill = "fire_magic",
   level = 0,
   runes = "ABF",
   manaCost = 0,
   onCast = function(caster, x, y, direction, skill)
        playSound("fireball_launch", party.level, x, y)
        playSound("wizards_fire", party.level, x, y)
        local dx,dy = getForward(party.facing)
        shootProjectile("wizards_life_fire_ball", party.level, x,y, direction, 20, 0, 0, 0, 0, 0, 0, party, true)
        
        for ent in entitiesAt(party.level, party.x, party.y) do
            if ent.name == "wizards_life_fire_ball" then
                fxScripts.addProjectileEffect(ent, "wizards_life_fire", 20, "wizards_fire_hit")
				fxScripts.addProjectileManualHit(caster, ent, 100 * skill, "fire", 1)
            end
        end
        
        local pronoun = "her"
        if caster:getSex() == "male" then
            pronoun = "his"
        end
        playSound("fireball_launch", party.level, x, y)
        caster:damage(caster:getStat("health") + 10, "physical")
        caster:setStat("energy", 0)
        hudPrint(caster:getName() .. " sacrifices " .. pronoun .. " life to cast \"Wizard's Life Fire,\" an immensly powerful fireball infused")
        hudPrint("with " .. pronoun .." very soul.")
    end,
}
I have tried to test these spells as extensively as possible, but I can't catch everything. Please try them out and let me know your feedback. I understand they are ridiculously over-powered in many respects, but they work best in dungeons with many swarms of monsters and very few healing stones and places to rest. The exact amounts of damage can easily be edited in spells.lua by changing the addProjectileManualHit(...) lines.

If you want to do a quick test of the spells, I have also created a simple test dungeon with them implemented: https://dl.dropbox.com/u/25424803/Legen ... ungeon.zip
Last edited by CrazyGage on Wed Nov 14, 2012 6:47 am, edited 1 time in total.
Post Reply