Page 3 of 21

Re: New Spells >> show them off here

Posted: Sat Oct 06, 2012 3:42 pm
by Montis
Blichew wrote:Fan of Knives

Credits go to JohnWordsworth who had a problem with this one :P
spellcraft level and/or mana cost need to be adjusted
SpoilerShow

Code: Select all

defineSpell{
	name = "knives",
	uiName = "Fan of Knives",
	skill = "spellcraft",
	level = 1,
	runes = "AC",
	manaCost = 5,
	onCast = function(champ, x, y, direction, skill)
		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("throwing_knife", party.level, x+modif, y, party.facing, 12+(modif*2), 1.5, 1, 0, 0, 0, 1, false, true)
			end
		else
			for modif = -0.5,0.5,0.1 do
				shootProjectile("throwing_knife", party.level, x, y+modif, party.facing, 12+(modif*2), 1.5, 1, 0, 0, 0, 1, false, true)
			end
		end
	end
}
I'm curious (and lazy): can you actually pick up the shot projectiles afterwards?

Re: New Spells >> show them off here

Posted: Sat Oct 06, 2012 4:00 pm
by Grimwold
Montis wrote:
Blichew wrote:Fan of Knives

Credits go to JohnWordsworth who had a problem with this one :P
spellcraft level and/or mana cost need to be adjusted
SpoilerShow

Code: Select all

defineSpell{
	name = "knives",
	uiName = "Fan of Knives",
	skill = "spellcraft",
	level = 1,
	runes = "AC",
	manaCost = 5,
	onCast = function(champ, x, y, direction, skill)
		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("throwing_knife", party.level, x+modif, y, party.facing, 12+(modif*2), 1.5, 1, 0, 0, 0, 1, false, true)
			end
		else
			for modif = -0.5,0.5,0.1 do
				shootProjectile("throwing_knife", party.level, x, y+modif, party.facing, 12+(modif*2), 1.5, 1, 0, 0, 0, 1, false, true)
			end
		end
	end
}
I'm curious (and lazy): can you actually pick up the shot projectiles afterwards?
I tested this and you can't.

They also don't do very much damage... it was doing a bunch of zeros to skeletons and maybe 0-2s against snails.

Re: New Spells >> show them off here

Posted: Sat Oct 06, 2012 4:15 pm
by flatline
Caliginous Curse

Area effect curse, hits the squares next to you. Costs HP to cast, damage varies from little to huge, low mana cost.
Tried to amplify monsters shadows by creating a light below them as they are hit. Unfortunately, FX lights don't give me as much control as if I spawned a particle_effect below them so I might work in that.
Might also try to make a poison effect where the cursed monsters gradually lose HP.


Does anyone know the name of the darkness spell? I want it to be cast simultaneously but only last for a few seconds.

Code: Select all

defineObject{
       name = "curse_fire",
       class = "FX",
       editorIcon = 88,
}

defineSpell{
   name = "curse",
   uiName = "Caliginous Curse",
   skill = "spellcraft",
   level = 1,
   runes = "DEF",
   manaCost = 10,
   onCast = function(champ, x, y, direction, skill)
	hudPrint(champ:getName().." pulls life force to strengthen the spell")
      damageTile(party.level, party.x, party.y, party.facing, 1, "physical", (5+(skill/2)))
     local newy = party.y
     local newx = party.x
     local north = party.y -1
     local west = party.x -1
     local south = party.y +1
     local east = party.x +1
	damageTile(party.level, newx, north, party.facing, 1, "physical", math.random(1,10)*(skill*2))
	damageTile(party.level, west, newy, party.facing, 1, "physical", math.random(1,10)*(skill*2))
	damageTile(party.level, newx, south, party.facing, 1, "physical", math.random(1,10)*(skill*2))
	damageTile(party.level, east, newy, party.facing, 1, "physical", math.random(1,10)*(skill*2))
        party:playScreenEffect("party_crush")
		spawn("curse_fire", party.level, party.x, party.y-1, party.facing, "x11")
		spawn("curse_fire", party.level, party.x+1, party.y, party.facing, "x22")
		spawn("curse_fire", party.level, party.x, party.y+1, party.facing, "x33")
		spawn("curse_fire", party.level, party.x-1, party.y, party.facing, "x44")
		x11:setLight(1,1,1,100,5,2,true)
		x22:setLight(1,1,1,100,5,2,true)
		x33:setLight(1,1,1,100,5,2,true)
		x44:setLight(1,1,1,100,5,2,true)	
	end,
}

