Re: Ask a simple question, get a simple answer
Posted: Wed Jun 08, 2016 3:57 am
After defining a few new spells I've noticed that the party isn't credited for the kill, as if the monster was killed by 'natural' means.
How do I make custom spells credit the kill to the party?
Another issue I have with spells is that when I tell them to spawn an entity, they do even if its inside/behind a wall. How do I make them check if the tile they are meant to spawn in is free, and if not them spawn it on the parties location? (Like Ice Shards do)
Here's an example of one of the spells:
How do I make custom spells credit the kill to the party?
Another issue I have with spells is that when I tell them to spawn an entity, they do even if its inside/behind a wall. How do I make them check if the tile they are meant to spawn in is free, and if not them spawn it on the parties location? (Like Ice Shards do)
Here's an example of one of the spells:
Code: Select all
-- Firewall --
defineSpell{
name = "fireWall",
uiName = "Firewall",
gesture = 14,
manaCost = 25,
skill = "fire_magic",
-- requirements = { "fire_magic", 1},
icon = 60,
spellIcon = 1,
description = "Summons forth a fiery wall to incinerate your foes",
onCast = function(champ, x, y, direction, skill)
local dx,dy = getForward(party.facing)
for i = 0, 10 do
if findEntity("firewall_spell"..i) == nil then
spawn("wall_fire", party.level, party.x+dx, party.y+dy, direction, party.elevation, "firewall_spell"..i)
return
end
end
end,
}