Here is code for a ressurection spell.
I will heal dead champions for 25 health
and do nothing for champions that are alive.
defineSpell{
name = "rez",
uiName = "Ressurection",
skill = "water_magic",
requirements = { "water_magic", 5, "earth_magic", 5 },
icon = 71,
spellIcon = 4,
gesture = 2365478,
manaCost = 150,
description = "Conjures a Light of Life that ressurects dead champions.",
onCast = function(champion, x, y, direction, elevation, skillLevel)
local dX,dY = getForward(party.facing) --Directional offsets
if party.map:isWall(party.x+dX, party.y+dY, party.elevation) then
dX,dY = 0,0 --Targets Party's cell if cast on a wall
end
--spell cast and tagged for the champion who cast it.
spawn("earthheal", party.level, party.x, party.y, party.facing, party.elevation)
local heal_amount = math.random(125,175)
hudPrint(champion:getName() .. " Casted Ressurection.")
for i=1,4 do
local c = party.party:getChampion(i)
if (c:getBaseStat("health") == 0) then
party.party:getChampion(i):modifyBaseStat("health", 25)
else
party.party:getChampion(i):modifyBaseStat("health", 0)
end
playSound("heal_party")
end
end
}
defineObject{
name = "earthheal",
baseObject = "base_spell",
components = {
{
class = "Particle",
particleSystem = "teleport_screen",
offset = vec(0, 1.5, 0),
},
{
class = "Light",
offset = vec(1.5, 1.0, 0),
color = vec(0.5, 0.5, 0.25),
brightness = 7,
range = 5,
fadeOut = 13,
disableSelf = true,
},
{
class = "CloudSpell",
attackPower = 0,
damageInterval = 2,
damageType = "fire",
duration = 1,
},
},
}
Ressurection spell code
Ressurection spell code
Dungeon Master and DOOM will live forever.
- Zo Kath Ra
- Posts: 937
- Joined: Sat Apr 21, 2012 9:57 am
- Location: Germany
Re: Ressurection spell code
I don't mean to sound rude, but this has been bothering me for a while.
Why do people post code without indentation?
Indentation makes it *much* easier to read.
I'd also recommend using the[/code]tags.
Code enclosed in these tags can be copied quickly:
1) CODE:SELECT ALL
2) Ctrl-C
Why do people post code without indentation?
Indentation makes it *much* easier to read.
I'd also recommend using the
Code: Select all
[code]
Code enclosed in these tags can be copied quickly:
1) CODE:SELECT ALL
2) Ctrl-C
Code: Select all
for i = 1, 5 do
hudPrint("Hello World!")
end
Re: Ressurection spell code
It's likely just unfamiliarity.Zo Kath Ra wrote:I don't mean to sound rude, but this has been bothering me for a while.
Why do people post code without indentation?
Indentation makes it *much* easier to read.
Indentation requires the tab key; afaik, forum software tends to strip out tabs and multiple spaces. One cannot use the tab key in the browser because it's used to change the focus.
Instead, one must generate [or copy/paste] the tab character to have indentation in manually typed code. When one pastes indented script into their post in or outside of code tags, it looks indented in the post-edit box, but if it's not wrapped in code tags, it gets stripped of its spaces and tabs when posted.