• 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!

Solved Fire Bomb, Help!

Sytoxian

New Member
Joined
Aug 19, 2010
Messages
40
Reaction score
1
Hey, i created a monster called Fire Bomb that executes this script. But when i spawn several Fire Bombs i get this error message:

Code:
[23/04/2015 12:03:56] [Error - CreatureScript Interface]
[23/04/2015 12:03:56] In a timer event called from:
[23/04/2015 12:03:56] data/creaturescripts/scripts/fire bomb.lua:onThink
[23/04/2015 12:03:56] Description:
[23/04/2015 12:03:56] (luaDoCreatureAddHealth) Creature not found

I know the following script isnt kept very short. excuse me for that!

Code:
function onThink(cid, interval)

target = getCreatureTarget(cid)
delay = 1200
delay2 = 400
delay3 = 800
stor = 47945
pos = getCreaturePosition(cid)
effect = 6
dmg = 1000

if getCreatureMaster(cid) > 0 then
dmg = ((getPlayerLevel(getCreatureMaster(cid)) + ((getPlayerLevel(getCreatureMaster(cid)) / 100) * getPlayerMagLevel(getCreatureMaster(cid))) + 50))
end

function calculatedmg(monster, damage, pos)
    if monster > 0 then
        if doCreatureAddHealth(monster, (-damage)) == true then
        doSendAnimatedText(pos, ""..damage.."", 144)
        return true
        end
    end
    return true
end
              
              
if isMonster(cid) and getCreatureName(cid) == "Fire Bomb" and target > 0 then
if getDistanceBetween(getCreaturePosition(cid), getCreaturePosition(target)) < 2 then
        if getCreatureStorage(cid, stor) < 1 then
        doCreatureSay(cid, "3", TALKTYPE_ORANGE_1)
        addEvent(doCreatureSay, delay2, cid, "2", TALKTYPE_ORANGE_1)
        addEvent(doCreatureSay, delay3, cid, "1", TALKTYPE_ORANGE_1)
        doChangeSpeed(cid, 0 - getCreatureSpeed(cid))
        addEvent(doRemoveCreature, delay, cid)
        addEvent(doCreatureSay, 1199, cid, "Boom!", TALKTYPE_ORANGE_1)
        doCreatureSetStorage(cid, stor, 1)
      
        area = {x = pos.x-1, y =pos.y, z = pos.z}
        creature = getTopCreature(area).uid
            if isWalkable(area, false, true, true) then
            addEvent(doSendMagicEffect, 1200, area, effect)
            addEvent(calculatedmg, 1200, creature, dmg, area)
            end  
        area = {x = pos.x+1, y =pos.y, z = pos.z}
        creature = getTopCreature(area).uid
            if isWalkable(area, false, true, true) then
            addEvent(doSendMagicEffect, 1200, area, effect)
            addEvent(calculatedmg, 1200, creature, dmg, area)
            end  
        area = {x = pos.x, y =pos.y-1, z = pos.z}
        creature = getTopCreature(area).uid
            if isWalkable(area, false, true, true) then
            addEvent(doSendMagicEffect, 1200, area, effect)
            addEvent(calculatedmg, 1200, creature, dmg, area)
            end  
        area = {x = pos.x, y =pos.y+1, z = pos.z}
        creature = getTopCreature(area).uid
            if isWalkable(area, false, true, true) then
            addEvent(doSendMagicEffect, 1200, area, effect)
            addEvent(calculatedmg, 1200, creature, dmg, area)
            end  
          
        area = {x = pos.x-2, y =pos.y, z = pos.z}
        creature = getTopCreature(area).uid
            if isWalkable(area, false, true, true) then
            addEvent(doSendMagicEffect, 1200, area, effect)
            addEvent(calculatedmg, 1200, creature, dmg, area)
            end  
        area = {x = pos.x+2, y =pos.y, z = pos.z}
        creature = getTopCreature(area).uid
            if isWalkable(area, false, true, true) then
            addEvent(doSendMagicEffect, 1200, area, effect)
            addEvent(calculatedmg, 1200, creature, dmg, area)
            end  
        area = {x = pos.x-1, y =pos.y-1, z = pos.z}
        creature = getTopCreature(area).uid
            if isWalkable(area, false, true, true) then
            addEvent(doSendMagicEffect, 1200, area, effect)
            addEvent(calculatedmg, 1200, creature, dmg, area)
            end  
        area = {x = pos.x+1, y =pos.y+1, z = pos.z}
        creature = getTopCreature(area).uid
            if isWalkable(area, false, true, true) then
            addEvent(doSendMagicEffect, 1200, area, effect)
            addEvent(calculatedmg, 1200, creature, dmg, area)
            end  
        area = {x = pos.x+1, y =pos.y-1, z = pos.z}
        creature = getTopCreature(area).uid
            if isWalkable(area, false, true, true) then
            addEvent(doSendMagicEffect, 1200, area, effect)
            addEvent(calculatedmg, 1200, creature, dmg, area)
            end  
        area = {x = pos.x-1, y =pos.y+1, z = pos.z}
        creature = getTopCreature(area).uid
            if isWalkable(area, false, true, true) then
            addEvent(doSendMagicEffect, 1200, area, effect)
            addEvent(calculatedmg, 1200, creature, dmg, area)
            end  
        area = {x = pos.x, y =pos.y-2, z = pos.z}
        creature = getTopCreature(area).uid
            if isWalkable(area, false, true, true) then
            addEvent(doSendMagicEffect, 1200, area, effect)
            addEvent(calculatedmg, 1200, creature, dmg, area)
            end  
        area = {x = pos.x, y =pos.y+2, z = pos.z}
        creature = getTopCreature(area).uid
            if isWalkable(area, false, true, true) then
            addEvent(doSendMagicEffect, 1200, area, effect)
            addEvent(calculatedmg, 1200, creature, dmg, area)
            end  

      
        end
    end
end
return true
end

function isWalkable(pos, creature, proj, pz)-- by Nord
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
if getTopCreature(pos).uid > 0 and creature then return false end
if getTileInfo(pos).protection and pz then return false, true end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end

Thanks

Bump
 
Last edited by a moderator:
Thanks a lot Limos!
Code:
function calculatedmg(monster, damage, pos)
   if isWalkable(pos, false, true, true) and isCreature(monster) then
     if doCreatureAddHealth(monster, (-damage)) ~= LUA_ERROR then
     doSendAnimatedText(pos, ""..damage.."", 144)
     return true
     end
   return true
   else
   return false
   end
   return true
end

Sorry for ignoring the rules.

One more Question:
How to use
Code:
doTargetCombatHealth(cid, target, type, min, max, effect)
instead of
Code:
if doCreatureAddHealth(monster, (-damage)) ~= LUA_ERROR then
     doSendAnimatedText(pos, ""..damage.."", 144)
     return true
     end
?
 
Last edited:
If there is no attacker you can change cid to 0. target is the one that should receive damage, so that should be monster.
The type is the combat, min and max will be the minimum and maximum damage, so you can just do -damage, -damage and the effect is the magic effect, you can also do CONST_ME_NONE if you don't want an effect.
 
If the summon kills the monsters both get 50%, if the player kills the monsters with no help of the summon, it gets 100%. With both damage it will be something in between.
 
Back
Top