The effect requires three things:
- You have to clone the party object in init.lua for the dungeon, and override the onMove and onDamage hooks:
Code: Select all
cloneObject {
name = "party",
baseObject = "party",
onMove = function(party, dir)
var_storage.set_last_level(party.level)
var_storage.decrement_feather()
return true
end,
onDamage = function(champion, dmg, dmgtype)
if party.level ~= var_storage.get_last_level() then
if var_storage.get_feather() then
-- Feather fall
return false
end
end
return true
end
}
Now, place a scripting object called 'var_storage' somewhere in the dungeon, with the following code on it:
Code: Select all
last_level = 1
feather_fall = false
feather_dur = 0
function set_feather(dur)
feather_fall = true
feather_dur = dur
hudPrint("You feel lighter.")
end
function decrement_feather()
if feather_fall == true then
feather_dur = feather_dur - 1
if feather_dur <= 0 then
feather_fall = false
hudPrint("You feel heavier.")
end
end
end
function get_feather()
return feather_fall
end
function set_last_level(lev)
last_level=lev
end
function get_last_level()
return last_level
end
In principle this setup could be used to create any number of custom conditions or persistent spell effects. I'm not sure yet how to give graphical feedback for the effects, but ostensibly you could do something with creating a light source with particle system and move it with the party so long as the effect is up, then destroying it when the effect ends. I think it'd be weird with teleporters and pitfalls though, since there you move after onMove is done.