• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Bomberman

2822-bombbug.png

1. Bombs pass right through wall

Just to mention it again, Using TFS 0.4 r 3684


I See Explosion stop in Block Here.
How wall can stop too ?
Lua:
local function boom(pos, cid)
	local v = getTileItemById(pos, t.bombID).uid
	if isPlayer(cid) and isInRange(getThingPos(cid), t.from, t.to) then
		setPlayerStorageValue(cid, t.storage.placed, getPlayerStorageValue(cid, t.storage.placed) - 1)
		doCreatureSay(cid, t.text, TALKTYPE_ORANGE_2, false, nil, pos)
		doSendMagicEffect(pos, t.effect)
		local c = getTopCreature(pos).uid
		if isPlayer(c) and isInRange(getThingPos(c), t.from, t.to) then
			doSendMagicEffect(pos, CONST_ME_GIFT_WRAPS)
			doTeleportThing(c, t.temple)
			doSendMagicEffect(t.temple, CONST_ME_MORTAREA)
			local n1, n2 = getPlayerName(c), getPlayerName(cid)
			doBroadcastMessage(n1==n2 and n1 .. " killed " .. (getPlayerSex(c) == 0 and "her" or "him") .. "self!" or n1 .. " was killed by " .. n2 .. "!", MESSAGE_STATUS_WARNING)
			local a = getPlayersInRange({x=497, y=500, z=7}, 7, 5)
			if #a < 2 then
				doBroadcastMessage(getPlayerName(a[1]) .. " has won the match!", MESSAGE_STATUS_WARNING)
				doPlayerAddLevel(a[1], 1)
				doTeleportThing(a[1], t.temple)
				doSendMagicEffect(t.temple, CONST_ME_FIREWORK_RED)
				reset()
				reset()
			end
		else
			local b = getTileItemById(pos, t.blockID).uid
			if b > 0 then
				doSendMagicEffect(pos, CONST_ME_BLOCKHIT)
				doRemoveItem(b)
				local r = math.random(10)
				if r < 4 then
					doCreateItem(r==1 and 8304 or r==2 and 8306 or r==3 and 8310, 1, _pos)
				end
			end
		end
		local N, E, W, S, l = 1, 1, 1, 1, getPlayerStorageValue(cid, t.storage.radius)
		function loopDir(dir)
			local _pos = {x=pos.x+(dir=="E" and E or dir=="W" and -W or 0), y=pos.y+(dir=="N" and -N or dir=="S" and S or 0), z=pos.z}
			if queryTileAddThing(v, _pos, 4) == RETURNVALUE_NOERROR or getTileItemById(_pos, t.blockID).uid > 0   then
				doSendMagicEffect(_pos, t.effect)
				local c = getTopCreature(_pos).uid
				if isPlayer(c) and isInRange(getThingPos(c), t.from, t.to) then
					doSendMagicEffect(_pos, CONST_ME_GIFT_WRAPS)
					doTeleportThing(c, t.temple)
					doSendMagicEffect(t.temple, CONST_ME_MORTAREA)
					local n1, n2 = getPlayerName(c), getPlayerName(cid)
					doBroadcastMessage(n1==n2 and n1 .. " killed " .. (getPlayerSex(c) == 0 and "her" or "him") .. "self!" or n1 .. " was killed by " .. n2 .. "!", MESSAGE_STATUS_WARNING)
					local a = getPlayersInRange({x=497, y=500, z=7}, 7, 5)
					if #a < 2 then
						doBroadcastMessage(getPlayerName(a[1]) .. " has won the match!", MESSAGE_STATUS_WARNING)
						doPlayerAddLevel(a[1], 1)
						doTeleportThing(a[1], t.temple)
						doSendMagicEffect(t.temple, CONST_ME_FIREWORK_RED)
						reset()
						reset()
						return "endgame"
					end
				else
					local b = getTileItemById(_pos, t.blockID).uid
					if b > 0 then
						doSendMagicEffect(_pos, CONST_ME_BLOCKHIT)
						doRemoveItem(b)
						local r = math.random(10)
						if r < 4 then
							doCreateItem(r==1 and 8304 or r==2 and 8306 or r==3 and 8310, 1, _pos)
						end
						return false
					end
				end
			elseif queryTileAddThing(v, _pos, 4) == 3 then
				return false
			end
			return true
		end
		while N <= l do
			local q = loopDir("N")
			if q == "endgame" then
				return doRemoveItem(v, 1)
			elseif not q then
				break
			else
				N = N + 1
			end
		end
		while E <= l do
			local q = loopDir("E")
			if q == "endgame" then
				return doRemoveItem(v, 1)
			elseif not q then
				break
			else
				E = E + 1
			end
		end
		while W <= l do
			local q = loopDir("W")
			if q == "endgame" then
				return doRemoveItem(v, 1)
			elseif not q then
				break
			else
				W = W + 1
			end
		end
		while S <= l do
			local q = loopDir("S")
			if q == "endgame" then
				return doRemoveItem(v, 1)
			elseif not q then
				break
			else
				S = S + 1
			end
		end
	end
	doRemoveItem(v, 1)
