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

Damage and Repair entrance area onstep tiles :D plx helps with what I've already made

Blood BlvD Ot

Member
Joined
Jun 12, 2010
Messages
243
Reaction score
7
Example [D] = Damager Tile, B = Blockage,[R] = Repair Tile.
'''''''|
[D]B[R]
,,,,|

The Error :
Code:
[27/02/2011 13:35:29] [Error - MoveEvents Interface] 
[27/02/2011 13:35:29] data/movements/scripts/zombiesLeftTopButton.lua:onStepIn
[27/02/2011 13:35:29] Description: 
[27/02/2011 13:35:29] data/movements/scripts/zombiesLeftTopButton.lua:14: attempt to compare number with nil
[27/02/2011 13:35:29] stack traceback:
[27/02/2011 13:35:29] 	data/movements/scripts/zombiesLeftTopButton.lua:14: in function <data/movements/scripts/zombiesLeftTopButton.lua:5>


movement script.
Code:
function onStepIn(cid, monster, item, frompos, item2, topos)
    local time = 5
	local Durability = 37651
	local entrancePos = {x=1080, y=1119, z=7, stackpos=253}
	local repairTilePos = {x=1080, y=1118, z=7}
	local damageTilePos = {x=1080, y=1120, z=7}
	local entranceBlocker = getThingFromPos(entrancePos).uid
	local player = getThingFromPos(repairTilePos).uid
	local monster = getThingFromPos(damageTilePos).uid
		if item.uid >= 10000 and item.uid <= 10010 then              -------LINE 14
			addEvent(RepairEntranceOne, time * 1000, monster)
		elseif item.uid >= 10010 and item.uid <= 10020 then
			addEvent(DamageEntranceOne, time * 3000, monster)
		end
	return true
end
function onStepOut(cid, monster, item, frompos, item2, topos)
		if item.uid >= 10000 and item.uid <= 10010 then
			removeEvent(RepairEntranceOne)
		elseif item.uid >= 10010 and item.uid <= 10020 then
			removeEvent(DamageEntranceOne)
		end
	return true
end

My nuub way of writing a function ^^... Always learning tho :D!

RepairEntranceOne
Code:
function RepairEntranceOne(cid, monster, item, frompos, item2, topos)
    local time = 5
	local Durability = 37651
	local entrancePos = {x=1080, y=1119, z=7, stackpos=253}
	local repairTilePos = {x=1080, y=1118, z=7}
	local damageTilePos = {x=1080, y=1120, z=7}
	local entranceBlocker = getThingFromPos(entrancePos).uid
	local player = getThingFromPos(repairTilePos).uid
	local monster = getThingFromPos(damageTilePos).uid
		if player ~= 0 and isPlayer(player) then
		local entranceDurability = math.max(1, getStorage(Durability) + 1)
			if entranceDurability <= 9 then 
				doSetStorage(Durability, entranceDurability)
			elseif entranceDurability == 0 then
				doTransformItem(entranceBlocker,1135,1)
			elseif entranceDurability == 10 then 
				doSendAnimatedText(entrancePos,"FULL",100)
			end 
		else 
		end 
	addEvent(RepairEntranceOne, time * 1000, monster)
	return TRUE
end

DamageEntranceOne
Code:
function DamageEntranceOne(cid, monster, item, frompos, item2, topos)
    local time = 5
	local Durability = 37651
	local entrancePos = {x=1080, y=1119, z=7, stackpos=253}
	local repairTilePos = {x=1080, y=1118, z=7}
	local damageTilePos = {x=1080, y=1120, z=7}
	local entranceBlocker = getThingFromPos(entrancePos).uid
	local player = getThingFromPos(repairTilePos).uid
	local monster = getThingFromPos(damageTilePos).uid
		if monster ~= 0 and isMonster(monster) then
		local entranceDurability = math.max(1, getStorage(Durability) - 1)
			if entranceDurability <= 9 then 
				doSetStorage(Durability, entranceDurability)
				if entranceDurability == 0 then 
					doTransformItem(entranceBlocker,1135,1)
				end
			else 
				doSendAnimatedText(entrancePos,"FULL",100)
			end 
		else 
		end 
		addEvent(DamageEntranceOne, time * 1000, monster)
	return TRUE 
end

Would really appretiate the help :D Its gonna be a fun thing that I'm(we're) making ;).
 
Last edited:
Sorry I forgot to put the error up there lol^^, but one person stands on a tile that starts to damage the blockage in the middle, and another is to repair the blockage in the middle.
 
Back
Top