bury
Active Member
- Joined
- Jul 27, 2008
- Messages
- 421
- Solutions
- 7
- Reaction score
- 25
Hi, im using this bomberman script.
movements
And the spell
My problem is that when somebody put the bomb and dies above it, floor is destroyed and creates a tile of lava: You see lava.
ItemID: [598].
I have read that itemid in the script but I dont know how to fix it.
The lava stay there for the next fight and people use to be trapped by it. And sometimes if u die above the bomb the enemie is not teleported to the temple as the winner.
How could I fix it? ty!
movements
LUA:
-- Bomberman root handler [TGY]
--[[_G.bm_bombed = {}
_G.bm_items = {}]]
bm_players = {} -- {GUID, Bombs, Range, Status[0=Wait,1=Playing,2=KO]}
bm_status = 0 -- [0=Wait,1=Play,2=Handling]
local timer = -1 -- [-1=Wait,0=Start,1-5=Tick]
local startPos = {{x = 214, y = 2014, z = 8},{x = 224, y = 2024, z = 8}, {x = 224, y = 2014, z = 8},{x = 214, y = 2024, z = 8}}
local function bm_timer()
timer = timer - 1
if timer > 0 then
addEvent(bm_timer, 1000)
elseif timer == 0 then
-- Start game [X: 878] [Y: 961] [Z: 8].
if #bm_players > 1 and #(isCreatureInArea({x = 214, y = 2014, z = 8}, {x = 224, y = 2024, z = 8})) == 0 then
-- Reset area
bm_resetarea(); bm_resetarea()
-- Get players inside
for i,v in pairs(bm_players) do
setPlayerStorageValue(v, 12301, 1)
setPlayerStorageValue(v, 12302, 1)
doTeleportThing(v, startPos[i], true)
end
end
end
for i=1,4 do -- X: 874] [Y: 953] [Z: 8].
doSendAnimatedText({x = 231+i, y = 2020, z = 8}, timer, TEXTCOLOR_ORANGE)
end
end
local function bm_area()
return isCreatureInArea({x = 214, y = 2014, z = 8}, {x = 224, y = 2024, z = 8})
end
local function bm_waiting()
bm_players = {}
for i=1,4 do
--doSendAnimatedText({x=835+i,y=1013,z=8}, "CON"..i, TEXTCOLOR_ORANGE)
local u = getTopCreature({x = 231+i, y = 2020, z = 8})
if u.type == 1 then
table.insert(bm_players, u.uid)
--doSendAnimatedText({x=874+i,y=953,z=8}, "CON+", TEXTCOLOR_ORANGE)
end
end
end
function bm_resetarea()
for x=214,224 do
for y=2014,2024 do
local t = getThingFromPos({x=x,y=y,z=8,stackpos=1})
local p = {x=x,y=y,z=8}
if t.itemid > 0 and t.itemid ~= 9468 and t.itemid ~= 1486 then
doRemoveItem(t.uid)
t = getThingFromPos({x=x,y=y,z=8,stackpos=1})
end
if not (t.itemid > 0) then
if not (isInArea(p, {x = 214, y = 2014, z = 8}, {x = 215, y = 2015, z = 8})) and not (isInArea(p, {x = 223, y = 2014, z = 8}, {x = 224, y = 2015, z = 8})) then -- up
if not (isInArea(p, {x = 214, y = 2023, z = 8}, {x = 215, y = 2024, z = 8})) and not (isInArea(p, {x = 223, y = 2023, z = 8}, {x = 224, y = 2024, z = 8})) then -- down
doCreateItem(9468, p)
end
end
end
end
end
end
function onStepIn(cid, item, position, fromPosition)
-- Handle new waiter
if isPlayer(cid) == false or bm_status ~= 0 then return true end -- Quit if playing, don't mind them :3
--doSendAnimatedText({x=874,y=953,z=8}, "CONSTART", TEXTCOLOR_ORANGE)
--print("x")
if #(isCreatureInArea({x = 214, y = 2014, z = 8}, {x = 224, y = 2024, z = 8})) ~= 0 then
doTeleportThing(cid, fromPosition, true)
return true
end
bm_waiting()
if #bm_players > 1 then
-- Start timer
if timer == -1 then
addEvent(bm_timer, 1000)
end
timer = 6
else
timer = -1
end
doPlayerPopupFYI(cid, "Use the 'bombza' spell to place a bomb!\nStep with at least two players at those plates to start.")
return true
end
function onStepOut(cid, item, position, fromPosition)
-- Handle leaving waiter
if bm_status ~= 0 then return true end -- Quit if playing, don't mind them :3
bm_waiting()
if #bm_players > 1 then
timer = 6
else
timer = -1
end
return true
end
LUA:
function onStepIn(cid, item, position, fromPosition)
if item.actionid == 12391 then
doSendAnimatedText(getPlayerPosition(cid), "+1 Bomb", TEXTCOLOR_RED)
setPlayerStorageValue(cid, 12301, getPlayerStorageValue(cid, 12301) +1)
doRemoveItem(item.uid)
elseif item.actionid == 12392 then
doSendAnimatedText(getPlayerPosition(cid), "+1 Length", TEXTCOLOR_BLUE)
setPlayerStorageValue(cid, 12302, getPlayerStorageValue(cid, 12302) +1)
doRemoveItem(item.uid)
end
return true
end
And the spell
LUA:
local function doCheck(p2z, cid)
local u = getTopCreature({x=p2z.x,y=p2z.y,z=p2z.z})
if u.type == 1 then
doTeleportThing(u.uid, {x = 32369, y = 32239, z = 7})
doSendMagicEffect(p2z, 6)
if cid == u.uid then
bm_msg(getCreatureName(cid) .. " KO'd himself.")
else
bm_msg(getCreatureName(cid) .. " KO'd " .. getCreatureName(u.uid) .. ".")
end
local inside = isCreatureInArea({x = 214, y = 2014, z = 8}, {x = 224, y = 2024, z = 8})
if #inside == 0 then return 6 end
if #inside == 1 then
doTeleportThing(inside[1], {x = 32369, y = 32239, z = 7})
if getPlayerStorageValue(inside[1], 12302) > 1 then
doPlayerAddItem(inside[1],6527,2)
bm_msg(getCreatureName(inside[1]) .. " won the game! (Won 2 Game Tokens)")
else
bm_msg(getCreatureName(inside[1]) .. " won the game! (Won 0 Game Tokens)")
end
end
return 6
end
local t = getThingFromPos({x=p2z.x,y=p2z.y,z=p2z.z,stackpos=1})
if t.itemid > 0 then
if t.itemid == 9468 then
doSendMagicEffect(p2z, 6)
local new = math.random(1,6)
if new == 1 then
-- 9568 (Laser)
doTransformItem(t.uid, 9568)
doItemSetAttribute(t.uid,"aid",12392)
elseif new == 2 then
-- 9566 (Bomb)
doTransformItem(t.uid, 9566)
doItemSetAttribute(t.uid,"aid",12391)
else
doRemoveItem(t.uid)
end
return 7
elseif t.itemid == 1486 or p2z.x == 879 or p2z.x == 867 or p2z.y == 960 or p2z.y == 972 then
return 7
else
-- just stomble across the item :3
doSendMagicEffect(p2z, 5)
return 6
end
else
doSendMagicEffect(p2z, 5)
end
return 6
end
function bm_msg(msg)
for _,v in pairs(isCreatureInArea({x = 214, y = 2014, z = 8}, {x = 224, y = 2024, z = 8})) do
doCreatureSay(v, msg, TALKTYPE_ORANGE_1)
end
end
local function boomz(p, cid, bomb)
local farz = getPlayerStorageValue(cid, 12302)
-- up
local pDx = p.x
local pDy = p.y
local p2z = p
local u = getTopCreature({x=p2z.x,y=p2z.y,z=p2z.z})
if u.type == 1 then
doTeleportThing(u.uid, {x = 32369, y = 32239, z = 7})
doSendMagicEffect(p2z, 6)
if cid == u.uid then
bm_msg(getCreatureName(cid) .. " KO'd himself.")
else
bm_msg(getCreatureName(cid) .. " KO'd " .. getCreatureName(u.uid) .. ".")
end
local inside = isCreatureInArea({x=868,y=961,z=8}, {x=878,y=971,z=8})
if #inside == 0 then return 6 end
if #inside == 1 then
doTeleportThing(inside[1], {x = 32369, y = 32239, z = 7})
if farz > 1 then
doPlayerAddItem(inside[1],6527,2)
bm_msg(getCreatureName(inside[1]) .. " won the game! (Won 2 Game Tokens)")
else
bm_msg(getCreatureName(inside[1]) .. " won the game! (Won 0 Game Tokens)")
end
end
else
doSendMagicEffect(p2z, 5)
end
for i=1,farz do
p2z.y = p2z.y - 1
if doCheck(p2z, cid) == 7 then break end
end
-- down
p2z.y = pDy
--doCreatureSay(cid, "Debug: ".. p2z.y.."/".. p.y, TALKTYPE_ORANGE_1)
for i=1,farz do
--doCreatureSay(cid, "Conn2: n/a<<?", TALKTYPE_ORANGE_1)
p2z.y = p2z.y + 1
--doCreatureSay(cid, "Debug[!]: ".. p2z.y.."/".. p.y, TALKTYPE_ORANGE_1)
if doCheck(p2z, cid) == 7 then break end
end
-- left
p2z.y = pDy
--doCreatureSay(cid, "Debug: ".. p2z.y.."/".. p.y, TALKTYPE_ORANGE_1)
for i=1,farz do
p2z.x = p2z.x - 1
if doCheck(p2z, cid) == 7 then break end
end
-- right
p2z.x = pDx
--doCreatureSay(cid, "Debugx: ".. p2z.x.."/".. p.x, TALKTYPE_ORANGE_1)
for i=1,farz do
p2z.x = p2z.x + 1
if doCheck(p2z, cid) == 7 then break end
end
p2z.x = pDx
setPlayerStorageValue(cid, 12301, getPlayerStorageValue(cid, 12301) +1)
local t = getThingFromPos({x=p2z.x,y=p2z.y,z=p2z.z,stackpos=1})
if t.itemid > 0 then
doRemoveItem(t.uid)
end
doCreateItem(412, {x=p2z.x,y=p2z.y,z=p2z.z,stackpos=0})
--doCreatureSay(cid, "Conn: nil<<!!!", TALKTYPE_ORANGE_1)
end
function onCastSpell(cid, var)
--[[if true then
for _, name in ipairs(getOnlinePlayers()) do
local player = getPlayerByName(name)
doCreatureSay(cid, "xx".. name)
db.executeQuery("UPDATE `players` SET `online` = 1 WHERE `name` = '"..player.."';")
end
return true
end]]--
local p = getCreaturePosition(cid)
if not (isInArea(p,{x = 214, y = 2014, z = 8}, {x = 224, y = 2024, z = 8})) then
doCreatureSay(cid, "You can only use this while playing bomberman.", TALKTYPE_ORANGE_1)
return true
end
if getPlayerStorageValue(cid, 12301) < 1 then
doCreatureSay(cid, "No bombs left.", TALKTYPE_ORANGE_1)
return true
end
local stp = {x=p.x,y=p.y,z=p.z,stackpos=0}
local t = getThingFromPos(stp)
if t.itemid == 598 then
doCreatureSay(cid, "Can't stack bombs ".. t.itemid ..".", TALKTYPE_ORANGE_1)
return true
end
setPlayerStorageValue(cid, 12301, getPlayerStorageValue(cid, 12301) -1)
--doCreatureSay(cid, "Conn: nil<<", TALKTYPE_ORANGE_1)
local bomb = doCreateItem(1423, stp)
doCreateItem(598, {x=p.x,y=p.y,z=p.z,stackpos=0})
--doTeleportThing(bomb, stp)
addEvent(boomz, 1500*2, p, cid, bomb)
addEvent(doSendMagicEffect, 400*2, p, 7)
addEvent(doSendMagicEffect, 800*2, p, 7)
addEvent(doSendMagicEffect, 1100*2, p, 7)
addEvent(doSendMagicEffect, 1300*2, p, 7)
addEvent(doSendMagicEffect, 1400*2, p, 7)
return LUA_NO_ERROR
end
My problem is that when somebody put the bomb and dies above it, floor is destroyed and creates a tile of lava: You see lava.
ItemID: [598].
I have read that itemid in the script but I dont know how to fix it.
The lava stay there for the next fight and people use to be trapped by it. And sometimes if u die above the bomb the enemie is not teleported to the temple as the winner.
How could I fix it? ty!