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 »

Some interesting new spells here thanks for sharing. I will give them all a try when I can.

Apologies for not being around very much at the moment... we had a new baby last week, and my wife is recovering from the c-section surgery, so I am a very busy husband/father.

One thing I will just mention... for these new attack spells.. is the correct amount of XP credited to the caster if/when the monster dies (i.e. a full share not half share)... so far the only way I found to get XP to work properly is to use damageTile to deal the damage and spawn the spell visual effects separately. My Burn Monster spell uses damageTile, and JKos wrote a good explanation of how to use this function - viewtopic.php?f=14&t=3861&p=39726#p40130
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 »

cromcrom wrote: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 :-)
Really glad you like them and are using them in your mod. Very cool that you are including my username in the spell description :)
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 »

Congratulations (life won't be the same now. Ever.), all my wishes of fast recovery to your wife :-)
A trip of a thousand leagues starts with a step.
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: New Spells >> show them off here

Post by akroma222 »

You guys are KINGS! hehehe

Cromcrom - thank you so much! The spell works great :D now to just add some sounds and screen effects etc.... I have replicated a version for each element:
SpoilerShow

Code: Select all

defineSpell{
  name = "flame_wind", 
  uiName = "Flame Wind", 
  skill = "fire_magic",
  level = 0,
  runes = "ABC",
  manaCost = 30,
  onCast = function(caster, x, y, direction, skill)
  	party:playScreenEffect("fireball_screen")
	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,
}

defineSpell{
  name = "flash_freeze", 
  uiName = "Flash Freeze", 
  skill = "ice_magic",
  level = 0,
  runes = "CFI",
  manaCost = 30,
  onCast = function(caster, x, y, direction, skill)
	for i = x-1,x+1 do 
	for j = y-1,y-1 do
		spawn("frostburst",party.level,i,j,direction)
	end
  end
	for i = x-1,x+1 do 
	for j = y+1,y+1 do
		spawn("frostburst",party.level,i,j,direction)
	end
  end
		spawn("frostburst",party.level,x-1,y,direction)
		spawn("frostburst",party.level,x+1,y,direction)
  end,
}

defineSpell{
  name = "deadly_vapors", 
  uiName = "Deadly Vapors", 
  skill = "earth_magic",
  level = 0,
  runes = "BCG",
  manaCost = 30,
  onCast = function(caster, x, y, direction, skill)
	for i = x-1,x+1 do 
	for j = y-1,y-1 do
		spawn("poison_cloud",party.level,i,j,direction)
	end
  end
	for i = x-1,x+1 do 
	for j = y+1,y+1 do
		spawn("poison_cloud",party.level,i,j,direction)
	end
  end
		spawn("poison_cloud",party.level,x-1,y,direction)
		spawn("poison_cloud",party.level,x+1,y,direction)
  end,
}

defineSpell{
  name = "sheet_lightning", 
  uiName = "Sheet Lightning", 
  skill = "air_magic",
  level = 0,
  runes = "BC",
  manaCost = 30,
  onCast = function(caster, x, y, direction, skill)
	for i = x-1,x+1 do 
	for j = y-1,y-1 do
		spawn("shockburst",party.level,i,j,direction)
	end
  end
	for i = x-1,x+1 do 
	for j = y+1,y+1 do
		spawn("shockburst",party.level,i,j,direction)
	end
  end
		spawn("shockburst",party.level,x-1,y,direction)
		spawn("shockburst",party.level,x+1,y,direction)
  end,
}

The skill level is set = 0 and mana cost is low... change at your will ;) I am glad you liked the haste and bezerk spells - they are probably the easiest spell to make! but I am happy that I got it to work LOL

CrazyGage - wizard fire and life fire are fantastic too!! Good to see some new visuals :D Definitely adding them to fire spells and you to the credits ;)

