Hello again!
I'm newbie in scripting. I've tried to make a script to open 4 stones, 1 lever each 1 stone, I could've made it with 4 scripts but it'd take too much time and I want to learn some better scripting.
Error in console:
in actions.xml
in frostlever.lua
I want some better scripter to tell me whats bad in this script, I guess I can use end in the middle of the script but dunno how to make it 1 lever each 1 stone.
Thanks
One more thing, why my NPC arent loading into OT? I can see them in RME, but not on the serv.
Console error:
+
Why aint this exp rune working?
exprune.lua
actions.xml
I'm newbie in scripting. I've tried to make a script to open 4 stones, 1 lever each 1 stone, I could've made it with 4 scripts but it'd take too much time and I want to learn some better scripting.
Error in console:
Code:
[15/04/2010 21:41:57] [Error - LuaScriptInterface::loadFile] data/actions/scripts/other/frostlever.lua:38: 'end' expected (to close 'function' at line 1) near 'else'
[15/04/2010 21:41:57] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/frostlever.lua)
[15/04/2010 21:41:57] data/actions/scripts/other/frostlever.lua:38: 'end' expected (to close 'function' at line 1) near 'else'
in actions.xml
Code:
<action itemid="6011-6014" event="script" value="other/frostlever.lua"/>
in frostlever.lua
Code:
function onUse(cid, item, frompos, item2, topos)
statuepos1 = {x=1151, y=1088, z=7, stackpos=1}
statuepos2 = {x=1151, y=1087, z=7, stackpos=1}
statuepos3 = {x=1151, y=1086, z=7, stackpos=1}
statuepos4 = {x=1151, y=1085, z=7, stackpos=1}
statue1 = getThingfromPos(statuepos1)
statue2 = getThingfromPos(statuepos2)
statue3 = getThingfromPos(statuepos3)
statue4 = getThingfromPos(statuepos4)
if item.itemid == 9825 and item.uid == 6011 then
doRemoveItem(statue1.uid,1028)
doPlayerSendTextMessage(cid,22,"You can hear that something has opened. It cant be so far.")
elseif(item.itemid == 9826 and item.uid == 6011) then
doCreateItem(statue1.uid,1028)
doPlayerSendTextMessage(cid,22,"You can hear that something has closed. It cant be so far.")
end
if item.itemid == 9825 and item.uid == 6012 then
doRemoveItem(statue2.uid,1028)
doPlayerSendTextMessage(cid,22,"You can hear that something has opened. It cant be so far.")
elseif(item.itemid == 9826 and item.uid == 6012) then
doCreateItem(statue2.uid,1028)
doPlayerSendTextMessage(cid,22,"You can hear that something has closed. It cant be so far.")
end
if item.itemid == 9825 and item.uid == 6013 then
doRemoveItem(statue3.uid,1028)
doPlayerSendTextMessage(cid,22,"You can hear that something has opened. It cant be so far.")
elseif(item.itemid == 9826 and item.uid == 6013) then
doCreateItem(statue3.uid,1028)
doPlayerSendTextMessage(cid,22,"You can hear that something has closed. It cant be so far.")
end
if item.itemid == 9825 and item.uid == 6014 then
doRemoveItem(statue4.uid,1028)
doPlayerSendTextMessage(cid,22,"You can hear that something has opened. It cant be so far.")
elseif(item.itemid == 9826 and item.uid == 6014) then
doCreateItem(statue4.uid,1028)
doPlayerSendTextMessage(cid,22,"You can hear that something has closed. It cant be so far.")
end
else
doPlayerSendTextMessage(cid,22,"Sorry, not possible.")
end
end
I want some better scripter to tell me whats bad in this script, I guess I can use end in the middle of the script but dunno how to make it 1 lever each 1 stone.
Thanks
One more thing, why my NPC arent loading into OT? I can see them in RME, but not on the serv.
Console error:
Code:
[15/04/2010 21:41:58] [Warning - Npc::loadFromXml] Cannot load npc file (data/npc/Backpacker.xml).
[15/04/2010 21:41:58] Info: failed to load external entity "data/npc/Backpacker.xml"
[15/04/2010 21:41:58] [Warning - Npc::loadFromXml] Cannot load npc file (data/npc/Captain Yoe.xml).
[15/04/2010 21:41:58] Info: failed to load external entity "data/npc/Captain Yoe.xml"
+
Why aint this exp rune working?
exprune.lua
Code:
function onUse(cid, item, frompos, item2, topos)
if getPlayerLevel(cid) <= 200 then
doPlayerAddExp(cid, 2500000)
doSendMagicEffect(getPlayerPosition(cid),1)
else
doSendMagicEffect(getPlayerPosition(cid), 2)
doPlayerSendCancel(cid, "Sorry, Your level is too high!")
end
actions.xml
Code:
<action itemid="2275" even="script" value="other/exprune.lua"/>
Last edited: