shockBlast spell

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
RayB
Posts: 140
Joined: Fri Mar 06, 2015 3:45 am

shockBlast spell

Post by RayB »

I have tried to create some BLAST spells like Lex did in his Gothmog mod. I decided to create the BLAST spells for each element, (air, earth, fire and ice). I had already created a frostburst spell to fire with ruin I. I have had great success with all but shock.
All of the blast spells work just fine when I try them in my mod. But the shockBlast spell does not. In fact, it crashes the editor and I end up at the desktop. Can anyone tell me why this is so?

The script I used in my spells.lua file is the same for all the blast spells except for the spell names and attributes, skill, level, mana cost etc. The script I used is as follows...

defineSpell{
name = "shockBlast",
uiName = "Shock Blast",
skill = "air_magic",
level = 10,
runes = "CDF",
manaCost = 33,
onCast = function(champ,x,y,dir,sk)
local xlr, ylr = 0, 0
local xt, yt = getForward(dir) -- get the x & y offset to move 1 tile ahead
if xt == 0 then xlr = 1 else ylr = 1 end
xt = x+xt yt = y+yt --xt & yt = x & y party is headed to
if isWall(party.level,xt,yt) then
spawn("shock",party.level,x,y,0)
else
spawn("shock",party.level,xt,yt,0)
spawn("shock",party.level,xt - xlr,yt - ylr,0)
spawn("shock",party.level,xt + xlr,yt + ylr,0)
end
end,
}

Like I said it works fine for all the spells except shock.
User avatar
Zo Kath Ra
Posts: 944
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: shockBlast spell

Post by Zo Kath Ra »

I know you're not using the "sk" parameter, but according to the http://www.grimrock.net/modding/scripting-reference/ the parameters are:
onCast(champion, x, y, direction, elevation, skillLevel)
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: shockBlast spell

Post by minmay »

Zo Kath Ra wrote:I know you're not using the "sk" parameter, but according to the http://www.grimrock.net/modding/scripting-reference/ the parameters are:
onCast(champion, x, y, direction, elevation, skillLevel)
not in grimrock 1
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
Zo Kath Ra
Posts: 944
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: shockBlast spell

Post by Zo Kath Ra »

RayB wrote:But the shockBlast spell does not. In fact, it crashes the editor and I end up at the desktop. Can anyone tell me why this is so?
Replace "shock" with "shockburst" in the spawn calls.

The error message even complains about it:

Code: Select all

mod_assets/scripts/spells.lua:23: undefined object: shock
stack traceback:
	[C]: in function 'error'
	[string "ScriptEntity.lua"]: in function 'spawn'
	mod_assets/scripts/spells.lua:23: in function 'onCast'
	[string "Spells.lua"]: in function 'castSpell'
	[string "Champion.lua"]: in function 'castSpell'
	[string "AttackPanel.lua"]: in function 'update'
	[string "AttackPanel.lua"]: in function 'update'
	[string "Gui.lua"]: in function 'draw'
	[string "GameMode.lua"]: in function 'update'
	[string "DungeonEditor.lua"]: in main chunk
	[C]: in function 'xpcall'
	[string "DungeonEditor.lua"]: in function 'preview'
	[string "DungeonEditor.lua"]: in function 'update'
	[string "Grimrock.lua"]: in main chunk
stack traceback:
	[C]: in function 'error'
	[string "DungeonEditor.lua"]: in function 'handleError'
	[string "DungeonEditor.lua"]: in function 'preview'
	[string "DungeonEditor.lua"]: in function 'update'
	[string "Grimrock.lua"]: in main chunk
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: shockBlast spell

Post by minmay »

if you just spawn shockbursts then they won't give the party xp for kills, which is awful. instead you want to make fake shockbursts with no damage (probably just fx objects and playSoundAt) and use damageTile for the damage, unless you're using a different hack to give xp for all kills
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Post Reply