Klank
Althea ¤ A New World Developer
Hello,
My plan is two click on two different walls and a stairwell will appear. I'm in the phase of learning scripting and i know my code is super crap..
However, i almost got it to work. The problem i am facing is that "local Wall1" and "local Wall2" resets to 0 every time I activate the script (clicking on the second wall sets wall1 back to 0 and vice versa) , can someone show me a better way of handling this scenario?
There must be a much easier and simpler way of doing this, but i don't know how to do it yet
Any help is appreciated.
(NVM the local config, i tested this using a table at first)
My plan is two click on two different walls and a stairwell will appear. I'm in the phase of learning scripting and i know my code is super crap..
However, i almost got it to work. The problem i am facing is that "local Wall1" and "local Wall2" resets to 0 every time I activate the script (clicking on the second wall sets wall1 back to 0 and vice versa) , can someone show me a better way of handling this scenario?
There must be a much easier and simpler way of doing this, but i don't know how to do it yet
Any help is appreciated.
(NVM the local config, i tested this using a table at first)
Lua:
local config = {
--["Wall1"] = 0, ["Wall2"] = 0
}
local Wall1 = 0
local Wall2 = 0
local stairPosition = Position(734, 450, 11)
function onUse(cid, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 8506 and Wall1 ~= 1 then
doCreatureSay(cid, "Wall1 is set to 1", TALKTYPE_MONSTER_SAY, true, 0, fromPosition)
Wall1 = 1
elseif Wall1 == 1 and item.itemid == 8506 then
doCreatureSay(cid, "You already used this.", TALKTYPE_MONSTER_SAY, true, 0, fromPosition)
end
if item.itemid == 8521 and Wall2 ~= 1 then
doCreatureSay(cid, "Wall2 is set to 2", TALKTYPE_MONSTER_SAY, true, 0, fromPosition)
Wall2 = 1
elseif Wall2 == 1 and item.itemid == 8521 then
doCreatureSay(cid, "You already used this.", TALKTYPE_MONSTER_SAY, true, 0, fromPosition)
end
local StairTile = Tile(stairPosition):getItemById(3153)
local test = Wall1 * Wall2
print(test)
if test == 1 then
StairTile:transform(4835)
stairPosition:sendMagicEffect(CONST_ME_POFF)
end
addEvent(function(TilePosition, toPosition,TileID)
local StairTile2 = Tile(toPosition):getItemById(TileID)
if StairTile2 then
Stairtile2:transform(3153)
TilePosition:sendMagicEffect(CONS_ME_POFF)
end
end,10000, stairPosition, toPosition, 4835)
return true
end