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 »

Heal Character - lowest percentage health
(now with different Runes)
requires spellcraft level 16, costs 20 mana and heals a single character with the lowest percentage health by 2 to 4 times the level of the caster.
SpoilerShow

Code: Select all


-- Character Healing Spell
defineSpell{
   name = "healing",
   uiName = "Healing",
   skill = "spellcraft",
   level = 16,
   runes = "BF",
   manaCost = 20,
   onCast = function(caster, x, y, direction, skill)
     local heal_amount = math.random(2,4)*skill
     local character_to_heal = 5
     local least_health = 10000
     local max_health = 10000
     local percentage_health = 100
     local champName = "No-one"
     for j=1,4 do
       if party:getChampion(j):getEnabled() and party:getChampion(j):isAlive()
       then
         if party:getChampion(j):getStat("health") / party:getChampion(j):getStatMax("health") * 100 < percentage_health
         then
           least_health = party:getChampion(j):getStat("health")
           max_health = party:getChampion(j):getStatMax("health")
           percentage_health = least_health / max_health * 100
           character_to_heal = j
         end
       end
     end
     if (character_to_heal < 5)
     then
       champName = party:getChampion(character_to_heal):getName()
       party:getChampion(character_to_heal):modifyStat("health", heal_amount)
     end
--     hudPrint(champName .. " has " .. tostring(least_health) .. " of " .. tostring(max_health))
     hudPrint(champName .. " was healed.")
   playSound("heal_party")
   party:playScreenEffect("frostburst")
   end,
}

Last edited by Grimwold on Wed Oct 24, 2012 11:46 am, 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 »

When I need to text things, I use my handy xpsnail

Code: Select all

cloneObject{
	name = "xpsnail",
	baseObject = "snail",
	health = 1,
	exp = 9999999,
}
"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!
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 »

Neikun wrote:When I need to text things, I use my handy xpsnail

Code: Select all

cloneObject{
	name = "xpsnail",
	baseObject = "snail",
	health = 1,
	exp = 9999999,
}
Thanks for that. very handy. Although I've just discovered you can modify characters using the console.
open console
type e.g. party:getChampion(4):addSkillPoints(25)
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: New Spells >> show them off here

Post by Komag »

whoa, didn't know that one! that's much more direct and straightforward than setting up the xpsnail type of thing
Finished Dungeons - complete mods to play
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 »

Combined Healing Spell
(now with different Runes)
Requires spellcraft level 16... heals party member with the lowest percentage health by 2,3,or 4 times skill of caster
After spellcraft level 24 ... heals whole party by 1.5,1.75 or 2 times level of caster
SpoilerShow

Code: Select all

-- Party Healing spell
defineSpell{
   name = "healing",
   uiName = "Healing",
   skill = "spellcraft",
   level = 16,
   runes = "BF",
   manaCost = 20,
   onCast = function(caster, x, y, direction, skill)
     local character_to_heal = 5
     local least_health = 10000
     local max_health = 10000
     local percentage_health = 100
     local champName = "No-one"
     if skill < 24
     then 
       local heal_amount = math.random(2,4)*skill
       for j=1,4 do
         if party:getChampion(j):getEnabled() and party:getChampion(j):isAlive()
         then
           if party:getChampion(j):getStat("health") / party:getChampion(j):getStatMax("health") * 100 < percentage_health
           then
             least_health = party:getChampion(j):getStat("health")
             max_health = party:getChampion(j):getStatMax("health")
             percentage_health = least_health / max_health * 100
             character_to_heal = j
           end
         end
       end
       if (character_to_heal < 5)
       then
         champName = party:getChampion(character_to_heal):getName()
         party:getChampion(character_to_heal):modifyStat("health", heal_amount)
       end
       -- hudPrint(champName .. " has " .. tostring(least_health) .. " of " .. tostring(max_health))
       hudPrint(champName .. " was healed by " .. caster:getName())
     else
       local heal_amount = math.random(6,8) /4 *skill
       for i=1,4 do
         party:getChampion(i):modifyStat("health", heal_amount)
       end
     hudPrint(caster:getName() .. " healed the party")
     end
     playSound("heal_party")
     party:playScreenEffect("frostburst")
   end,
}
Last edited by Grimwold on Wed Oct 24, 2012 11:47 am, edited 1 time in total.
User avatar
Trap
Posts: 67
Joined: Mon Sep 24, 2012 2:09 am

Re: New Spells >> show them off here

Post by Trap »

very cool, good job ;p
User avatar
Merethif
Posts: 274
Joined: Tue Apr 24, 2012 1:58 pm
Location: Poland

Re: New Spells >> show them off here

Post by Merethif »

Really impressive!

Personally I'd make this spell comes with Staff Defence rather the Spellcraft though, as I always see healing as a spell suitable for those armoured, well protected, first row magic-users (cleric/druid types). Also I really do think that Staff Defence need some love too ;-)

Anyway I'm looking forward for your further creations.
User avatar
Blichew
Posts: 157
Joined: Thu Sep 27, 2012 12:39 am

Re: New Spells >> show them off here

Post by Blichew »

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
}
Lollgramoth
Posts: 35
Joined: Fri Jun 15, 2012 7:31 am
Location: Germany

Re: New Spells >> show them off here

Post by Lollgramoth »

There is actually a posability to target a single Hero out of your group.

If the spell is cast, it gives you an Item onto the mouse. If this item is found in the hand slots of a Hero or in his inventory he gets healed by the amount the spell said. The items need to get back to the right Positions. And after all the mess is cleared, it would appear that everything happend at it should. There is no blank spot where the leftclick has no effect, so it allways will be in the hands or in the inventory. Have fun.

I tried that, but the game crashes without warning if you spawn an item in a spell or if you call a function which spawns an item out of a spell.

What do I do wrong?

The code:

Code: Select all

-- Character Healing Spell
defineSpell{
   name = "healing",
   uiName = "Healing",
   skill = "spellcraft",
   level = 1,
   runes = "EF",
   manaCost = 20,
   onCast = function(caster, x, y, direction, skill)
     local healIcon = spawn(healwave_item)
   end,
}
Bucnasti
Posts: 22
Joined: Mon Sep 24, 2012 12:41 am

Re: New Spells >> show them off here

Post by Bucnasti »

I created a replacement for the light spell. It creates a stationary light object in the player square which lasts for 30 seconds, if the spell is recast it deletes the existing object and creates a new one. Makes the light spell useful but not a permanent solution.

Mage Light

Code: Select all

defineSpell{
   name = "light",
   uiName = "Magic Light",
   skill = "spellcraft",
   level = 5,
   runes = "BE",
   manaCost = 15,
   onCast = function()
		if findEntity("spell_light") then
			print("spell light exists, destroying")
			spell_light:destroy()
			spell_light_timer:destroy()
		end
	print("spawning a new spell_light")
	spawn("spell_torchlight", party.level, party.x, party.y, party.facing, "spell_light")
	spawn("timer", party.level, party.x, party.y, party.facing, "spell_light_timer")
	playSound("generic_spell")
	spell_light_timer:setTimerInterval(30)
	spell_light_timer:addConnector("activate", "spell_light", "deactivate") 
	spell_light_timer:activate()
	end,
}
Post Reply