end


I pay 10 dolar to fix this.
 
Last edited:
I did not understand 2 things.
lever.lua
Lua:
	{x=496, y=537, z=9},
	{x=497, y=537, z=9},
	{x=498, y=537, z=9},
	{x=499, y=537, z=9}
}, {
	{x=490, y=495, z=9},
	{x=504, y=505, z=9},
	{x=504, y=495, z=9},
	{x=490, y=505, z=9}
and
bomb.lua
Lua:
		{x=490, y=495, z=9},
		{x=491, y=495, z=9},
		{x=490, y=496, z=9},
		
		{x=503, y=495, z=9},
		{x=504, y=495, z=9},
		{x=504, y=496, z=9},
		
		{x=490, y=505, z=9},
		{x=491, y=505, z=9},
		{x=490, y=504, z=9},
		
		{x=503, y=505, z=9},
		{x=504, y=505, z=9},
		{x=504, y=504, z=9}
 
I did not understand 2 things.
lever.lua
Lua:
	{x=496, y=537, z=9},
	{x=497, y=537, z=9},
	{x=498, y=537, z=9},
	{x=499, y=537, z=9}
}, {
	{x=490, y=495, z=9},
	{x=504, y=505, z=9},
	{x=504, y=495, z=9},
	{x=490, y=505, z=9}
and
bomb.lua
Lua:
		{x=490, y=495, z=9},
		{x=491, y=495, z=9},
		{x=490, y=496, z=9},
		
		{x=503, y=495, z=9},
		{x=504, y=495, z=9},
		{x=504, y=496, z=9},
		
		{x=490, y=505, z=9},
		{x=491, y=505, z=9},
		{x=490, y=504, z=9},
		
		{x=503, y=505, z=9},
		{x=504, y=505, z=9},
		{x=504, y=504, z=9}
first 4 are positions where players should stand and other 4 are where they get teleported

the positions in bomb.lua are coords where barrels won't be created when resetting.
 
Have A Error Help me please!

[21/04/2010 15:52:48] [Error - TalkAction Interface]
[21/04/2010 15:52:48] data/talkactions/scripts/bomb.lua:eek:nSay
[21/04/2010 15:52:48] Description:
[21/04/2010 15:52:48] data/lib/032-position.lua:2: attempt to index global 'position' (a nil value)
[21/04/2010 15:52:48] stack traceback:
[21/04/2010 15:52:48] data/lib/032-position.lua:2: in function 'isInRange'
[21/04/2010 15:52:48] data/talkactions/scripts/bomb.lua:203: in function <data/talkactions/scripts/bomb.lua:202>


what need? i cant shoot bombs
 
Last edited:
[21/04/2010 15:52:48] [Error - TalkAction Interface]
[21/04/2010 15:52:48] data/talkactions/scripts/bomb.lua:eek:nSay
[21/04/2010 15:52:48] Description:
[21/04/2010 15:52:48] data/lib/032-position.lua:2: attempt to index global 'position' (a nil value)
[21/04/2010 15:52:48] stack traceback:
[21/04/2010 15:52:48] data/lib/032-position.lua:2: in function 'isInRange'
[21/04/2010 15:52:48] data/talkactions/scripts/bomb.lua:203: in function <data/talkactions/scripts/bomb.lua:202>


what need? i cant shoot bombs

function getPlayersInRange(pos, rX, rY)
local ret = {}
for x = -rX, rX do
for y = -rY, rY do
local v = getTopCreature({x = pos.x+x, y = pos.y+y, z = pos.z}).uid
if isPlayer(v) == TRUE then
table.insert(ret, v)
end
end
end
return ret
end

--Posted from:Cykotitan
 
[21/04/2010 15:52:48] [Error - TalkAction Interface]
[21/04/2010 15:52:48] data/talkactions/scripts/bomb.lua:eek:nSay
[21/04/2010 15:52:48] Description:
[21/04/2010 15:52:48] data/lib/032-position.lua:2: attempt to index global 'position' (a nil value)
[21/04/2010 15:52:48] stack traceback:
[21/04/2010 15:52:48] data/lib/032-position.lua:2: in function 'isInRange'
[21/04/2010 15:52:48] data/talkactions/scripts/bomb.lua:203: in function <data/talkactions/scripts/bomb.lua:202>


what need? i cant shoot bombs
Post your 032-position.lua
 
3/04/2010 21:58:17] data/talkactions/scripts/bomb.lua:203: in function <data/talkactions/scripts/bomb.lua:202>
 
was okay the script leaver more time to place the pump simply does not give. not leave the pump I tried to use the command z;Z and replace more has not yet :/
 
Code:
function isInRange([B]pos[COLOR="Red"]ition[/COLOR][/B], fromPosition, toPosition)
	return (position.x >= fromPosition.x and position.y >= fromPosition.y and position.z >= fromPosition.z and position.x <= toPosition.x and position.y <= toPosition.y and position.z <= toPosition.z)
end