Grimwold!! Congratulations on the new arrival!! :D
Got burn push and hold online now, nice spells indeed, thankyou!
Last edited by akroma222 on Wed Nov 14, 2012 8:06 am, edited 1 time in total.
CrazyGage
Posts: 2
Joined: Tue Nov 13, 2012 9:56 pm

Re: New Spells >> show them off here

Post by CrazyGage »

Grimwold wrote:Some interesting new spells here thanks for sharing. I will give them all a try when I can.

Apologies for not being around very much at the moment... we had a new baby last week, and my wife is recovering from the c-section surgery, so I am a very busy husband/father.

One thing I will just mention... for these new attack spells.. is the correct amount of XP credited to the caster if/when the monster dies (i.e. a full share not half share)... so far the only way I found to get XP to work properly is to use damageTile to deal the damage and spawn the spell visual effects separately. My Burn Monster spell uses damageTile, and JKos wrote a good explanation of how to use this function - viewtopic.php?f=14&t=3861&p=39726#p40130
Good point on the XP note. I forgot to include that. I modified my original spell posting to include the XP.
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, Trying to add your burn monster spell into TLC, I ran into a missing function issue. I might be alone here, but in any case, here is the modification:

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)
  local allMonsters = { "crab", "crowern", "goromorg", "green_slime", "herder", "herder_big", "herder_small", "herder_swarm", "ice_lizard", "molt_slime", "ogre", "scavenger", "scavenger_swarm", "shrakk_torr", "skeleton_archer", "skeleton_archer_patrol", "skeleton_warrior", "snail", "spider", "uggardian", "warden", "wyvern"}
  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()
  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
A trip of a thousand leagues starts with a step.
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 »

cromcrom wrote:GrimWold, Trying to add your burn monster spell into TLC, I ran into a missing function issue. I might be alone here, but in any case, here is the modification:
You are quite correct.. I missed copying the isInTable() function because it is common to the other spells. I have corrected my original post.

The version uploaded to NexusMods (see my sig) should be correct.
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: New Spells >> show them off here

Post by akroma222 »

STAT-BUFFING SPELLS

First of all, major credits to CRISMAN for his assistance with these spells. The scripts and methods for these I merely adapted from his statistic buffing potion system. Thanks a lot champ!!
So, these spells are designed to raise champion statistics for a period of time and then lower them back to their pre-buff values.
For examples sake, I will use 3 of the spells I have made through this system.... This is what you do-

1. Paste these scripts into (mod assets/scripts/) objects.lua:
SpoilerShow

Code: Select all

defineSpell{
   name = "magic_shield",
   uiName = "Magic Shield",
   skill = "earth_magic",
   level = 10,
   runes = "FG",
   manaCost = 25,
   onCast = function(caster, x, y, direction, skill)
      return buffing_scripts.magicshield(caster,x,y,direction,skill)
   end,
}

defineSpell{
   name = "reflexion",
   uiName = "Reflexion",
   skill = "air_magic",
   level = 16,
   runes = "CF",
   manaCost = 55,
   onCast = function(caster, x, y, direction, skill)
      return buffing_scripts.reflexion(caster,x,y,direction,skill)
   end,
}

defineSpell{
   name = "repel_magic",
   uiName = "Repel Magic",
   skill = "spellcraft",
   level = 34,
   runes = "ACEGI",
   manaCost = 70,
   onCast = function(caster, x, y, direction, skill)
      return buffing_scripts.repelmagic(caster,x,y,direction,skill)
   end,
}
2. Create a lua script in any level of your dungeon mod, naming it "buffing_scripts" and paste this into it:
SpoilerShow

Code: Select all

------------------magic shield----------------------

function magicshield(caster,x,y,dir,skill)
   if findEntity("timer_magicshield"):isActivated() then
       return
   else
      for i = 1,4 do
            party:getChampion(i):modifyStatCapacity("protection", 10)
            party:getChampion(i):modifyStat("protection", 10)
			party:playScreenEffect("cold_glow")
	  end
		hudPrint("Magic Shield has been activated")
        findEntity("timer_magicshield"):activate()
        playSoundAt("goromorg_shield_hit",party.level,party.x,party.y)
   end
