Page 4 of 21

Re: New Spells >> show them off here

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

I'm not sure if above spell should work on Tentacles though?
Ha! I never thought about that. Will test it to see what happens and maybe adjust the monster list.

Re: New Spells >> show them off here

Posted: Thu Oct 11, 2012 10:56 pm
by Xanathar
My first spell & contribution to the modding community:

CREATE FOOD

Creates a random piece of food - requires Spellcraft 14 and 20 mana.

On a separate note - I'm still undecided if utility spells should be in the spellcraft school (as per light/darkness) or to enrich one of the elementals (to counterbalance invisibility).

Code: Select all

-- Create Food spell
defineSpell{
	name = "create_food_spell",
	uiName = "Create Food",
	skill = "spellcraft",
	level = 14,
	runes = "EF",
	manaCost = 20,
	onCast = function(caster, x, y, direction, skill)
		if getMouseItem() == nil then
			local rand = math.random(5)
			local obj
			
			if rand == 1 then obj = "ice_lizard_steak"
			elseif rand == 2 then obj = "baked_maggot"
			elseif rand == 3 then obj = "boiled_beetle"
			elseif rand == 4 then obj = "rat_shank"
			else obj = "pitroot_bread"
			end
			
			setMouseItem(spawn(obj))
		end
	end
}

Re: New Spells >> show them off here

Posted: Thu Oct 11, 2012 11:16 pm
by Blichew
@Xanathar

If I may, I'd change your spell a bit so it would be easier to add new types of food to be spawned with it. So here it goes:

I've also added your version of the spell to our wiki @ http://grimwiki.net (http://grimwiki.net/wiki/Create_Food_Spell)

Code: Select all

defineSpell{
	name = "create_food_spell",
	uiName = "Create Food",
	skill = "spellcraft",
	level = 14,
	runes = "EF",
	manaCost = 20,
	onCast = function(caster, x, y, direction, skill)
		local foodList = {"ice_lizard_steak", "baked_maggot", "boiled_beetle", "rat_shank", "pitroot_bread"}
		if getMouseItem() == nil then
			local obj = foodList[math.random(1,#foodList)]
			setMouseItem(spawn(obj))
		end
	end,
}

Re: New Spells >> show them off here

Posted: Thu Oct 11, 2012 11:37 pm
by Xanathar
Thanks!
Didn't know of the wiki (and neither that there were alread create food spells there :) ).

Re: New Spells >> show them off here

Posted: Thu Oct 11, 2012 11:58 pm
by Merethif
Xanathar wrote:Thanks!
Didn't know of the wiki (and neither that there were alread create food spells there :) ).
The spells that creates food in mage's hand, rather then on the floor, is a way more spiffy IMO :-D Especially since it is random food.

BTW,
Grimwold, when I'm trying to cast Push Monster in editor it quits. Any idea why? Anyone has similar problem?

Re: New Spells >> show them off here

Posted: Fri Oct 12, 2012 12:21 am
by Blichew
I've created an "Enchant Arrow" spell (separate from original Enchant Fire Arrow Spell. It has to be cast while holding (mouseItem) arrow(s). What it does it randomly enchants arrow(s) by replacing them with fire, cold, etc. Feel free to change, I've decided to go with spellcraft level 5 and mana cost of 20.

Enchant Arrow

Code: Select all

defineSpell{
	name = "enchant_arrow",
	uiName = "Enchant Arrow",
	skill = "spellcraft",
	level = 5,
	runes = "AF",
	manaCost = 20,
	onCast = function(caster, x, y, direction, skill)
		local arrowList = {"cold", "fire", "poison", "shock"}
		local rnd = math.random(1,#arrowList)
		local arrowType = arrowList[rnd].."_arrow"
		if getMouseItem().name ~= "arrow" then
			hudPrint("You have to cast this spell while holding an arrow in your hand (cursor)")
		else
			local size = getMouseItem():getStackSize()
			setMouseItem(spawn(arrowType):setStackSize(size))
			playSound("generic_spell")
			if size > 1 then
				hudPrint(caster:getName().." enchanted "..size.." arrows into "..arrowList[rnd].." arrows")
			else
				hudPrint(caster:getName().." enchanted arrow into "..arrowList[rnd].." arrow")
			end
		end
	end,
}

Re: New Spells >> show them off here

Posted: Fri Oct 12, 2012 12:41 am
by Grimwold
Merethif wrote:Grimwold, when I'm trying to cast Push Monster in editor it quits. Any idea why? Anyone has similar problem?
Does the game crash out completely, or are you returned to the editor screen? If the second, are there any messages in the script?

Did you add the teleport_probe monster to your monsters.lua file?

I actually re-created the spell on my home PC using only what I posted here and got it to work ok. (Since I forgot to copy my original files from my office PC to my googleDrive!!)

Re: New Spells >> show them off here

Posted: Fri Oct 12, 2012 12:59 am
by Merethif
Grimwold wrote:
Merethif wrote:Grimwold, when I'm trying to cast Push Monster in editor it quits. Any idea why? Anyone has similar problem?
Does the game crash out completely, or are you returned to the editor screen? If the second, are there any messages in the script?

Did you add the teleport_probe monster to your monsters.lua file?

I actually re-created the spell on my home PC using only what I posted here and got it to work ok. (Since I forgot to copy my original files from my office PC to my googleDrive!!)
Ok, I know what I was doing wrong. I forgot to rename script entity from script_entity_3 to pushback_spell_script (facepalm).
Now it works like a charm.

Re: New Spells >> show them off here

Posted: Fri Oct 12, 2012 1:12 am
by Grimwold
Merethif wrote:
Grimwold wrote:
Merethif wrote:Grimwold, when I'm trying to cast Push Monster in editor it quits. Any idea why? Anyone has similar problem?
Does the game crash out completely, or are you returned to the editor screen? If the second, are there any messages in the script?

Did you add the teleport_probe monster to your monsters.lua file?

I actually re-created the spell on my home PC using only what I posted here and got it to work ok. (Since I forgot to copy my original files from my office PC to my googleDrive!!)
Ok, I know what I was doing wrong. I forgot to rename script entity from script_entity_3 to pushback_spell_script (facepalm).
Now it works like a charm.
Great. That was the other thing I was going to suggest.

Re: New Spells >> show them off here

Posted: Fri Oct 12, 2012 1:53 am
by Grimwold
I've added a sound effect to the Push Monster Spell above... there's now also an Optional Particle Effect, which requires some particle definition code to be added to the lua files (I use a particles.lua file and add an import line in init.lua)