pedrokkkk 1 Postado Dezembro 5, 2010 Share Postado Dezembro 5, 2010 (editado) 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 Dezembro 5, 2010 por Pedrokkkk Link para o comentário https://xtibia.com/forum/topic/146288-problema-problema-com-mana-rune/ Compartilhar em outros sites More sharing options...
MatheusGlad 424 Postado Dezembro 6, 2010 Share Postado Dezembro 6, 2010 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 https://xtibia.com/forum/topic/146288-problema-problema-com-mana-rune/#findComment-968505 Compartilhar em outros sites More sharing options...
Eskylo 175 Postado Dezembro 6, 2010 Share Postado Dezembro 6, 2010 (editado) 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 Dezembro 6, 2010 por Eskylo Link para o comentário https://xtibia.com/forum/topic/146288-problema-problema-com-mana-rune/#findComment-968527 Compartilhar em outros sites More sharing options...
pedrokkkk 1 Postado Dezembro 6, 2010 Autor Share Postado Dezembro 6, 2010 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 https://xtibia.com/forum/topic/146288-problema-problema-com-mana-rune/#findComment-968707 Compartilhar em outros sites More sharing options...
Eskylo 175 Postado Dezembro 6, 2010 Share Postado Dezembro 6, 2010 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 https://xtibia.com/forum/topic/146288-problema-problema-com-mana-rune/#findComment-968965 Compartilhar em outros sites More sharing options...
pedrokkkk 1 Postado Dezembro 6, 2010 Autor Share Postado Dezembro 6, 2010 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 https://xtibia.com/forum/topic/146288-problema-problema-com-mana-rune/#findComment-969203 Compartilhar em outros sites More sharing options...
Eskylo 175 Postado Dezembro 9, 2010 Share Postado Dezembro 9, 2010 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 https://xtibia.com/forum/topic/146288-problema-problema-com-mana-rune/#findComment-970700 Compartilhar em outros sites More sharing options...
Posts Recomendados