end

function stopmagicshield()
	for i = 1,4 do
		party:getChampion(i):modifyStatCapacity("protection", -10)
		party:getChampion(i):modifyStat("protection", -10)
		timer_magicshield:deactivate()
	end
		playSoundAt("goromorg_shield_break",party.level,party.x,party.y)
		hudPrint("Magic Shield has deactivated")
end

-------------------reflexion-------------------------

function reflexion(caster,x,y,dir,skill)
   if findEntity("timer_reflexion"):isActivated() then
       return
   else
      for i = 1,4 do
            party:getChampion(i):modifyStatCapacity("dexterity", 7)
            party:getChampion(i):modifyStat("dexterity", 7)
	    party:getChampion(i):modifyStatCapacity("evasion", 14)
            party:getChampion(i):modifyStat("evasion", 14)
	    party:playScreenEffect("cold_glow")
	  end
		hudPrint("Reflexion has been activated")
        findEntity("timer_reflexion"):activate()
        playSoundAt("blob_hit_receptor",party.level,party.x,party.y)
   end
end

function stopreflexion()
	for i = 1,4 do
		party:getChampion(i):modifyStatCapacity("dexterity", -7)
		party:getChampion(i):modifyStat("dexterity", -7)
		party:getChampion(i):modifyStatCapacity("evasion", -14)
		party:getChampion(i):modifyStat("evasion", -14)
		timer_reflexion:deactivate()
	end
		playSoundAt("goromorg_shield_break",party.level,party.x,party.y)
		hudPrint("Reflexion has deactivated")
end

-------------------repel magic-------------------------

function repelmagic(caster,x,y,dir,skill)
   if findEntity("timer_repelmagic"):isActivated() then
       return
   else
      for i = 1,4 do
            party:getChampion(i):modifyStatCapacity("resist_fire", 50)
            party:getChampion(i):modifyStat("resist_fire", 50)
			party:getChampion(i):modifyStatCapacity("resist_poison", 50)
            party:getChampion(i):modifyStat("resist_poison", 50)
			party:getChampion(i):modifyStatCapacity("resist_cold", 50)
            party:getChampion(i):modifyStat("resist_cold", 50)
			party:getChampion(i):modifyStatCapacity("resist_shock", 50)
            party:getChampion(i):modifyStat("resist_shock", 50)
			party:playScreenEffect("cold_glow")
      end
		hudPrint("Repel Magic has been activated")
        findEntity("timer_repelmagic"):activate()
        playSoundAt("teleport",party.level,party.x,party.y)
   end
end

function stoprepelmagic()
	for i = 1,4 do
		party:getChampion(i):modifyStatCapacity("resist_fire", -50)
		party:getChampion(i):modifyStat("resist_fire", -50)
		party:getChampion(i):modifyStatCapacity("resist_poison", -50)
		party:getChampion(i):modifyStat("resist_poison", -50)
		party:getChampion(i):modifyStatCapacity("resist_cold", -50)
		party:getChampion(i):modifyStat("resist_cold", -50)
		party:getChampion(i):modifyStatCapacity("resist_shock", -50)
		party:getChampion(i):modifyStat("resist_shock", -50)
		timer_repelmagic:deactivate()
	end
		playSoundAt("goromorg_shield_break",party.level,party.x,party.y)
		hudPrint("Repel Magic has deactivated")
end
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?

4. Add 1 connector from each timer to "buffing_scripts" - (activate> buffing_scripts> stop'..........')
.....example - add a connector from timer_magicshield to buffing scripts - (activate> buffing_scripts> stopmagicshield)

5. Paste the following into (mod assets/scripts/) particles.lua:
SpoilerShow

Code: Select all

