Change this
to thisCode:<event type="advance" name="Banana" event="script" value="Banana.lua" />
Code:<event type="death" name="Banana" event="script" value="Banana.lua" />
:thumbup:
function onDeath(cid, corpse, killer)
function onKill(cid, killer)
function doPlayerAddMagLevel(cid, add)
local current = getPlayerRequiredMana(cid, getPlayerMagLevel(cid))
local manaspend = ((getPlayerRequiredMana(cid, getPlayerMagLevel(cid)+add)) / getConfigInfo("rateMagic"))
if isPlayer(cid) == TRUE then
doPlayerAddSpentMana(cid, (current + manaspend))
else
error("Player not found in function doPlayerAddMagLevel")
end
end
doPlayerAddSpentMana(cid, getPlayerRequiredMana(cid, getPlayerMagLevel(cid, ignoreBuffs))) --recieving power--
doPlayerAddMagLevel(cid, 1)
Change this
to thisCode:<event type="advance" name="Banana" event="script" value="Banana.lua" />
Code:<event type="death" name="Banana" event="script" value="Banana.lua" />
:thumbup:
function onUse(cid, item, fromPosition, itemEx, toPosition)
firstID = 2651 -- id of the first item
secondID = 2652 -- id of the second item
newPOS = {1054,1139,7} -- player teleported too...
local piece1pos = {
x = 1055,
y = 1138, -- Poition of the first item
z = 7,
stackpos=1}
local piece2pos = {
x = 1053,
y = 1138, -- Poition of the second item
z = 7,
stackpos=1}
local getpiece1 = getThingfromPos(piece1pos)
local getpiece2 = getThingfromPos(piece2pos)
local playerpos = getPlayerPosition(cid)
if getpiece1.itemid == firstID and getpiece2.itemid == secondID or getpiece1.itemid == secondID and getpiece2.itemid == firstID then
if item.itemid == 1945 then
doTransformItem(item.uid,item.itemid+1)
elseif item.itemid == 1946 then
doTransformItem(item.uid,item.itemid-1)
end
doRemoveItem(getpiece1.uid,1)
doRemoveItem(getpiece2.uid,1)
doSendMagicEffect(piece1pos,2)
doSendMagicEffect(piece2pos,2)
doTeleportThing(cid, newPOS)
doSendMagicEffect(playerpos, CONST_ME_TELEPORT)
end
else
doPlayerSendTextMessage(cid, 22, "You need " .. getItemArticleById(firstID) .. " "..getItemNameById(firstID).." and " .. getItemArticleById(secondID) .. " "..getItemNameById(secondID)..".")
return TRUE
end
[26/06/2009 03:04:38] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/test.lua)
[26/06/2009 03:04:38] data/actions/scripts/quests/test.lua:37: 'end' expected (to close 'function' at line 1) near 'else'
Hey chris and greg... I couldnt get ur 2 items teleport thing to work properly :S Here is the code im using now:
Code:function onUse(cid, item, fromPosition, itemEx, toPosition) firstID = 2651 -- id of the first item secondID = 2652 -- id of the second item newPOS = {1054,1139,7} -- player teleported too... local piece1pos = { x = 1055, y = 1138, -- Poition of the first item z = 7, stackpos=1} local piece2pos = { x = 1053, y = 1138, -- Poition of the second item z = 7, stackpos=1} local getpiece1 = getThingfromPos(piece1pos) local getpiece2 = getThingfromPos(piece2pos) local playerpos = getPlayerPosition(cid) if getpiece1.itemid == firstID and getpiece2.itemid == secondID or getpiece1.itemid == secondID and getpiece2.itemid == firstID then if item.itemid == 1945 then doTransformItem(item.uid,item.itemid+1) elseif item.itemid == 1946 then doTransformItem(item.uid,item.itemid-1) end doRemoveItem(getpiece1.uid,1) doRemoveItem(getpiece2.uid,1) doSendMagicEffect(piece1pos,2) doSendMagicEffect(piece2pos,2) doTeleportThing(cid, newPOS) doSendMagicEffect(playerpos, CONST_ME_TELEPORT) end else doPlayerSendTextMessage(cid, 22, "You need " .. getItemArticleById(firstID) .. " "..getItemNameById(firstID).." and " .. getItemArticleById(secondID) .. " "..getItemNameById(secondID)..".") return TRUE end
This is the error i getCode:[26/06/2009 03:04:38] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/test.lua) [26/06/2009 03:04:38] data/actions/scripts/quests/test.lua:37: 'end' expected (to close 'function' at line 1) near 'else'
Please help me out on it ^^ It's on page 3
function onUse(cid, item, fromPosition, itemEx, toPosition)
firstID = 2651 -- id of the first item
secondID = 2652 -- id of the second item
newPOS = {1054,1139,7} -- player teleported too...
local piece1pos = {
x = 1055,
y = 1138, -- Poition of the first item
z = 7,
stackpos=1}
local piece2pos = {
x = 1053,
y = 1138, -- Poition of the second item
z = 7,
stackpos=1}
local getpiece1 = getThingfromPos(piece1pos)
local getpiece2 = getThingfromPos(piece2pos)
local playerpos = getPlayerPosition(cid)
if getpiece1.itemid == firstID and getpiece2.itemid == secondID or getpiece1.itemid == secondID and getpiece2.itemid == firstID then
if item.itemid == 1945 then
doTransformItem(item.uid,item.itemid+1)
elseif item.itemid == 1946 then
doTransformItem(item.uid,item.itemid-1)
end
doRemoveItem(getpiece1.uid,1)
doRemoveItem(getpiece2.uid,1)
doSendMagicEffect(piece1pos,2)
doSendMagicEffect(piece2pos,2)
doTeleportThing(cid, newPOS)
doSendMagicEffect(playerpos, CONST_ME_TELEPORT)
end
else
doPlayerSendTextMessage(cid, 22, "You need " .. getItemArticleById(firstID) .. " "..getItemNameById(firstID).." and " .. getItemArticleById(secondID) .. " "..getItemNameById(secondID)..".")
end
return TRUE
end
@up you could add this function
Code:function doPlayerAddMagLevel(cid, add) local current = getPlayerRequiredMana(cid, getPlayerMagLevel(cid)) local manaspend = ((getPlayerRequiredMana(cid, getPlayerMagLevel(cid)+add)) / getConfigInfo("rateMagic")) if isPlayer(cid) == TRUE then doPlayerAddSpentMana(cid, (current + manaspend)) else error("Player not found in function doPlayerAddMagLevel") end end
Then change line
Code:doPlayerAddSpentMana(cid, getPlayerRequiredMana(cid, getPlayerMagLevel(cid, ignoreBuffs))) --recieving power--
to
Code:doPlayerAddMagLevel(cid, 1)
Code:function onUse(cid, item, fromPosition, itemEx, toPosition) firstID = 2651 -- id of the first item secondID = 2652 -- id of the second item newPOS = {1054,1139,7} -- player teleported too... local piece1pos = { x = 1055, y = 1138, -- Poition of the first item z = 7, stackpos=1} local piece2pos = { x = 1053, y = 1138, -- Poition of the second item z = 7, stackpos=1} local getpiece1 = getThingfromPos(piece1pos) local getpiece2 = getThingfromPos(piece2pos) local playerpos = getPlayerPosition(cid) if getpiece1.itemid == firstID and getpiece2.itemid == secondID or getpiece1.itemid == secondID and getpiece2.itemid == firstID then if item.itemid == 1945 then doTransformItem(item.uid,item.itemid+1) elseif item.itemid == 1946 then doTransformItem(item.uid,item.itemid-1) end doRemoveItem(getpiece1.uid,1) doRemoveItem(getpiece2.uid,1) doSendMagicEffect(piece1pos,2) doSendMagicEffect(piece2pos,2) doTeleportThing(cid, newPOS) doSendMagicEffect(playerpos, CONST_ME_TELEPORT) end else doPlayerSendTextMessage(cid, 22, "You need " .. getItemArticleById(firstID) .. " "..getItemNameById(firstID).." and " .. getItemArticleById(secondID) .. " "..getItemNameById(secondID)..".") end return TRUE end
Noob code anyways ^_^
It could be better if he change:
ToLua:function onDeath(cid, corpse, killer)
Lua:function onKill(cid, killer)
<event type="death" name="Banana" event="script" value="Banana.lua" />
<event type="kill" name="Banana" event="script" value="Banana.lua" />
in creaturescripts.xml change
Lua:<event type="death" name="Banana" event="script" value="Banana.lua" />
To
Lua:<event type="kill" name="Banana" event="script" value="Banana.lua" />
Hi, Hiho, Learn, You want to learn minning skill?, Yes, Ok. If you give-me 50 gold coins you learn the minning skill.
Hi, Hiho, Upgrade, You want upgrade your minning skill to level 2?, Yes, I need 370 gold coins to upgrade your minning skill.
Bump my Post!
Type of Script: NPC
Player = RED
NPC = Blue
Ex:
More info on the real postp: http://otland.net/379016-post98.html
@Trekes
The minning skill, if you wanna create:
You will use a pick on certain types of large stones, you can find gold, small stones and things like rare diamonds, etc..
You may find it easier if your minning skill is high.
*Limit minning skill level: 4
Sorry. I'm using tools of language.
function onStepIn(cid, item, position, fromPosition)
-- Script by BomBa
if item.actionid == 5566
if isPlayer(cid) == TRUE then
local storageOnRemove = 449933
setPlayerStorageValue(cid, storageOnRemove, 1)
end
return TRUE
-- Script by BomBa
end
if item.actionid == 6655
-- Script by BomBa
local positions =
{
spikeSword = {x=100, y=10, z=1, stackpos=255},
fieldPos = {{x=100, y=10, z=1, stackpos=1}, {x=100, y=10, z=1, stackpos=1}, {x=100, y=10, z=1, stackpos=1}, {x=100, y=10, z=1, stackpos=1}}
}
if isPlayer(cid) == TRUE then
local storageOnRemove = 449933
if getPlayerStorageValue(cid, storageOnRemove) == 1 then
for a = 4, table.maxn(positions.fieldPos) do
doRemoveItem(getThingfromPos(positions.fieldPos[a]).uid, 1)
addEvent(onCreateSwordOfFury, 60000)
setPlayerStorageValue(cid, storageOnRemove, 2)
elseif getPlayerStorageValue(cid, storageOnRemove) == 2 then
doPlayerSendCancel(cid, "Sorry, not possible.")
end
end
end
return TRUE
-- Script by BomBa
end
function onCreateSwordOfFury()
-- Script by BomBa
local createAgain = FALSE
if createAgain == TRUE then
local positions =
{
spikeSword = {x=100, y=10, z=1},
fieldPos = {{x=100, y=10, z=1}, {x=100, y=10, z=1}, {x=100, y=10, z=1}, {x=100, y=10, z=1}}
}
local fieldId = 1487
doCreateItem(2383, 1, positions.spikeSword)
for b = 4, table.maxn(positions.fieldPos) do
doCreateItem(fieldId, 1, positions.fieldPos[b])
end
return TRUE
end
return TRUE
-- Script by BomBa
end