Page 1 of 1

Scripting Problem with custom Spells

Posted: Sun Nov 05, 2017 9:45 pm
by Resu
Hey Guys.

I imported a few Spells from Grimworld. They work great and are awesome. But however.. I am not able to make the following item script work because the program shuts down after trying.
SpoilerShow
defineObject{
name = "party",
class = "Party",
editorIcon = 32,
onAttack = function(champ, weapon)


if (weapon ~= nil) and (weapon.name == "sword_of_exmple") then

if party.facing == 0 then
spawn("fire_storm", party.level, party.x, party.y-1, party.facing)
end
if party.facing == 1 then
spawn("fire_storm", party.level, party.x+1, party.y, party.facing)
end
if party.facing == 2 then
spawn("fire_storm", party.level, party.x, party.y+1, party.facing)
end
if party.facing == 3 then
spawn("fire_storm", party.level, party.x-1, party.y, party.facing)
end
end
This works fine with non imported spells tho.
Does anyone know the reason of the cash and how i can solve it?

Cheers, Resu

Re: Scripting Problem with custom Spells

Posted: Sun Nov 05, 2017 10:31 pm
by Isaac
When it crashes, check the error log file.

Re: Scripting Problem with custom Spells

Posted: Sun Nov 05, 2017 10:40 pm
by Resu
Isaac wrote:When it crashes, check the error log file.
when i do it in the editor, there is no log. Should i try it ingame? Is that different?

Re: Scripting Problem with custom Spells

Posted: Sun Nov 05, 2017 10:49 pm
by Isaac
It can be different, yes. Check the log file. It's in the game/editor folder, in your documents folder.

Re: Scripting Problem with custom Spells

Posted: Sun Nov 05, 2017 11:09 pm
by Resu
ok i found the file.
SpoilerShow
mod_assets/scripts/items.lua:1276: undefined object: fire_storm
stack traceback:
[C]: in function 'error'
[string "ScriptEntity.lua"]: in function 'spawn'
mod_assets/scripts/items.lua:1276: in function 'onAttack'
[string "Champion.lua"]: in main chunk
[string "Champion.lua"]: in function 'attack'
[string "AttackPanel.lua"]: in function 'select'
[string "AttackPanel.lua"]: in function 'drawItemSlot'
[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
so yeah.. sure fire_storm is an undefined object... but how can I define it? how can it be undefined when my champions can cast it?

Re: Scripting Problem with custom Spells

Posted: Mon Mar 19, 2018 7:06 pm
by Resu
still need Help with this :cry:

Does anyone know how to define custom spells properly?

Cheers