defineParticleSystem{
   name = "cold_glow",
   emitters = {
      -- fog
      {
         emissionRate = 10,
         emissionTime = 3,
         maxParticles = 1000,
         boxMin = {-0.5, -1.25,-0.5},
         boxMax = { 0.5, 1.25, 0.5},
         sprayAngle = {0,360},
         velocity = {0.1,0.2},
         objectSpace = true,
         texture = "assets/textures/particles/fog.tga",
         lifetime = {3,3},
         color0 = {0.152941, 0.352941, 0.803922},
         opacity = 1,
         fadeIn = 2.2,
         fadeOut = 2.2,
         size = {1.5, 1.5},
         gravity = {0,0,0},
         airResistance = 0.1,
         rotationSpeed = 0.3,
         blendMode = "Additive",
      },

      -- stars
      {
         emissionRate = 200,
         emissionTime = 3,
         maxParticles = 1000,
         boxMin = {-0.6, -1,-0.6},
         boxMax = { 0.6, 1, 0.6},
         sprayAngle = {0,360},
         velocity = {0.2,0.2},
         objectSpace = true,
         texture = "assets/textures/particles/teleporter.tga",
         lifetime = {1,1},
         color0 = {3.0,3.0,3.0},
         opacity = 1,
         fadeIn = 0.1,
         fadeOut = 0.1,
         size = {0.05, 0.13},
         gravity = {0,0,0},
         airResistance = 0.1,
         rotationSpeed = 2,
         blendMode = "Additive",
      }
   }
}
NOTE: This is a custom particle effect that has been made by one of us (not me)... Unfortunately I can not recall who made this particle system, please claim credit if it is you ;)

Further - if you wish to modify the colour of the glow effect, simply change the RGB scalings for "Colour0".... example for magic shield:
SpoilerShow

Code: Select all

defineParticleSystem{
   name = "cold_glow_magicshield",
   emitters = {
      -- fog
      {
         emissionRate = 10,
         emissionTime = 3,
         maxParticles = 1000,
         boxMin = {-0.5, -1.25,-0.5},
         boxMax = { 0.5, 1.25, 0.5},
         sprayAngle = {0,360},
         velocity = {0.1,0.2},
         objectSpace = true,
         texture = "assets/textures/particles/fog.tga",
         lifetime = {3,3},
         color0 = {0.452941, 0.352941, 0.103922},
         opacity = 1,
         fadeIn = 2.2,
         fadeOut = 2.2,
         size = {1.5, 1.5},
         gravity = {0,0,0},
         airResistance = 0.1,
         rotationSpeed = 0.3,
         blendMode = "Additive",
      },

      -- stars
      {
         emissionRate = 200,
         emissionTime = 3,
         maxParticles = 1000,
         boxMin = {-0.6, -1,-0.6},
         boxMax = { 0.6, 1, 0.6},
         sprayAngle = {0,360},
         velocity = {0.2,0.2},
         objectSpace = true,
         texture = "assets/textures/particles/teleporter.tga",
         lifetime = {1,1},
         color0 = {3.0,3.0,3.0},
         opacity = 1,
         fadeIn = 0.1,
         fadeOut = 0.1,
         size = {0.05, 0.13},
         gravity = {0,0,0},
         airResistance = 0.1,
         rotationSpeed = 2,
         blendMode = "Additive",
      }
   }
}
Further again, if you wish to change the sound effects or hudPrint which trigger when buffing spells are activated and deactivated, simply change the "playSoundAt" or "hudPrint" parts in the "buffing spells" script in your dungeon mod.

6. Buff your party!! :D The scripts are very easy to alter to suit your buffing needs, just make sure if you modify (increase) a stat in the activation function to re-modify (decrease) it in the stop/deactivation function. Enjoy!!
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: New Spells >> show them off here

Post by akroma222 »

AREA OF EFFECT SPELLS

