New Spells >> show them off here

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
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 »

Currann wrote:The only problem is, whenever i try to cast it, my game editor crashes. Also, i downloaded the assets v2 on the website, but was unsure where to put them, so i stuck it in my mod_assets folder.
Ah.. the asset pack is only for reference, it needs to be put somewhere out of the way... and certainly not in your mod_assets folder.

EDIT - As far as your spell definition goes, I tested it in my dungeon and it crashed.. unfortunately I think you are trying to change things that are hardcoded in the original game... but there may be another way to do what you want.
Szragodesca
Posts: 59
Joined: Sun Oct 14, 2012 7:13 am

Re: New Spells >> show them off here

Post by Szragodesca »

Currann wrote:Sorry to bother you again, but i'm still having some trouble with my spell. My goal is to make a fireball spell that acts like ice shards, but does fire damage with a fireball visual.

So i put the following into my dungeons spells.lua:
SpoilerShow

Code: Select all

defineSpell{
		name = "fireball",
		uiName = "Unstoppable Fireball",
		skill = "fire_magic",
		level = 1,
		runes = "E",
		manaCost = 30,
		onCast = "fireball",
	}
and i put the next code box into my objects.lua:

Code: Select all

cloneObject{
		name = "fireball",
		baseObject = "ice_shards",
		particleEffect = "fireball_greater",
		sound = "fireball",
		uiName = "Unstoppable Fireball",
		attackPower = 30,
		damageType = "fire",
	}
The only problem is, whenever i try to cast it, my game editor crashes. Also, i downloaded the assets v2 on the website, but was unsure where to put them, so i stuck it in my mod_assets folder.
*hid quoted code in spoiler to save room*

Is it because you named it and the clone the same as an existing spell? You're defining a spell that already exists, aren't you? "fireball"? What if you change the name to "unstoppable_fireball" in both codes?

Example:
SpoilerShow

Code: Select all

defineSpell{
		name = "unstoppable_fireball",
		uiName = "Unstoppable Fireball",
		skill = "fire_magic",
		level = 1,
		runes = "E",
		manaCost = 30,
		onCast = "fireball",
	}
and i put the next code box into my objects.lua:

Code: Select all

cloneObject{
		name = "unstoppable_fireball",
		baseObject = "ice_shards",
		particleEffect = "fireball_greater",
		sound = "fireball",
		uiName = "Unstoppable Fireball",
		attackPower = 30,
		damageType = "fire",
	}
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: New Spells >> show them off here

Post by akroma222 »

Hey folks!
Nice spells :-) I have managed to get: Heal party, Fan of Knives, Create food and Calignous Curse to work no dramas! THANK YOU (loving the idea of more and more spells)

@Bilchew- I also managed to get Enchant Arrow to work fine (only while arrows are on cursor, as instructed) - but - is there any way to get the spell to enchant while they are held in the characters hands?? The editor crashes with no error message when I try to do this..... :shock:

Also - 1. wondering how I make spell scrolls explaining the runes needed for these new spells - I have noticed each scroll in the items.lua file use gfx 113 - how would one create new scrolls with according runes??
and 2. is there any way possible to include these new spells into the champion's skill/level/bonus sheet ??
User avatar
Blichew
Posts: 157
Joined: Thu Sep 27, 2012 12:39 am

Re: New Spells >> show them off here

Post by Blichew »

akroma222 wrote: @Bilchew- I also managed to get Enchant Arrow to work fine (only while arrows are on cursor, as instructed) - but - is there any way to get the spell to enchant while they are held in the characters hands?? The editor crashes with no error message when I try to do this..... :shock:

Also - 1. wondering how I make spell scrolls explaining the runes needed for these new spells - I have noticed each scroll in the items.lua file use gfx 113 - how would one create new scrolls with according runes??
As for Enchant Arrow:
Of course it is possible, you have to check for party:getChampion(caster):getItem(7) and party:getChampion(caster):getItem(8) item names. Just check them as I've checked mouseItem. "caster" is the first parameter in onCast function.

As for scrolls with rune combinations. You have to define a new object in items.lua, like this:

Code: Select all

defineObject{
	name = "scroll_enchant_arrow",
	class = "Item",
	uiName = "Scroll of Enchant Arrow",
	model = "assets/models/items/scroll_spell.fbx",
	gfxIndex = 113,
	scroll = true,
	spell = "enchant_arrow",
	weight = 0.3,
}
Rune combination will be automatically put on the scroll, that's why there's spell = "enchant_arrow", line inside the obj definition.
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: New Spells >> show them off here

Post by akroma222 »

Ahh thanks for your speedy reply... got the scrolls sorted ;)
With regards to changing the Enchant Arrow script - might need a little further help - not sure exactly how to do this..
SpoilerShow
defineSpell{
name = "enchant_arrow",
uiName = "Enchant Arrow",
skill = "spellcraft",
level = 10,
runes = "DF",
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 party:getChampion(caster):getItem(7) and party:getChampion(caster):getItem(8).name ~= "arrow"party:getChampion(caster):getItem(8) then
hudPrint("You have to cast this spell while holding an arrow in your hand.")
else
local size = party:getChampion(caster):getItem(7) and party:getChampion(caster):getItem(8):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,
}
Just not sure exactly where to insert the correct checking code (sorry!! :| )
User avatar
Blichew
Posts: 157
Joined: Thu Sep 27, 2012 12:39 am

Re: New Spells >> show them off here

Post by Blichew »

