Reusing Flasks
Posted: Tue Nov 27, 2012 7:47 pm
Hello all,
Dont know if someone has posted this already but if you want to be able to reuse flasks like in the original DM then here is the code that will spawn one in front of the party on the floor.
It will work even if you are facing a wall. It spawns an empty flask in the same square as the party and you wont have to find a new flask everytime you want to make a new healing pot.
Just add this code
if party.facing == 0 then
spawn("flask", party.level, party.x, party.y, party.facing)
end
if party.facing == 1 then
spawn("flask", party.level, party.x, party.y, party.facing)
end
if party.facing == 2 then
spawn("flask", party.level, party.x, party.y, party.facing)
end
if party.facing == 3 then
spawn("flask", party.level, party.x, party.y, party.facing)
end
where I have inserted it below.
defineObject{
name = "potion_healinghi",
class = "Item",
uiName = "High Healing Potion",
model = "assets/models/items/flask_full.fbx",
gfxIndex = 146,
consumable = true,
potion = true,
weight = 0.6,
onUseItem = function(self, champion)
playSound("consume_potion")
champion:modifyStat("health", 125)
if party.facing == 0 then
spawn("flask", party.level, party.x, party.y, party.facing)
end
if party.facing == 1 then
spawn("flask", party.level, party.x, party.y, party.facing)
end
if party.facing == 2 then
spawn("flask", party.level, party.x, party.y, party.facing)
end
if party.facing == 3 then
spawn("flask", party.level, party.x, party.y, party.facing)
end
return true
end,
}
Thx,
LG
Dont know if someone has posted this already but if you want to be able to reuse flasks like in the original DM then here is the code that will spawn one in front of the party on the floor.
It will work even if you are facing a wall. It spawns an empty flask in the same square as the party and you wont have to find a new flask everytime you want to make a new healing pot.
Just add this code
if party.facing == 0 then
spawn("flask", party.level, party.x, party.y, party.facing)
end
if party.facing == 1 then
spawn("flask", party.level, party.x, party.y, party.facing)
end
if party.facing == 2 then
spawn("flask", party.level, party.x, party.y, party.facing)
end
if party.facing == 3 then
spawn("flask", party.level, party.x, party.y, party.facing)
end
where I have inserted it below.
defineObject{
name = "potion_healinghi",
class = "Item",
uiName = "High Healing Potion",
model = "assets/models/items/flask_full.fbx",
gfxIndex = 146,
consumable = true,
potion = true,
weight = 0.6,
onUseItem = function(self, champion)
playSound("consume_potion")
champion:modifyStat("health", 125)
if party.facing == 0 then
spawn("flask", party.level, party.x, party.y, party.facing)
end
if party.facing == 1 then
spawn("flask", party.level, party.x, party.y, party.facing)
end
if party.facing == 2 then
spawn("flask", party.level, party.x, party.y, party.facing)
end
if party.facing == 3 then
spawn("flask", party.level, party.x, party.y, party.facing)
end
return true
end,
}
Thx,
LG