These spells are credited to CROMCROM (as above posts would suggest!) for his script in damaging monsters 1 space away from the party. Thanks again ;)
I have further adapted the scripts to damage monsters 2 spaces away (and given them some familiar names I will wager...)
What to do:

1.Paste these scripts into objects.lua:
SpoilerShow

Code: Select all

defineSpell{
  name = "flame_wind", 
  uiName = "Flame Wind", 
  skill = "fire_magic",
  level = 0,
  runes = "ABC",
  manaCost = 45,
  onCast = function(caster, x, y, direction, skill)
  party:playScreenEffect("fireball_screen")
  	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
	for i = x-2,x+2 do 
	for j = y-2,y-2 do
		spawn("fireburst",party.level,i,j,direction)
	end
  end
	for i = x-2,x+2 do 
	for j = y+2,y+2 do
		spawn("fireburst",party.level,i,j,direction)
	end
  end
	for i = x-2,x+2 do 
	for j = y-1,y+1 do
		spawn("fireburst",party.level,i,j,direction)
	end
  end	
	spawn("fireburst",party.level,x-2,y,direction)
	spawn("fireburst",party.level,x+2,y,direction)
	spawn("fireburst",party.level,x-1,y,direction)
	spawn("fireburst",party.level,x+1,y,direction)
  end,
}

defineSpell{
  name = "flash_freeze", 
  uiName = "Flash Freeze", 
  skill = "ice_magic",
  level = 0,
  runes = "CFI",
  manaCost = 45,
  onCast = function(caster, x, y, direction, skill)
	for i = x-1,x+1 do 
	for j = y-1,y-1 do
		spawn("frostburst",party.level,i,j,direction)
	end
  end
	for i = x-1,x+1 do 
	for j = y+1,y+1 do
		spawn("frostburst",party.level,i,j,direction)
	end
  end
	for i = x-2,x+2 do 
	for j = y-2,y-2 do
		spawn("frostburst",party.level,i,j,direction)
	end
  end
	for i = x-2,x+2 do 
	for j = y+2,y+2 do
		spawn("frostburst",party.level,i,j,direction)
	end
  end
	for i = x-2,x+2 do 
	for j = y-1,y+1 do
		spawn("frostburst",party.level,i,j,direction)
	end
  end	
	spawn("frostburst",party.level,x-2,y,direction)
	spawn("frostburst",party.level,x+2,y,direction)
	spawn("frostburst",party.level,x-1,y,direction)
	spawn("frostburst",party.level,x+1,y,direction)
  end,
}


defineSpell{
  name = "deadly_vapors", 
  uiName = "Deadly Vapors", 
  skill = "earth_magic",
  level = 0,
  runes = "BCG",
  manaCost = 45,
  onCast = function(caster, x, y, direction, skill)
	for i = x-1,x+1 do 
	for j = y-1,y-1 do
		spawn("poison_cloud",party.level,i,j,direction)
	end
  end
	for i = x-1,x+1 do 
	for j = y+1,y+1 do
		spawn("poison_cloud",party.level,i,j,direction)
	end
  end
	for i = x-2,x+2 do 
	for j = y-2,y-2 do
		spawn("poison_cloud",party.level,i,j,direction)
	end
  end
	for i = x-2,x+2 do 
	for j = y+2,y+2 do
		spawn("poison_cloud",party.level,i,j,direction)
	end
  end
	for i = x-2,x+2 do 
	for j = y-1,y+1 do
		spawn("poison_cloud",party.level,i,j,direction)
	end
  end	
	spawn("poison_cloud",party.level,x-2,y,direction)
	spawn("poison_cloud",party.level,x+2,y,direction)
	spawn("poison_cloud",party.level,x-1,y,direction)
	spawn("poison_cloud",party.level,x+1,y,direction)
  end,
}