Re: New Spells >> show them off here

Posted: Sat Oct 06, 2012 5:11 pm
by JohnWordsworth
Grimwold wrote:
Montis wrote:
Blichew wrote:Fan of Knives
I'm curious (and lazy): can you actually pick up the shot projectiles afterwards?
I tested this and you can't.
They also don't do very much damage... it was doing a bunch of zeros to skeletons and maybe 0-2s against snails.
It's easy to modify the 'fan of knives' so that you can pickup the knives afterwards, and so that it does more damage! In my spell compendium, I will be using the following parameters for shootProjectile,

Code: Select all

shootProjectile("throwing_knife", party.level, x, y+modif, party.facing, 12+(modif*2), 1.5, 1, 0, 0, 0, 20, party, false)
The last parameter determines whether the projectile hangs around afters, and the 20 is the new damage. This feels about fair. I also made it ignore the party, as it would sometimes hit the party! In my version, I've changed modif so that there are only 5 blades too...

Code: Select all

for modif = -0.5,0.5,0.2 do

Re: New Spells >> show them off here

Posted: Sat Oct 06, 2012 6:14 pm
by Blichew
Mine had a few 'placeholders' (like too low dmg and so on). Too bad there's no possibility to modify 3d offset to shoot let's say 3x3 knives or something like that. Nice addition would be reagent requirement. It should be easily doable:)

Re: New Spells >> show them off here

Posted: Sat Oct 06, 2012 8:05 pm
by Merethif
flatline wrote:Caliginous Curse
Major flaw: Characters are not receiving any EX with monsters killed by that spell.
Minor flaw: No sound effect. From default sounds I think "poison_cloud" would be most suitable? It sounds sinister enough for a curse.
JohnWordsworth wrote:It's easy to modify the Fan of Knives so that you can pickup the knives afterwards, and so that it does more damage! In my spell compendium, I will be using the following parameters for shootProjectile
Actually the spell that creates five real daggers is a bit risky. Remember the guy who were carrying all legionary spears and shields through all the levels? His game lost stability with too many objects.

Also, when I've cast that spell in corridor the rightmost dagger flew only one tile and fall to the ground.

Re: New Spells >> show them off here

Posted: Sat Oct 06, 2012 8:16 pm
by flatline
Merethif wrote:
flatline wrote:Caliginous Curse
Major flaw: Characters are not receiving any EX with monsters killed by that spell.
Minor flaw: No sound effect. From default sounds I think "poison_cloud" would be most suitable? It sounds sinister enough for a curse.
JohnWordsworth wrote:It's easy to modify the Fan of Knives so that you can pickup the knives afterwards, and so that it does more damage! In my spell compendium, I will be using the following parameters for shootProjectile
Actually the spell that creates five real daggers is a bit risky. Remember the guy who were carrying all legionary spears and shields through all the levels? His game lost stability with too many objects.

Also, when I've cast that spell in corridor the rightmost dagger flew only one tile and fall to the ground.
Thanks, didn't think about the XP thing. Might have to change it to 4 burst spell effects instead.

*EDIT*
Forgot about the bitfield part of damageTile command, since every hero contributes HP to the spell, everyone gets XP now. I reckon I could use champion.GetOrdinnal to isntruct it to only award the caster with XP but this works fine as it is.

Re: New Spells >> show them off here

Posted: Sat Oct 06, 2012 8:33 pm
by Blichew
If you want to create knives with fan of knives you can use math random function to create a knife for one 'spawn' line, not all of them, or with a chance like 15% or so. This shouldn't unbalance thr mod too much

Re: New Spells >> show them off here

Posted: Thu Oct 11, 2012 5:06 pm
by Grimwold
I'm super stoked about this one as it took a lot of scripting to get it work, but the effect is cool.
Push Monster
An air magic spell.. currently level 0 with a mana cost of 20 and two runes. Feel free to tweak it how you want.

