Ir para conteúdo

[Problema] Problema Com Mana Rune


pedrokkkk

Posts Recomendados

Galera ta dando o seguinte erro com meu script>

[05/12/2010 21:05:14] [Error - Action Interface] 
[05/12/2010 21:05:14] data/actions/scripts/actions novas/manarune.lua:onUse
[05/12/2010 21:05:14] Description: 
[05/12/2010 21:05:14] data/actions/scripts/actions novas/manarune.lua:3: attempt to index local 'topos' (a nil value)
[05/12/2010 21:05:14] stack traceback:
[05/12/2010 21:05:14] 	data/actions/scripts/actions novas/manarune.lua:3: in function <data/actions/scripts/actions novas/manarune.lua:2>

 

 

Meu Script ta assim:

-- New MF rune******--
function onUse(cid, item, frompos, item2, itemEx, topos)
playerpos = {x=topos.x, y=topos.y, z=topos.z, stackpos=253}
player = getThingfromPos(playerpos)
ml = getPlayerMagLevel(cid)
lvl = getPlayerLevel(cid)
formula = math.random(((lvl+ml)*2)-(lvl-ml))
if item2.itemid == 1 and ml >= 2 then
doSendMagicEffect(playerpos,1)
doPlayerAddMana(player.uid,formula)
doPlayerSay(player.uid,"Yeah Mana For me!",2)
if item.type > 1 then
doChangeTypeItem(item.uid,item.type-1)
else
doRemoveItem(item.uid,0)
end
end
if item2.itemid == 1 and ml <= 1 then
doSendMagicEffect(frompos,2)
doPlayerSendCancel(cid,"You dont Have Magic Level to use this rune.")
end
if item2.itemid >= 2 then
doPlayerSendCancel(cid,"You can only use this rune in you or in players.")
doSendMAgicEffect(frompos,2)
end
if((not(isSorcerer(itemEx.uid) or isDruid(itemEx.uid)) or getPlayerLevel(itemEx.uid) < 80) and getPlayerCustomFlagValue(itemEx.uid, PlayerCustomFlag_GamemasterPrivileges) == FALSE) then
	doCreatureSay(itemEx.uid, "Only sorcerers and druids of level 80 or above may drink this fluid.", TALKTYPE_ORANGE_1)
	return TRUE
end


return 1
end

Ajudem plx!! fast!

Editado por Pedrokkkk
Link para o comentário
Compartilhar em outros sites

O script tem item2 e itemEx, so pode ter um, ou item2, ou itemEx

 

Tenta assim:

-- New MF rune******--
function onUse(cid, item, frompos, itemEx, topos)
playerpos = {x=topos.x, y=topos.y, z=topos.z, stackpos=253}
player = getThingfromPos(playerpos)
ml = getPlayerMagLevel(cid)
lvl = getPlayerLevel(cid)
formula = math.random(((lvl+ml)*2)-(lvl-ml))
if itemEx.itemid == 1 and ml >= 2 then
doSendMagicEffect(playerpos,1)
doPlayerAddMana(player.uid,formula)
doPlayerSay(player.uid,"Yeah Mana For me!",2)
if item.type > 1 then
doChangeTypeItem(item.uid,item.type-1)
else
doRemoveItem(item.uid,0)
end
end
if itemEx.itemid == 1 and ml <= 1 then
doSendMagicEffect(frompos,2)
doPlayerSendCancel(cid,"You dont Have Magic Level to use this rune.")
end
if itemEx.itemid >= 2 then
doPlayerSendCancel(cid,"You can only use this rune in you or in players.")
doSendMAgicEffect(frompos,2)
end
if((not(isSorcerer(itemEx.uid) or isDruid(itemEx.uid)) or getPlayerLevel(itemEx.uid) < 80) and getPlayerCustomFlagValue(itemEx.uid, PlayerCustomFlag_GamemasterPrivileges) == FALSE) then
               doCreatureSay(itemEx.uid, "Only sorcerers and druids of level 80 or above may drink this fluid.", TALKTYPE_ORANGE_1)
               return TRUE
       end


return 1
end

Link para o comentário
Compartilhar em outros sites

function onUse(cid, item, frompos, item2, topos)
-- Eskylo --
local ml = 10 --Magic level necessário pra usar a mana rune
local level = 20 --level necessário pra usar a mana rune
local vocs = {1, 2, 5, 6} --Vocações que podem usar a rune

local formula = math.random(((getPlayerLevel(cid)+getPlayerMagLevel(cid))*2)-(getPlayerLevel(cid)-getPlayerMagLevel(cid)))

if getPlayerLevel(cid) < level then
doSendMagicEffect(frompos, 2)
return doPlayerSendCancel(cid "Sorry, you need level "..level.." to use this mana rune.")
elseif getPlayerMagLevel(cid) < ml then
doSendMagicEffect(frompos, 2)
return doPlayerSendCancel(cid "Sorry, you need magic level "..ml.." to use this mana rune.")
elseif not isPlayer(item2.uid) then
doSendMagicEffect(frompos, 2)
return doPlayerSendCancel(cid "Sorry, you can only use this mana rune in players.")
elseif not isInArray(vocs, getPlayerVocation(cid) then
doSendMagicEffect(frompos, 2)
return doPlayerSendCancel(cid "Sorry, your vocation cant use this mana rune.")
end

doSendMagicEffect(getThingPos(item.uid),1)
doCreatureAddMana(item2.uid, formula)
doCreatureSay(cid, "Yeah mana for me!", 2)
doRemoveItem(item.uid, 1)
return true
end

Editado por Eskylo
Link para o comentário
Compartilhar em outros sites

Galera muito obrigado, o problema desapareceu, mas... apareceu outro que é o seguinte:

agora o script nao está usando o math.random, ele só fica healando 3k pois tenho um script no spells assim

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
function onCastSpell(cid, var)
doPlayerAddMana(cid, 3000)
return doCombat(cid, combat, var)
end

:

Link para o comentário
Compartilhar em outros sites

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
function onCastSpell(cid, var)
local n = math.random(2750, 3250)
doPlayerAddMana(cid, n)
return doCombat(cid, combat, var)
end

 

Link para o comentário
Compartilhar em outros sites

mas seguinte, nao era bem isso que eu queria, pois agora ele nao esta healando com o math.rando que ta na action "((lvl+ml)*8)-(lvl-ml)" Por favor tentem arrumar aki pra mim, agradecido -)

Link para o comentário
Compartilhar em outros sites

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
function onCastSpell(cid, var)
local lvl = getPlayerLevel(cid)
local mlvl = getPlayerMagLevel(cid)
local min = Coloque Aqui a Fórmula para o Minimo
local max = Coloque Aqui a Fórmula para o Máximo
local n = math.random(min, max)
doPlayerAddMana(cid, n)
return doCombat(cid, combat, var)
end

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...