defineSpell{
  name = "sheet_lightning", 
  uiName = "Sheet Lightning", 
  skill = "air_magic",
  level = 0,
  runes = "BC",
  manaCost = 45,
  onCast = function(caster, x, y, direction, skill)
	for i = x-1,x+1 do 
	for j = y-1,y-1 do
		spawn("shockburst",party.level,i,j,direction)
	end
  end
	for i = x-1,x+1 do 
	for j = y+1,y+1 do
		spawn("shockburst",party.level,i,j,direction)
	end
  end
	for i = x-2,x+2 do 
	for j = y-2,y-2 do
		spawn("shockburst",party.level,i,j,direction)
	end
  end
	for i = x-2,x+2 do 
	for j = y+2,y+2 do
		spawn("shockburst",party.level,i,j,direction)
	end
  end
	for i = x-2,x+2 do 
	for j = y-1,y+1 do
		spawn("shockburst",party.level,i,j,direction)
	end
  end	
	spawn("shockburst",party.level,x-2,y,direction)
	spawn("shockburst",party.level,x+2,y,direction)
	spawn("shockburst",party.level,x-1,y,direction)
	spawn("shockburst",party.level,x+1,y,direction)
  end,
}
2. Blow lots of monsters up!! (you will also need to adjust runes/skill level and costs to your suiting)

NOTE!! - I am likely to need some direction/help with how to handle damage tiles/EXP for this kind of spell. Any assistance would be appreciated...
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: New Spells >> show them off here

Post by akroma222 »

WHIPPING ROCKS
So I could not resist replicating one of my favourite Wiz8 spells, Whipping Rocks...
The script is based on Wordsworth/Blichew's Fan of Knives spell - so thank you to both of you!!!
I have also integrated this with Jkos' damage tile/magic missile tutorial, found here> viewtopic.php?f=14&t=3910
This is what you do:

1.Go here for whipping_rock model/texture files (including icon atlas just in case you want to use the item for non-spell purposes):
http://ge.tt/9JRv7eR ..... paste them into the appropriate lua files.

2. Paste this script into particles.lua:
SpoilerShow

Code: Select all

defineParticleSystem{
	name = "whipping_rocks",
	emitters = {
		-- sparks
		{
			emissionRate = 30,
			emissionTime = 0,
			maxParticles = 100,
			boxMin = {-0.015, 0.02, 0.015},
			boxMax = { 0.015, 0.1,  -0.015},
			sprayAngle = {0,180},
			velocity = {0.1, 2.4},
			texture = "assets/textures/particles/glow.tga",
			lifetime = {0.25, 0.85},
			colorAnimation = false,
			color0 = {1.5, 1.5, 1.5},
			opacity = 0.8,
			fadeIn = 0.15,
			fadeOut = 0.3,
			size = {0.01, 0.05},
			gravity = {0,0,0},
			airResistance = 1.0,
			rotationSpeed = 1,
			blendMode = "Additive",
			depthBias = -0.0005,
			objectSpace = true,
		},

		-- smoke
      		{
         		emissionRate = 10,
         		emissionTime = 1,
         		maxParticles = 10,
         		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 = 0.1,
         		fadeIn = 0.1,
         		fadeOut = 0.3,
         		size = {0.4, 0.6},
         		gravity = {0,0,0},
         		airResistance = 0.1,
         		rotationSpeed = 1,
         		blendMode = "Translucent",
      		}
	}
}
3.Paste this script into items.lua and spells.lua:
SpoilerShow

Code: Select all

defineObject{
    name = "whipping_rock",
    class = "Item",
    uiName = "Whipping Rock",
    model = "mod_assets/models/whipping_rock.fbx", 
    --ammoType = "rock",
    gfxAtlas = "mod_assets/textures/items-altered2.tga",
    gfxIndex = 96,
    attackPower = 1,
    impactSound = "fireball_hit",
    particleEffect = "whipping_rocks",
    stackable = false,
    sharpProjectile = false,
    projectileRotationY = 0,
    weight = 0.1,
}
4.Paste this script into objects.lua (changing runes/skill/cost to your needs):
SpoilerShow