The basic idea is that the monster directly in front of you is teleported one space away from the party in the same direction. This gives you enough time to either close a door, or sneak forward and potentially get out of a dead end. Because of the complex nature of the spell I have built it up using functions, so there is a minimal amount to put in spells.lua, a script_entity that needs placing in the editor and a custom monster to add to monsters.lua.

spells.lua

Code: Select all

-- Monster Pushback Spell
defineSpell{
   name = "pushback",
   uiName = "Push Monster",
   skill = "air_magic",
   level = 0,
   runes = "CF",
   manaCost = 20,
   onCast = function(caster, x, y, direction, skill)
     return pushback_spell_script.pushbackSpell(caster,x,y,direction,skill)
end,
}
monsters.lua

Code: Select all

cloneObject{
   name = "teleport_probe",
   baseObject = "snail",
}

script entity called pushback_spell_script

Code: Select all

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

function pushDestroy()
  push_teleport:destroy()
  push_timer:destroy()
end


function monsterThere(level,eggs,why)
  local allMonsters = {"crab", "crowern", "goromorg", "green_slime", "herder", "herder_big", "herder_small", "herder_swarm", "ice_lizard", "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 true
    end
  end
  return false
end

function isValidTarget(L,X,Y)
spawn("spawner", L, X, Y, 0, "probe"):setSpawnedEntity("teleport_probe"):activate()
   for j in entitiesAt(L,X,Y) do
      if j.name == "teleport_probe" 
      then
         probe:destroy()
         j:destroy()
         return true
      end
   end
probe:destroy()
return false
end


function pushbackSpell(caster,x,y,dir,skill)
  local dx,dy = getForward(dir)
  if monsterThere(party.level,x+dx,y+dy)
  then
    -- hudPrint("Monster!")
    if isValidTarget(party.level,x+2*dx,y+2*dy)
    then
      hudPrint("PUSH!!!!")
      --    spawn("fx", party.level, x+dx, y+dy, dir, "push_smoke")
      --      :setParticleSystem("push_spell")
      --      :translate(0, 0.5, 0)
      playSoundAt("fireball_launch",party.level,x+dx,y+dy)
      spawn("teleporter", party.level, x+dx,y+dy,dir, "push_teleport")
        :setTeleportTarget(x+2*dx,y+2*dy, dir)
        :setTriggeredByParty(false)
        :setTriggeredByMonster(true)
        :setTriggeredByItem(false)
        :setChangeFacing(true)
        :setInvisible(true)
        :setSilent(true)
        :setHideLight(true)
        :setScreenFlash(false)
      spawn("timer",party.level,x,y,dir,"push_timer")
        :setTimerInterval(0.1)
        :addConnector("activate", "pushback_spell_script", "pushDestroy")
        :activate()
    else
      hudPrint("The spell fails because there is something in the way.")
    end
  else
    hudPrint("The spell fails because there is no monster to push")  
  end
end

credits:
To test for a valid destination, I used a bit of Edsploration's code from this thread:
viewtopic.php?f=14&t=3631


Optional Particle Effect

To use the optional particle effect you will need to uncomment the 3 lines relating to spawn FX in the script above and add the following to a particles.lua file

Code: Select all

defineParticleSystem{
	name = "push_spell",
	emitters = {

		{
			spawnBurst = true,
			maxParticles = 40,
			sprayAngle = {0,100},
			velocity = {0.8,2},
			objectSpace = false,
			texture = "assets/textures/particles/smoke_01.tga",
			lifetime = {0.3,1},
			color0 = {0.8, 0.9, 1.8},
			opacity = 0.3,
			fadeIn = 0.1,
			fadeOut = 0.3,
			size = {0.4, 0.7},
			gravity = {0,0,0},
			airResistance = 2,
			rotationSpeed = 2,
			blendMode = "Translucent",
		},

		-- 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.0, 1.0, 1.8},
			opacity = 0.5,
			fadeIn = 0.01,
			fadeOut = 0.5,
			size = {1, 1},
			gravity = {0,0,0},
			airResistance = 1,
			rotationSpeed = 2,
			blendMode = "Additive",
		}
	}
}
Make sure that you include an IMPORT for your particles.lua file in the init.lua file

Re: New Spells >> show them off here

Posted: Thu Oct 11, 2012 6:15 pm
by Merethif
Grimwold wrote: Push Monster
Amazing. I love your spells.

I'm not sure if above spell should work on Tentacles though?