function getDistanceBetween(firstPosition, secondPosition)
	local x, y = math.abs(firstPosition.x - secondPosition.x), math.abs(firstPosition.y - secondPosition.y)
	local diff = math.max(x, y)
	if(firstPosition.z ~= secondPosition.z) then
		diff = diff + 9 + 6
	end

	return diff
end

function getDirectionTo(pos1, pos2)
	local dir = NORTH
	if(pos1.x > pos2.x) then
		dir = WEST
		if(pos1.y > pos2.y) then
			dir = NORTHWEST
		elseif(pos1.y < pos2.y) then
			dir = SOUTHWEST
		end
	elseif(pos1.x < pos2.x) then
		dir = EAST
		if(pos1.y > pos2.y) then
			dir = NORTHEAST
		elseif(pos1.y < pos2.y) then
			dir = SOUTHEAST
		end
	else
		if(pos1.y > pos2.y) then
			dir = NORTH
		elseif(pos1.y < pos2.y) then
			dir = SOUTH
		end
	end
	return dir
end

function getCreatureLookPosition(cid)
	return getPosByDir(getThingPos(cid), getCreatureLookDirection(cid))
end

function getPosByDir(fromPosition, direction, size)
	local n = size or 1

	local pos = fromPosition
	if(direction == NORTH) then
		pos.y = pos.y - n
	elseif(direction == SOUTH) then
		pos.y = pos.y + n
	elseif(direction == WEST) then
		pos.x = pos.x - n
	elseif(direction == EAST) then
		pos.x = pos.x + n
	elseif(direction == NORTHWEST) then
		pos.y = pos.y - n
		pos.x = pos.x - n
	elseif(direction == NORTHEAST) then
		pos.y = pos.y - n
		pos.x = pos.x + n
	elseif(direction == SOUTHWEST) then
		pos.y = pos.y + n
		pos.x = pos.x - n
	elseif(direction == SOUTHEAST) then
		pos.y = pos.y + n
		pos.x = pos.x + n
	end

	return pos
end

function doComparePositions(pos, posEx)
	return pos.x == posEx.x and pos.y == posEx.y and pos.z == posEx.z
end

function getArea(pos, rangeX, rangeY)
	local t = {}
	for i = (pos.x - rangeX), (pos.x + rangeX) do
		for j = (pos.y - rangeY), (pos.y + rangeY) do
			table.insert(t, {x = i, y = j, z = pos.z})
		end
	end

	return t
end
 
[24/04/2010 03:32:48] [Warning - Event::loadScript] Event onSay not found (data/talkactions/scripts/bomb.lua)
 
?????'
data/llb/032-position.lua

Ok look my 032 position help me

function isInRange(pos, fromPosition, toPosition)
return (position.x >= fromPosition.x and position.y >= fromPosition.y and position.z >= fromPosition.z and position.x <= toPosition.x and position.y <= toPosition.y and position.z <= toPosition.z)
end

function getDistanceBetween(firstPosition, secondPosition)
local x, y = math.abs(firstPosition.x - secondPosition.x), math.abs(firstPosition.y - secondPosition.y)
local diff = math.max(x, y)
if(firstPosition.z ~= secondPosition.z) then
diff = diff + 9 + 6
end

return diff
end

function getDirectionTo(pos1, pos2)
local dir = NORTH
if(pos1.x > pos2.x) then
dir = WEST
if(pos1.y > pos2.y) then
dir = NORTHWEST
elseif(pos1.y < pos2.y) then
dir = SOUTHWEST
end
elseif(pos1.x < pos2.x) then
dir = EAST
if(pos1.y > pos2.y) then
dir = NORTHEAST
elseif(pos1.y < pos2.y) then
dir = SOUTHEAST
end
else
if(pos1.y > pos2.y) then
dir = NORTH
elseif(pos1.y < pos2.y) then
dir = SOUTH
end
end
return dir
end

function getCreatureLookPosition(cid)
return getPosByDir(getThingPos(cid), getCreatureLookDirection(cid))
end

function getPosByDir(fromPosition, direction, size)
local n = size or 1

local pos = fromPosition
if(direction == NORTH) then
pos.y = pos.y - n
elseif(direction == SOUTH) then
pos.y = pos.y + n
elseif(direction == WEST) then
pos.x = pos.x - n
elseif(direction == EAST) then
pos.x = pos.x + n
elseif(direction == NORTHWEST) then
pos.y = pos.y - n
pos.x = pos.x - n
elseif(direction == NORTHEAST) then
pos.y = pos.y - n
pos.x = pos.x + n
elseif(direction == SOUTHWEST) then
pos.y = pos.y + n
pos.x = pos.x - n
elseif(direction == SOUTHEAST) then
pos.y = pos.y + n
pos.x = pos.x + n
end

return pos
end

function doComparePositions(pos, posEx)
return pos.x == posEx.x and pos.y == posEx.y and pos.z == posEx.z
end

function getArea(pos, rangeX, rangeY)
local t = {}
for i = (pos.x - rangeX), (pos.x + rangeX) do
for j = (pos.y - rangeY), (pos.y + rangeY) do
table.insert(t, {x = i, y = j, z = pos.z})
end
end

return t
end
 
Back
Top