Try this (didn't test it yet)
SpoilerShow

Code: Select all

defineSpell{
	name = "enchant_arrow",
	uiName = "Enchant Arrow",
	skill = "spellcraft",
	level = 10,
	runes = "DF",
	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 party:getChampion(caster):getItem(7).name ~= "arrow" or party:getChampion(caster):getItem(8).name ~= "arrow" then
			hudPrint("You have to cast this spell while holding an arrow in your hand.")
		else
			if party:getChampion(caster):getItem(7).name = "arrow" then
				local slot = 7
				local size = party:getChampion(caster):getItem(7):getStackSize()
				--setMouseItem(spawn(arrowType):setStackSize(size))
				--playSound("generic_spell")
			elseif party:getChampion(caster):getItem(8).name ~= "arrow" then
				local size = party:getChampion(caster):getItem(8):getStackSize()
				local slot = 8
			end
			party:getChampion(caster):removeItem(slot)
			party:getChampion(caster):insertItem(slot,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,
}
Also, please use [ code ] [/ code] tags when inserting a code, it's easier to read :)
Or even use

Code: Select all

[spoiler][code]
[/spoiler][/code]
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: New Spells >> show them off here

Post by akroma222 »

Hey! Thanks heaps for that, the editor is still crashing with no error message - but now I understand where you meant me to replace the coding
(I also needed to make the '=' on line 14 a '==' before the editor would load up).
I am off to sleep now, but will play around with the new code soon, thanks again for the nudge hey!!! :)
User avatar
Currann
Posts: 7
Joined: Mon Oct 15, 2012 3:38 am

Re: New Spells >> show them off here

Post by Currann »

Szragodesca wrote:
Currann wrote:Sorry to bother you again, but i'm still having some trouble with my spell. My goal is to make a fireball spell that acts like ice shards, but does fire damage with a fireball visual.

So i put the following into my dungeons spells.lua:
SpoilerShow

Code: Select all

defineSpell{
		name = "fireball",
		uiName = "Unstoppable Fireball",
		skill = "fire_magic",
		level = 1,
		runes = "E",
		manaCost = 30,
		onCast = "fireball",
	}
and i put the next code box into my objects.lua:

Code: Select all

cloneObject{
		name = "fireball",
		baseObject = "ice_shards",
		particleEffect = "fireball_greater",
		sound = "fireball",
		uiName = "Unstoppable Fireball",
		attackPower = 30,
		damageType = "fire",
	}
The only problem is, whenever i try to cast it, my game editor crashes. Also, i downloaded the assets v2 on the website, but was unsure where to put them, so i stuck it in my mod_assets folder.
*hid quoted code in spoiler to save room*

Is it because you named it and the clone the same as an existing spell? You're defining a spell that already exists, aren't you? "fireball"? What if you change the name to "unstoppable_fireball" in both codes?

Example:
SpoilerShow

Code: Select all

defineSpell{
		name = "unstoppable_fireball",
		uiName = "Unstoppable Fireball",
		skill = "fire_magic",
		level = 1,
		runes = "E",
		manaCost = 30,
		onCast = "fireball",
	}
and i put the next code box into my objects.lua:

Code: Select all

cloneObject{
		name = "unstoppable_fireball",
		baseObject = "ice_shards",
		particleEffect = "fireball_greater",
		sound = "fireball",
		uiName = "Unstoppable Fireball",
		attackPower = 30,
		damageType = "fire",
	}
That is probably it, but wouldnt calling the spell to cast "fireball" instead of "unstoppable_fireball" not do anything different? Either way, i tried the code, and my editor gives my a Warning saying "Warning! unkown buit-in-spell: unstoppable_fireball
User avatar
Blichew
Posts: 157
Joined: Thu Sep 27, 2012 12:39 am

Re: New Spells >> show them off here

Post by Blichew »

akroma222 wrote:Hey! Thanks heaps for that, the editor is still crashing with no error message - but now I understand where you meant me to replace the coding
(I also needed to make the '=' on line 14 a '==' before the editor would load up).
I am off to sleep now, but will play around with the new code soon, thanks again for the nudge hey!!! :)
Yeah, forgot that == instead of = ;)

Can you post the contents of your C:\Users\{YOU}\Documents\Almost Human\Legend of Grimrock\error.log ? Those first few lines only, not the system specs. It should help narrowing down what's causing the error.
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 »

Currann wrote: That is probably it, but wouldnt calling the spell to cast "fireball" instead of "unstoppable_fireball" not do anything different? Either way, i tried the code, and my editor gives my a Warning saying "Warning! unkown buit-in-spell: unstoppable_fireball
I had a bit of a look at this last night but didn't get chance to post anything. Most things I tried either didn't work or crashed the game... So it looks like you can't do things quite how you want.

Using

Code: Select all

onCast = "fireball"
specifically calls a built-in spell called fireball (this uses but does not refer specifically to the object definition for fireball.

so putting

Code: Select all

onCast = "unstoppable_fireball"

will never work because unstoppable_fireball is not a built-in spell.

Also, while you can re-define the fireball object and perhaps tweak a few parameters, it's clear that the built-in portion of fireball is looking for some specific settings that it doesn't find if you try to replace it with, say, ice_shards.

So it looks to me like there isn't a shortcut to what you want to do and I'm convinced that your best bet is to define a new spell called unstoppable_fireball and actually script the spell within the onCast hook.

e.g.

Code: Select all

onCast = function(caster,x,y,facing,skill)
 -- script your spell here
 -- e.g. spawn("unstoppable_fireball",x,y,facing)
end
unfortunately this may mean re-inventing the wheel.
Post Reply