Code: Select all

defineSpell{
   name = "whipping_rocks",
   uiName = "Whipping Rocks",
   skill = "earth_magic",
   level = 0,
   runes = "ACFG",
   manaCost = 5,
   onCast = function(champ, x, y, direction, skill)
      mymod_spells.castWhippingRocks(caster,x,y,direction,skill)
   end
}
NOTE! - You will see it calls the function outlined in Jkos' magic missile/damage tile tutorial... from here the spell will integrate with the tutorial...

5.Create a lua script on any level in your dungeon mod calling it "mymod_spells" (if you have not already got this from the tutorial), pasting this into it:
SpoilerShow

Code: Select all

----------------------Whipping Rocks-----------------------------------

function castWhippingRocks(caster,x,y,direction,skill)
	playSoundAt("swipe_heavy",party.level,party.x,party.y)
	playSoundAt("generic_spell",party.level,party.x,party.y)	
	local dx,dy = getForward(party.facing)
	local x,y = party.x + dx, party.y + dy
    if party.facing == 0 or party.facing == 2 then
    	for modif = -0.5,0.5,0.1 do
            shootProjectile("whipping_rock", party.level, x+modif, y, party.facing, 12+(modif*2), 1.5, 1, 0, 0, 0, 30, false, true)
        end
      else
        for modif = -0.5,0.5,0.1 do
            shootProjectile("whipping_rock", party.level, x, y+modif, party.facing, 12+(modif*2), 1.5, 1, 0, 0, 0, 30, false, true)
        end
    end
end

-------------------------------------------------------------------------

function customSpellOnProjectileHitHook(monster,projectile)
   if projectile.name == 'whipping_rock' or 'magic_missile' then
      local originator = 2 ^ (spellCaster+1) -- calculate the originator of the spell
      local damage = math.random(2,10) --
      damageTile(monster.level,monster.x,monster.y,(monster.facing + 2)%4,originator+1, 'physical',damage)
      playSoundAt("fireball_hit",monster.level,monster.x,monster.y)
      return false
   end
end
NOTE! - You will see that I have changed "magicMissileOnProjectileHitHook(monster,projectile)" to "customSpellOnProjectileHitHook(monster,projectile)" as well as change
"if projectile.name == 'magic_missile' then" to "if projectile.name == 'whipping_rock' or 'magic_missile' then" in order to be inclusive of both the magic missile and whipping rocks spells.
If you do not want to have the magic missile spell around then you can change this around to your liking.

6. As per the Jkos tutorial, paste this into monsters.lua to test the spell out on a given (snail here) monster:
SpoilerShow

Code: Select all

cloneObject{
      name = "snail",
      baseObject = "snail",
      onProjectileHit = function(monster,projectile)
         return mymod_spells.customSpellOnProjectileHitHook(monster,projectile)
      end
}
NOTE! - as the tutorial says, this must be replicated for each monster in your dungeon, or just use a 'for' loop with a monster list (on the to do list....)

7. Kill monsters with ore sized rocks! Conveniently, if you take down 1 monster with this spell, often other monsters behind it will be hit too :D

I think that is it... let me know if I forgot something..
EDIT: Aaaand I did - need to insert "spellCaster = caster:getOrdinal()" into the spell script somewhere, will get to this asap....
EDIT: Ok, having some trouble with this, not sure if it just me not knowing where to place "spellCaster = caster:getOrdinal()" or whether it is the fact that you are firing multiple projectiles at once... both fan of knives and whipping rocks will stop the preview in editor when they are about to hit a monster *unless* I have already fired off a magic missile (for which "spellCaster = caster:getOrdinal()" works just fine)..... Suggestions welcome....
Last edited by akroma222 on Sat Nov 17, 2012 1:38 pm, edited 2 times in total.
Post Reply