• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua 0.4 | Monster fields

STONARD

New Member
Joined
Aug 7, 2022
Messages
28
Reaction score
4
I am in search of if you take for example a dragon 'boss' he shoots lets say, 2x2 sqm of fire fields(id:1487), and they dont get removed untill he is dead and or despawned.
He should throw them at 90%, 60% and 30% health, at random places within his reach.

thanks, S
 
local objectId = 1487 -- ID del objeto que se creará local area = { {x = pos.x - 3, y = pos.y - 3, z = pos.z}, {x = pos.x + 3, y = pos.y + 3, z = pos.z} } local function removeObject(creature) local remove = false for x = area[1].x, area[2].x do for y = area[1].y, area[2].y do local tile = Tile(x, y, area[1].z) if tile then for i = 1, #tile:getItems() do local item = tile:getItem(i) if item and item:getId() == objectId then item:remove() remove = true end end end end end end local function checkHealth(creature) if creature:getHealth() <= creature:getMaxHealth() * 0.9 and creature:getHealth() > creature:getMaxHealth() * 0.6 then onCastSpell(creature, 0) elseif creature:getHealth() <= creature:getMaxHealth() * 0.6 and creature:getHealth() > creature:getMaxHealth() * 0.3 then onCastSpell(creature, 0) elseif creature:getHealth() <= creature:getMaxHealth() * 0.3 then onCastSpell(creature, 0) end end function onCastSpell(creature, variant) local pos = creature:getPosition() for x = area[1].x, area[2].x do for y = area[1].y, area[2].y do local tile = Tile(x, y, area[1].z) if tile then local item = Game.createItem(objectId, 1, tile:getPosition()) if item then item:setActionId(1000) end end end end creature:registerEvent("removeObject") creature:registerEvent("checkHealth") return true end

Put in your Bossmonster.xml
<script>
<event name="removeObject"/>
<event name="checkHealth"/>
</script>
 
Back
Top