Hello otlanders,
I roughly put together 2 scripts to test something out but now I need little help.
THE SCRIPT:
WHAT IT DOES:
I need a little help with making a specific line work and also adding in some features (hence why I am posting this is in the request section as I feel like it fits the request category more).
This line currently doesn't work, need some help fixing it up. What I want to happen is that after player puts sacrifice on position, uses lever (lever transforms to 1946), if lever is pulled again a different message is sent stating that a "a sacrifice has already been made" (like shown above), this will also not remove any further items that are placed onto the position upon using the lever hence the sacrifice is already "active".
ALSO
1. I thought about this script having a feature where multiple sacrifices are required in different positions
Example:
2. On the line where sacrifice is removed, add a line which will send magic effect to sacrifice position
Is anyone capable of doing these 2 things?
.
I roughly put together 2 scripts to test something out but now I need little help.
THE SCRIPT:
Lua:
local wallPos = {
[1] = {x=1018, y=971, z=7, stackpos=1},
[2] = {x=1019, y=971, z=7, stackpos=1},
[3] = {x=1020, y=971, z=7, stackpos=1}
}
local time_ = 10
local config = {
[6677] = { sacrificePosition = Position(1018, 976, 6) }
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local lever = config[item.actionid]
if not lever then
end
local sacrificeId, sacrifice = Tile(lever.sacrificePosition):getThing(1).itemid, true
if not isInArray({8303}, sacrificeId) then
sacrifice = false
end
if not sacrifice then
toPosition:sendMagicEffect(CONST_ME_POFF)
player:sendTextMessage(MESSAGE_INFO_DESCR, "A sacrifice is required first.")
return false
end
local soilItem = Tile(lever.sacrificePosition):getItemById(sacrificeId)
if soilItem then
soilItem:remove()
player:sendTextMessage(MESSAGE_INFO_DESCR, "Your sacrifice has been accepted, you may pass.")
elseif item.itemid == 1946 then
player:sendTextMessage(MESSAGE_INFO_DESCR, "The sacrifice has already been made.")
toPosition:sendMagicEffect(CONST_ME_POFF)
end
local function reset()
item:transform(1945)
Game.createItem(1355, 1, wallPos[1])
Game.createItem(1355, 1, wallPos[2])
Game.createItem(1355, 1, wallPos[3])
end
item:transform(1946)
addEvent(reset, time_ * 1000)
for i = 1, #wallPos do
doRemoveItem(getThingfromPos(wallPos[i]).uid,1)
end
end
- requires for player to put specific item on the sacrifice position
- if item is present on position and lever pulled, item is removed and...
- this removes stones/walls from specific position
- lever/walls reset after 10 seconds
I need a little help with making a specific line work and also adding in some features (hence why I am posting this is in the request section as I feel like it fits the request category more).
Lua:
elseif item.itemid == 1946 then
player:sendTextMessage(MESSAGE_INFO_DESCR, "The sacrifice has already been made.")
toPosition:sendMagicEffect(CONST_ME_POFF)
ALSO
1. I thought about this script having a feature where multiple sacrifices are required in different positions
Example:
Gyazo
gyazo.com
2. On the line where sacrifice is removed, add a line which will send magic effect to sacrifice position
Is anyone capable of doing these 2 things?
.