Felipe93
Ghost Member
Hello im trying that player be pushed to the south by closing a opened door }
what i've made is to separate certain doors and create a new table inside doors.lua
this pushes the player diagonally
and this pushes player tto the east
i want players to be pushed to the south, can somebody point me out how to?
solved
toPosition.y = toPosition.y + 1
can't get the script to work please help
need to add an exception for certain doors to push players to the south
tried this no lucky
what i've made is to separate certain doors and create a new table inside doors.lua
this pushes the player diagonally
Lua:
elseif table.contains(horizontalDoors, itemId) then
local doorCreature = Tile(toPosition):getTopCreature()
if doorCreature then
toPosition.x = toPosition.x + 1
toPosition.y = toPosition.y - 1
--doRelocate(item:getPosition(), item:getPosition():moveRel(1, 0, 0))
--doRelocate(item:getPosition(), item:getPosition():moveRel(1, 0, 0))
-- toPosition.x = toPosition.x + 2
--toPosition.x = toPosition.x - 1
doorCreature:teleportTo(toPosition, true)
end
and this pushes player tto the east
Lua:
elseif table.contains(horizontalDoors, itemId) then
local doorCreature = Tile(toPosition):getTopCreature()
if doorCreature then
toPosition.x = toPosition.x + 1
doorCreature:teleportTo(toPosition, true)
end
i want players to be pushed to the south, can somebody point me out how to?
Post automatically merged:
solved
toPosition.y = toPosition.y + 1
Post automatically merged:
can't get the script to work please help
Lua:
local door = Action()
function door.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local itemId = item:getId()
if table.contains(closedQuestDoors, itemId) then
if player:getStorageValue(item.actionid) ~= -1 or player:getGroup():getAccess() then
item:transform(itemId + 1)
player:teleportTo(toPosition, true)
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The door seems to be sealed against unwanted intruders.")
end
return true
elseif table.contains(closedLevelDoors, itemId) then
if item.actionid > 0 and player:getLevel() >= item.actionid - actionIds.levelDoor or player:getGroup():getAccess() then
item:transform(itemId + 1)
player:teleportTo(toPosition, true)
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
end
return true
elseif table.contains(keys, itemId) then
local tile = Tile(toPosition)
if not tile then
return false
end
target = tile:getTopVisibleThing()
if target.actionid == 0 then
return false
end
if table.contains(keys, target.itemid) then
return false
end
if not table.contains(openDoors, target.itemid) and not table.contains(closedDoors, target.itemid) and not table.contains(lockedDoors, target.itemid) then
return false
end
if item.actionid ~= target.actionid then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "The key does not match.")
return true
end
local transformTo = target.itemid + 2
if table.contains(openDoors, target.itemid) then
transformTo = target.itemid - 2
elseif table.contains(closedDoors, target.itemid) then
transformTo = target.itemid - 1
end
target:transform(transformTo)
return true
elseif table.contains(lockedDoors, itemId) then
player:sendTextMessage(MESSAGE_INFO_DESCR, "It is locked.")
return true
elseif table.contains(openVerticalDoors, itemId) then
local doorCreature = Tile(toPosition):getTopCreature()
if doorCreature then
toPosition.y = toPosition.y + 1
doorCreature:teleportTo(toPosition, true)
return true
elseif table.contains(openDoors, itemId) or table.contains(openExtraDoors, itemId) or table.contains(openHouseDoors, itemId) then
local doorCreature = Tile(toPosition):getTopCreature()
if doorCreature then
toPosition.x = toPosition.x + 1
doorCreature:teleportTo(toPosition, true)
end
item:transform(itemId - 1)
return true
elseif table.contains(closedDoors, itemId) or table.contains(closedExtraDoors, itemId) or table.contains(closedHouseDoors, itemId) or table.contains(closedVerticalDoors, itemId) then
item:transform(itemId + 1)
return true
end
return false
end
local doorTables = {keys, openDoors, closedDoors, lockedDoors, openExtraDoors, closedExtraDoors, openHouseDoors, closedHouseDoors, closedQuestDoors, closedLevelDoors, openVerticalDoors, closedVerticalDoors}
for _, doors in pairs(doorTables) do
for _, doorId in pairs(doors) do
door:id(doorId)
end
end
end
door:register()
Code:
toPosition.y = toPosition.y + 1
Post automatically merged:
tried this no lucky
Code:
local door = Action()
local doorId = 1214
function door.onUse(player, item, fromPosition, target, toPosition, isHotkey)
Lua:
elseif table.contains(openDoors, itemId) or table.contains(openExtraDoors, itemId) or table.contains(openHouseDoors, itemId) then
local doorCreature = Tile(toPosition):getTopCreature()
if doorCreature then
toPosition.x = toPosition.x + 1
doorCreature:teleportTo(toPosition, true)
return true
elseif item.itemid == doorId then
toPosition.y = toPosition.y + 1
doorCreature:teleportTo(toPosition, true)
end
Last edited: