D
Deleted member 141899
Guest
Hello, im using TFS 1.1, and i have problem with create items that are in the same tile that an border. they are "below", making it impossible to take any action from a actionId this item for example.
I have two examples:
In cave rat:
And beregar wagon:
Can someone help me please?
I have two examples:
In cave rat:
local config = {
bridgePositions = {
{position = Position(32099, 32205, 8), groundId = 9022, itemId = 4645},
{position = Position(32100, 32205, 8), groundId = 4616},
{position = Position(32101, 32205, 8), groundId = 9022, itemId = 4647}
},
leverPositions = {
Position(32098, 32204, 8),
Position(32104, 32204, 8)
},
relocatePosition = Position(32102, 32205, 8),
relocateMonsterPosition = Position(32103, 32205, 8),
bridgeId = 5770
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local leverLeft, lever = item.itemid == 1945
for i = 1, #config.leverPositions do
lever = Tile(config.leverPositions):getItemById(leverLeft and 1945 or 1946)
if lever then
lever:transform(leverLeft and 1946 or 1945)
end
end
local tile, tmpItem, bridge
if leverLeft then
for i = 1, #config.bridgePositions do
bridge = config.bridgePositions
tile = Tile(bridge.position)
tmpItem = tile:getGround()
if tmpItem then
tmpItem:transform(config.bridgeId)
end
if bridge.itemId then
tmpItem = tile:getItemById(bridge.itemId)
if tmpItem then
tmpItem:remove()
end
end
end
else
for i = 1, #config.bridgePositions do
bridge = config.bridgePositions
tile = Tile(bridge.position)
tile:relocateTo(config.relocatePosition, true, config.relocateMonsterPosition)
tile:getGround():transform(bridge.groundId)
Game.createItem(bridge.itemId, 1, bridge.position)
end
end
return true
end
bridgePositions = {
{position = Position(32099, 32205, 8), groundId = 9022, itemId = 4645},
{position = Position(32100, 32205, 8), groundId = 4616},
{position = Position(32101, 32205, 8), groundId = 9022, itemId = 4647}
},
leverPositions = {
Position(32098, 32204, 8),
Position(32104, 32204, 8)
},
relocatePosition = Position(32102, 32205, 8),
relocateMonsterPosition = Position(32103, 32205, 8),
bridgeId = 5770
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local leverLeft, lever = item.itemid == 1945
for i = 1, #config.leverPositions do
lever = Tile(config.leverPositions):getItemById(leverLeft and 1945 or 1946)
if lever then
lever:transform(leverLeft and 1946 or 1945)
end
end
local tile, tmpItem, bridge
if leverLeft then
for i = 1, #config.bridgePositions do
bridge = config.bridgePositions
tile = Tile(bridge.position)
tmpItem = tile:getGround()
if tmpItem then
tmpItem:transform(config.bridgeId)
end
if bridge.itemId then
tmpItem = tile:getItemById(bridge.itemId)
if tmpItem then
tmpItem:remove()
end
end
end
else
for i = 1, #config.bridgePositions do
bridge = config.bridgePositions
tile = Tile(bridge.position)
tile:relocateTo(config.relocatePosition, true, config.relocateMonsterPosition)
tile:getGround():transform(bridge.groundId)
Game.createItem(bridge.itemId, 1, bridge.position)
end
end
return true
end
And beregar wagon:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if target.actionid == 50109 then
if player:getItemCount(5901) >= 3 and player:getItemCount(10033) >= 1 and player:getItemCount(10034) >= 2 and player:getItemCount(8309) >= 6 then
player:removeItem(5901, 3)
player:removeItem(8309, 3)
local bridge = Game.createItem(5779, 1, Position(32571, 31508, 9))
bridge:setActionId(50110)
player:say("KLING KLONG!", TALKTYPE_MONSTER_SAY)
else
player:sendTextMessage(MESSAGE_STATUS_SMALL, "You need some materials to repair this bridge.")
end
elseif target.actionid == 50110 then
player:removeItem(10033, 1)
player:removeItem(10034, 2)
player:removeItem(8309, 3)
local rails = Game.createItem(7122, 1, Position(32571, 31508, 9))
rails:setActionId(50111)
player:say("KLING KLONG!", TALKTYPE_MONSTER_SAY)
else
return false
end
return true
end
if target.actionid == 50109 then
if player:getItemCount(5901) >= 3 and player:getItemCount(10033) >= 1 and player:getItemCount(10034) >= 2 and player:getItemCount(8309) >= 6 then
player:removeItem(5901, 3)
player:removeItem(8309, 3)
local bridge = Game.createItem(5779, 1, Position(32571, 31508, 9))
bridge:setActionId(50110)
player:say("KLING KLONG!", TALKTYPE_MONSTER_SAY)
else
player:sendTextMessage(MESSAGE_STATUS_SMALL, "You need some materials to repair this bridge.")
end
elseif target.actionid == 50110 then
player:removeItem(10033, 1)
player:removeItem(10034, 2)
player:removeItem(8309, 3)
local rails = Game.createItem(7122, 1, Position(32571, 31508, 9))
rails:setActionId(50111)
player:say("KLING KLONG!", TALKTYPE_MONSTER_SAY)
else
return false
end
return true
end
Can someone help me please?