jerryb1988
Member
- Joined
- Mar 10, 2008
- Messages
- 79
- Reaction score
- 5
Well, I couldn't seem to find a good solid PoI script anywhere. The one I've been using had a separate folder and a file for all the 16 levers and it was messy. What I did was combine all this into one simple .lua file. This is only part one of many I'm going to try and make. I don't create many scripts myself and I'd like to give back to the community for all they have given me so here's my script:
USAGE: Map editor
1st lever = Uniqueid 3001
2nd lever = Uniqueid 3002
..
16th lever = Uniqueid 3016
Actions.xml
actions/scripts/poi/16levers.lua
KNOWN BUGS: After you flip the 16th lever, if someone flips it back the stones don't appear (it's not coded to) and if they flip it again it will say this in console:
Lua Script Error: [Action Interface]
data/actions/scripts/quests/poi2/16levers.luanUse
luaDoRemoveItem(). Item not found
Lua Script Error: [Action Interface]
data/actions/scripts/quests/poi2/16levers.luanUse
luaDoRemoveItem(). Item not found
USAGE: Map editor
1st lever = Uniqueid 3001
2nd lever = Uniqueid 3002
..
16th lever = Uniqueid 3016
Actions.xml
Code:
<action fromuid="3001" touid="3016" event="script" value="quests/poi/16levers.lua"/>
actions/scripts/poi/16levers.lua
Code:
-- PoI 16 levers script. Used for the 16 levers you must flip in order after the vocation walls.
-- Created by jerryb1988 from otland.net
local levers = {
[3001] = {x=31697, y=31964, z=11, stackpos=1}, --Bridge lever flipped?
[3002] = {x=31770, y=31958, z=12, stackpos=1}, --1st lever flipped?
[3003] = {x=31787, y=31952, z=14, stackpos=1}, --2nd lever flipped?
[3004] = {x=31738, y=31976, z=14, stackpos=1}, --3rd lever flipped?
[3005] = {x=31785, y=31973, z=15, stackpos=1}, --4th lever flipped?
[3006] = {x=31783, y=31954, z=12, stackpos=1}, --5th lever flipped?
[3007] = {x=31742, y=31942, z=12, stackpos=1}, --6th lever flipped?
[3008] = {x=31783, y=31979, z=13, stackpos=1}, --7th lever flipped?
[3009] = {x=31749, y=31983, z=14, stackpos=1}, --8th lever flipped?
[3010] = {x=31739, y=31983, z=12, stackpos=1}, --9th lever flipped?
[3011] = {x=31743, y=31956, z=13, stackpos=1}, --10th lever flipped?
[3012] = {x=31782, y=31961, z=13, stackpos=1}, --11th lever flipped?
[3013] = {x=31770, y=31989, z=13, stackpos=1}, --12th lever flipped?
[3014] = {x=31746, y=31990, z=13, stackpos=1}, --13th lever flipped?
[3015] = {x=31756, y=31988, z=13, stackpos=1}, --14th lever flipped?
[3016] = {x=31770, y=31978, z=14, stackpos=1} --15th lever flipped?
}
local stonepositions = {
{x=31747, y=31957, z=12, stackpos=1}, -- stone 1 to remove after flipping lever 16
{x=31748, y=31957, z=12, stackpos=1} -- stone 2 to remove after flipping lever 16
}
function onUse(cid, item, frompos, item2, topos)
if (item.uid > 3000 and item.uid < 3017) and item.itemid == 1945 then -- if its our uniqueid's above and lever is <- (NOT flipped)
if getThingFromPos(levers[item.uid]).itemid == 1946 then -- checks if the previous lever is -> (flipped)
if item.uid == 3016 and item.itemid == 1945 then -- check if its last lever
doPlayerSendTextMessage(cid,22, "You flipped all the levers! Continue on!")
for i = 1, #stonepositions do
doRemoveItem(getThingFromPos(stonepositions[i]).uid, 1) -- removes the stone(s) from the position(s) in stonepositions array
doSendMagicEffect(stonepositions[i], 4) -- sends animation effect to removed stone(s) (change the # 4 for different animation)
end
else -- if its not the last lever
doPlayerSendTextMessage(cid,22, "You flipped lever "..(item.uid - 3000)..". Now find the next one!") -- tells the player what lever they flipped
end
doTransformItem(item.uid,item.itemid+1) -- "flip" the lever ->
else
doPlayerSendCancel(cid,"Previous lever not flipped. Levers must be flipped in order.") -- if previous lever is NOT flipped
end
elseif item.itemid == 1946 then -- if the lever was flipped already
doTransformItem(item.uid,item.itemid-1) -- flip it back
else
doPlayerSendCancel(cid,"Sorry, not possible.") -- error control
end
return TRUE
end
KNOWN BUGS: After you flip the 16th lever, if someone flips it back the stones don't appear (it's not coded to) and if they flip it again it will say this in console:
Lua Script Error: [Action Interface]
data/actions/scripts/quests/poi2/16levers.luanUse
luaDoRemoveItem(). Item not found
Lua Script Error: [Action Interface]
data/actions/scripts/quests/poi2/16levers.luanUse
luaDoRemoveItem(). Item not found
Last edited: