Ir para conteúdo

[Encerrado] [Pokemon] Dúvidas? - Pda


lucashgas

Posts Recomendados

@Slicer

Vlw mano! REP+ (

Você já atingiu seu limite de reputações positivas para hoje) ¬¬ quando der pra eu dar REP+ eu dou

:D

vou fazer uma coisa aqui em casa, quando eu termina vou começar arruma os level dos pokemons :)

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

Alguém poderia me ajudar com esses erros ?

 

Postarei o erro e o script.

 

 

Erro

 

 

 

[Error - CreatureScript Interface]

data/creaturescripts/scripts/look.lua:onLook

Description:

data/lib/050-function.lua:107: attempt to index local 'str' (a nil value)

stack traceback:

data/lib/050-function.lua:107: in function 'getArticle'

data/creaturescripts/scripts/look.lua:16: in function <data/creaturescripts/scripts/look.lua:1>

 

 

 

Scripts

look.lua

 

 

 

function onLook(cid, thing, position, lookDistance)

 

local str = ""

 

if not isCreature(thing.uid) then

 

local iname = getItemInfo(thing.itemid)

 

if isPokeball(thing.itemid) then

 

local owner = getItemAttribute(thing.uid, "firstpoke")

 

local pokename = getItemAttribute(thing.uid, "poke")

local item = getItemInfo(thing.itemid)

str = "You see "..item.article.." "..item.name..".\n"

str = str.."It contains "..getArticle(pokename).." "..pokename.." [level "..getItemAttribute(thing.uid, "level").."].\n"

 

if owner and owner ~= getCreatureName(cid) then

str = str.."It belongs to "..owner..".\nIt is a unique item."

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)

return false

end

 

local boost = getItemAttribute(thing.uid, "boost") or 0

local boostshow = ""

 

if boost > 0 then

str = str.."Boost level: +"..boost..".\n"

end

 

if getItemAttribute(thing.uid, "nick") then

str = str.."It's nickname is: "..getItemAttribute(thing.uid, "nick")..".\n"

end

 

if getItemAttribute(thing.uid, "gender") == SEX_MALE then

str = str.."It is male."

elseif getItemAttribute(thing.uid, "gender") == SEX_FEMALE then

str = str.."It is female."

else

str = str.."It is genderless."

end

 

str = str.."\n--- Status ---"

str = str.."\nOffense: "..math.floor(getItemAttribute(thing.uid, "offense")).." Defense: "..math.floor(getItemAttribute(thing.uid, "defense")).."\n"

str = str.."Agility: "..math.floor(getItemAttribute(thing.uid, "speed")).." Sp. Attack: "..math.floor(getItemAttribute(thing.uid, "specialattack")).."\n"

str = str.."Vitality: "..math.floor(getItemAttribute(thing.uid, "vitality"))..""

 

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)

 

return false

 

elseif string.find(iname.name, "fainted") or string.find(iname.name, "defeated") then

 

str = "You see a "..string.lower(iname.name).." ["..getItemAttribute(thing.uid, "level").."].\n"

 

if getItemAttribute(thing.uid, "gender") == SEX_MALE then

str = str.."It is male."

elseif getItemAttribute(thing.uid, "gender") == SEX_FEMALE then

str = str.."It is female."

else

str = str.."It is genderless."

end

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)

 

return false

 

else

 

return true

 

end

end

 

local npcname = getCreatureName(thing.uid)

if not isPlayer(thing.uid) and not isMonster(thing.uid) then

str = "You see a "..npcname.."."

if npcname == "Brock" then

str = str.." He is a Leader of the Pewter Gym."

end

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)

return false

end

if isPlayer(thing.uid) and cid == thing.uid then

local city = getPlayerTown(cid)

local cityname = getTownName(city)

if getPlayerVocation(thing.uid) < 4 then

voca = "Pokemon Trainer"

else

voca = getVocationInfo(getPlayerVocation(cid)).name

end

str = "You see Yourself. You are a "..voca.." from "..cityname.."."

local id = getPlayerGroupId(thing.uid)

if id > 2 then

if getPlayerSex(thing.uid) == 0 then

str = str.." She is a"

else

str = str.." He is a"

end

if id == 3 then

str = str.." Tutor."

elseif id == 4 then

str = str.." Game Master."

elseif id == 5 then

str = str.." Sub."

elseif id == 6 then

str = str.." God."

end

end

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)

return false

elseif isPlayer(thing.uid) and cid ~= thing.uid then

str = "You see "..getCreatureName(thing.uid)..","

if getPlayerSex(thing.uid) == 0 then

str = str.." She is a"

else

str = str.." He is a"

end

if getPlayerVocation(thing.uid) > 3 then

str = str.." "..getVocationInfo(getPlayerVocation(thing.uid)).name..""

else

str = str.." Pokemon Trainer"

end

local city = getPlayerTown(cid)

local cityname = getTownName(city)

str = str.." from "..cityname.."."

local id = getPlayerGroupId(thing.uid)

if id > 2 then

if getPlayerSex(thing.uid) == 0 then

str = str.." She is a"

else

str = str.." He is a"

end

if id == 3 then

str = str.." Tutor."

elseif id == 4 then

str = str.." Game Master."

elseif id == 5 then

str = str.." Sub."

elseif id == 6 then

str = str.." God."

end

end

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)

return false

end

 

if not isMonster(thing.uid) then

return true

end

 

if getCreatureName(thing.uid) == "Evolution" then return false end

 

if not isSummon(thing.uid) then

local str = "You see a wild "..string.lower(getCreatureName(thing.uid)).." [level "..getPokemonLevel(thing.uid).."].\n"

if getPokemonGender(thing.uid) == SEX_MALE then

str = str.."It is male."

elseif getPokemonGender(thing.uid) == SEX_FEMALE then

str = str.."It is female."

else

str = str.."It is genderless."

end

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)

return false

elseif isSummon(thing.uid) and not isPlayer(thing.uid) then

 

local boostlevel = getItemAttribute(getPlayerSlotItem(getCreatureMaster(thing.uid), 8).uid, "boost") or 0

local boostshow = " + "..boostlevel.."]"

 

if showBoostSeparated then

boostshow = "] [+"..boostlevel.."]"

end

 

local levelinfo = "["..getPokemonLevel(thing.uid)..""..boostshow..""

 

if getCreatureMaster(thing.uid) == cid then

local myball = getPlayerSlotItem(cid, 8).uid

local nexp = getItemAttribute(myball, "nextlevelexp")

 

local string = "You see your "..string.lower(getCreatureName(thing.uid)).." "..levelinfo.."."

string = string.."\nHit points: "..getCreatureHealth(thing.uid).."/"..getCreatureMaxHealth(thing.uid).."."

string = string.."\n"..getPokemonHappinessDescription(thing.uid)

if getItemAttribute(myball, "level") <= 99 then

string = string.."\nExperience needed to level up: "..nexp.."."

end

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string)

else

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You see a "..string.lower(getCreatureName(thing.uid)).." "..levelinfo..".\nIt belongs to "..getCreatureName(getCreatureMaster(thing.uid))..".")

end

 

 

return false

end

 

return true

end

 

 

 

050-function.lua

 

 

 

function doPlayerGiveItem(cid, itemid, amount, subType)

local item = 0

if(isItemStackable(itemid)) then

item = doCreateItemEx(itemid, amount)

if(doPlayerAddItemEx(cid, item, true) ~= RETURNVALUE_NOERROR) then

return false

end

else

for i = 1, amount do

item = doCreateItemEx(itemid, subType)

if(doPlayerAddItemEx(cid, item, true) ~= RETURNVALUE_NOERROR) then

return false

end

end

end

 

return true

end

 

function doPlayerGiveItemContainer(cid, containerid, itemid, amount, subType)

for i = 1, amount do

local container = doCreateItemEx(containerid, 1)

for x = 1, getContainerCapById(containerid) do

doAddContainerItem(container, itemid, subType)

end

 

if(doPlayerAddItemEx(cid, container, true) ~= RETURNVALUE_NOERROR) then

return false

end

end

 

return true

end

 

function doPlayerTakeItem(cid, itemid, amount)

return getPlayerItemCount(cid, itemid) >= amount and doPlayerRemoveItem(cid, itemid, amount)

end

 

function doPlayerBuyItem(cid, itemid, count, cost, charges)

return doPlayerRemoveMoney(cid, cost) and doPlayerGiveItem(cid, itemid, count, charges)

end

 

function doPlayerBuyItemContainer(cid, containerid, itemid, count, cost, charges)

return doPlayerRemoveMoney(cid, cost) and doPlayerGiveItemContainer(cid, containerid, itemid, count, charges)

end

 

function doPlayerSellItem(cid, itemid, count, cost)

if(not doPlayerTakeItem(cid, itemid, count)) then

return false

end

 

if(not doPlayerAddMoney(cid, cost)) then

error('[doPlayerSellItem] Could not add money to: ' .. getPlayerName(cid) .. ' (' .. cost .. 'gp).')

end

 

return true

end

 

function doPlayerWithdrawMoney(cid, amount)

if(not getBooleanFromString(getConfigInfo('bankSystem'))) then

return false

end

 

local balance = getPlayerBalance(cid)

if(amount > balance or not doPlayerAddMoney(cid, amount)) then

return false

end

 

doPlayerSetBalance(cid, balance - amount)

return true

end

 

function doPlayerDepositMoney(cid, amount)

if(not getBooleanFromString(getConfigInfo('bankSystem'))) then

return false

end

 

if(not doPlayerRemoveMoney(cid, amount)) then

return false

end

 

doPlayerSetBalance(cid, getPlayerBalance(cid) + amount)

return true

end

 

function isPremium(cid)

return (isPlayer(cid) and (getPlayerPremiumDays(cid) > 0 or getBooleanFromString(getConfigInfo('freePremium'))))

end

 

function getMonthDayEnding(day)

if(day == "01" or day == "21" or day == "31") then

return "st"

elseif(day == "02" or day == "22") then

return "nd"

elseif(day == "03" or day == "23") then

return "rd"

end

 

return "th"

end

 

function getMonthString(m)

return os.date("%B", os.time{year = 1970, month = m, day = 1})

end

 

function getArticle(str)

return str:find("[AaEeIiOoUuYy]") == 1 and "an" or "a"

end

 

function isNumber(str)

return tonumber(str) ~= nil

end

 

function doPlayerAddAddons(cid, addon)

for i = 0, table.maxn(maleOutfits) do

doPlayerAddOutfit(cid, maleOutfits, addon)

end

 

for i = 0, table.maxn(femaleOutfits) do

doPlayerAddOutfit(cid, femaleOutfits, addon)

end

end

 

function doPlayerWithdrawAllMoney(cid)

return doPlayerWithdrawMoney(cid, getPlayerBalance(cid))

end

 

function doPlayerDepositAllMoney(cid)

return doPlayerDepositMoney(cid, getPlayerMoney(cid))

end

 

function doPlayerTransferAllMoneyTo(cid, target)

return doPlayerTransferMoneyTo(cid, target, getPlayerBalance(cid))

end

 

function playerExists(name)

return getPlayerGUIDByName(name) ~= 0

end

 

function getTibiaTime()

local minutes = getWorldTime()

local hours = 0

while (minutes > 60) do

hours = hours + 1

minutes = minutes - 60

end

 

return {hours = hours, minutes = minutes}

end

 

function doWriteLogFile(file, text)

local f = io.open(file, "a+")

if(not f) then

return false

end

 

f:write("[" .. os.date("%d/%m/%Y %H:%M:%S") .. "] " .. text .. "\n")

f:close()

return true

end

 

function getExperienceForLevel(lv)

lv = lv - 1

return ((50 * lv * lv * lv) - (150 * lv * lv) + (400 * lv)) / 3

end

 

function doMutePlayer(cid, time)

local condition = createConditionObject(CONDITION_MUTED)

setConditionParam(condition, CONDITION_PARAM_TICKS, time * 1000)

return doAddCondition(cid, condition)

end

 

function getPlayerGroupName(cid)

return getGroupInfo(getPlayerGroupId(cid)).name

end

 

function getPlayerVocationName(cid)

return getVocationInfo(getPlayerVocation(cid)).name

end

 

function getPromotedVocation(vid)

return getVocationInfo(vid).promotedVocation

end

 

function doPlayerRemovePremiumDays(cid, days)

return doPlayerAddPremiumDays(cid, -days)

end

 

function getPlayerMasterPos(cid)

return getTownTemplePosition(getPlayerTown(cid))

end

 

function getHouseOwner(houseId)

return getHouseInfo(houseId).owner

end

 

function getHouseName(houseId)

return getHouseInfo(houseId).name

end

 

function getHouseEntry(houseId)

return getHouseInfo(houseId).entry

end

 

function getHouseRent(houseId)

return getHouseInfo(houseId).rent

end

 

function getHousePrice(houseId)

return getHouseInfo(houseId).price

end

 

function getHouseTown(houseId)

return getHouseInfo(houseId).town

end

 

function getHouseTilesCount(houseId)

return getHouseInfo(houseId).tiles

end

 

function getItemNameById(itemid)

return getItemDescriptionsById(itemid).name

end

 

function getItemPluralNameById(itemid)

return getItemDescriptionsById(itemid).plural

end

 

function getItemArticleById(itemid)

return getItemDescriptionsById(itemid).article

end

 

function getItemName(uid)

return getItemDescriptions(uid).name

end

 

function getItemPluralName(uid)

return getItemDescriptions(uid).plural

end

 

function getItemArticle(uid)

return getItemDescriptions(uid).article

end

 

function getItemText(uid)

return getItemDescriptions(uid).text

end

 

function getItemSpecialDescription(uid)

return getItemDescriptions(uid).special

end

 

function getItemWriter(uid)

return getItemDescriptions(uid).writer

end

 

function getItemDate(uid)

return getItemDescriptions(uid).date

end

 

function getTilePzInfo(pos)

return getTileInfo(pos).protection

end

 

function getTileZoneInfo(pos)

local tmp = getTileInfo(pos)

if(tmp.pvp) then

return 2

end

 

if(tmp.nopvp) then

return 1

end

 

return 0

end

 

function doShutdown()

return doSetGameState(GAMESTATE_SHUTDOWN)

end

 

function doSummonCreature(name, pos, displayError)

local displayError, cid = displayError or true, doCreateMonster(name, pos, displayError)

if(not cid) then

cid = doCreateNpc(name, pos, displayError)

end

 

return cid

end

 

function getOnlinePlayers()

local tmp = getPlayersOnline()

local players = {}

for i, cid in ipairs(tmp) do

table.insert(players, getCreatureName(cid))

end

 

return players

end

 

function getPlayerByName(name)

local cid = getCreatureByName(name)

return isPlayer(cid) and cid or nil

end

 

function isPlayer(cid)

return isCreature(cid) and cid >= AUTOID_PLAYERS and cid < AUTOID_MONSTERS

end

 

function isPlayerGhost(cid)

if(not isPlayer(cid)) then

return false

end

 

return getCreatureCondition(cid, CONDITION_GAMEMASTER, GAMEMASTER_INVISIBLE) or getPlayerFlagValue(cid, PLAYERFLAG_CANNOTBESEEN)

end

 

function isMonster(cid)

return isCreature(cid) and cid >= AUTOID_MONSTERS and cid < AUTOID_NPCS

end

 

function isNpc(cid)

return isCreature(cid) and cid >= AUTOID_NPCS

end

 

function doPlayerSetExperienceRate(cid, value)

return doPlayerSetRate(cid, SKILL__LEVEL, value)

end

 

function doPlayerSetMagicRate(cid, value)

return doPlayerSetRate(cid, SKILL__MAGLEVEL, value)

end

 

function doPlayerAddLevel(cid, amount, round)

local experience, level = 0, getPlayerLevel(cid)

if(amount > 0) then

experience = getExperienceForLevel(level + amount) - (round and getPlayerExperience(cid) or getExperienceForLevel(level))

else

experience = -((round and getPlayerExperience(cid) or getExperienceForLevel(level)) - getExperienceForLevel(level + amount))

end

 

return doPlayerAddExperience(cid, experience)

end

 

function doPlayerAddMagLevel(cid, amount)

for i = 1, amount do

doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid)) / getConfigInfo('rateMagic'))

end

return true

end

 

function doPlayerAddSkill(cid, skill, amount, round)

if(skill == SKILL__LEVEL) then

return doPlayerAddLevel(cid, amount, round)

elseif(skill == SKILL__MAGLEVEL) then

return doPlayerAddMagLevel(cid, amount)

end

 

return doPlayerAddSkillTry(cid, skill, (getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill)) / getConfigInfo('rateSkill'))

end

 

function getPartyLeader(cid)

local party = getPartyMembers(cid)

if(type(party) ~= 'table') then

return 0

end

 

return party[1]

end

 

function isInParty(cid)

return type(getPartyMembers(cid)) == 'table'

end

 

function isPrivateChannel(channelId)

return channelId >= CHANNEL_PRIVATE

end

 

function doPlayerResetIdleTime(cid)

return doPlayerSetIdleTime(cid, 0)

end

 

function doBroadcastMessage(text, class)

local class = class or MESSAGE_STATUS_WARNING

if(type(class) == 'string') then

local className = MESSAGE_TYPES[class]

if(className == nil) then

return false

end

 

class = className

elseif(class < MESSAGE_FIRST or class > MESSAGE_LAST) then

return false

end

 

local players = getPlayersOnline()

for _, pid in ipairs(players) do

doPlayerSendTextMessage(pid, class, text)

end

 

print("> Broadcasted message: \"" .. text .. "\".")

return true

end

 

function doPlayerBroadcastMessage(cid, text, class, checkFlag, ghost)

local checkFlag, ghost, class = checkFlag or true, ghost or false, class or TALKTYPE_BROADCAST

if(checkFlag and not getPlayerFlagValue(cid, PLAYERFLAG_CANBROADCAST)) then

return false

end

 

if(type(class) == 'string') then

local className = TALKTYPE_TYPES[class]

if(className == nil) then

return false

end

 

class = className

elseif(class < TALKTYPE_FIRST or class > TALKTYPE_LAST) then

return false

end

 

local players = getPlayersOnline()

for _, pid in ipairs(players) do

doCreatureSay(cid, text, class, ghost, pid)

end

 

print("> " .. getCreatureName(cid) .. " broadcasted message: \"" .. text .. "\".")

return true

end

 

function getBooleanFromString(input)

local tmp = type(input)

if(tmp == 'boolean') then

return input

end

 

if(tmp == 'number') then

return input > 0

end

 

local str = string.lower(tostring(input))

return (str == "yes" or str == "true" or (tonumber(str) ~= nil and tonumber(str) > 0))

end

 

function doCopyItem(item, attributes)

local attributes = attributes or false

 

local ret = doCreateItemEx(item.itemid, item.type)

if(attributes) then

if(item.actionid > 0) then

doItemSetAttribute(ret, "aid", item.actionid)

end

end

 

if(isContainer(item.uid)) then

for i = (getContainerSize(item.uid) - 1), 0, -1 do

local tmp = getContainerItem(item.uid, i)

if(tmp.itemid > 0) then

doAddContainerItemEx(ret, doCopyItem(tmp, true).uid)

end

end

end

 

return getThing(ret)

end

 

function doRemoveThing(uid)

if(isCreature(uid)) then

return doRemoveCreature(uid)

end

 

return doRemoveItem(uid)

end

 

function setAttackFormula(combat, type, minl, maxl, minm, maxm, min, max)

local min, max = min or 0, max or 0

return setCombatFormula(combat, type, -1, 0, -1, 0, minl, maxl, minm, maxm, min, max)

end

 

function setHealingFormula(combat, type, minl, maxl, minm, maxm, min, max)

local min, max = min or 0, max or 0

return setCombatFormula(combat, type, 1, 0, 1, 0, minl, maxl, minm, maxm, min, max)

end

 

function doChangeTypeItem(uid, subtype)

local thing = getThing(uid)

if(thing.itemid < 100) then

return false

end

 

local subtype = subtype or 1

return doTransformItem(thing.uid, thing.itemid, subtype)

end

 

function doSetItemText(uid, text, writer, date)

local thing = getThing(uid)

if(thing.itemid < 100) then

return false

end

 

doItemSetAttribute(uid, "text", text)

if(writer ~= nil) then

doItemSetAttribute(uid, "writer", tostring(writer))

if(date ~= nil) then

doItemSetAttribute(uid, "date", tonumber(date))

end

end

 

return true

end

 

function getFluidSourceType(itemid)

local item = getItemInfo(itemid)

return item and item.fluidSource or false

end

 

function getDepotId(uid)

return getItemAttribute(uid, "depotid") or false

end

 

function getItemDescriptions(uid)

local thing = getThing(uid)

if(thing.itemid < 100) then

return false

end

 

local item = getItemInfo(thing.itemid)

return {

name = getItemAttribute(uid, "name") or item.name,

plural = getItemAttribute(uid, "pluralname") or item.plural,

article = getItemAttribute(uid, "article") or item.article,

special = getItemAttribute(uid, "description") or "",

text = getItemAttribute(uid, "text") or "",

writer = getItemAttribute(uid, "writer") or "",

date = getItemAttribute(uid, "date") or 0

}

end

 

function getItemWeightById(itemid, count, precision)

local item, count, precision = getItemInfo(itemid), count or 1, precision or false

if(not item) then

return false

end

 

if(count > 100) then

-- print a warning, as its impossible to have more than 100 stackable items without "cheating" the count

print('[Warning] getItemWeightById', 'Calculating weight for more than 100 items!')

end

 

local weight = item.weight * count

--[[if(precision) then

return weight

end

 

local t = string.explode(tostring(weight), ".")

if(table.maxn(t) == 2) then

return tonumber(t[1] .. "." .. string.sub(t[2], 1, 2))

end]]--

 

return weight

end

 

function getItemWeaponType(uid)

local thing = getThing(uid)

if(thing.itemid < 100) then

return false

end

 

return getItemInfo(thing.itemid).weaponType

end

 

function getItemRWInfo(uid)

local thing = getThing(uid)

if(thing.itemid < 100) then

return false

end

 

local item, flags = getItemInfo(thing.itemid), 0

if(item.readable) then

flags = 1

end

 

if(item.writable) then

flags = flags + 2

end

 

return flags

end

 

function getItemLevelDoor(itemid)

local item = getItemInfo(itemid)

return item and item.levelDoor or false

end

 

function isItemStackable(itemid)

local item = getItemInfo(itemid)

return item and item.stackable or false

end

 

function isItemRune(itemid)

local item = getItemInfo(itemid)

return item and item.clientCharges or false

end

 

function isItemDoor(itemid)

local item = getItemInfo(itemid)

return item and item.type == 5 or false

end

 

function isItemContainer(itemid)

local item = getItemInfo(itemid)

return item and item.group == 2 or false

end

 

function isItemFluidContainer(itemid)

local item = getItemInfo(itemid)

return item and item.group == 12 or false

end

 

function isItemMovable(itemid)

local item = getItemInfo(itemid)

return item and item.movable or false

end

 

function isCorpse(uid)

local thing = getThing(uid)

if(thing.itemid < 100) then

return false

end

 

local item = getItemInfo(thing.itemid)

return item and item.corpseType ~= 0 or false

end

 

function getContainerCapById(itemid)

local item = getItemInfo(itemid)

if(not item or item.group ~= 2) then

return false

end

 

return item.maxItems

end

 

function getMonsterAttackSpells(name)

local monster = getMonsterInfo(name)

return monster and monster.attacks or false

end

 

function getMonsterHealingSpells(name)

local monster = getMonsterInfo(name)

return monster and monster.defenses or false

end

 

function getMonsterLootList(name)

local monster = getMonsterInfo(name)

return monster and monster.loot or false

end

 

function getMonsterSummonList(name)

local monster = getMonsterInfo(name)

return monster and monster.summons or false

end

 

 

 

 

Erro

 

 

 

 

[Error - TalkAction Interface]

In a timer event called from:

data/talkactions/scripts/cdbar.lua:onSay

Description:

(luaGetCreatureMaxHealth) Creature not found

 

[Error - TalkAction Interface]

In a timer event called from:

data/talkactions/scripts/cdbar.lua:onSay

Description:

data/lib/some functions.lua:308: attempt to perform arithmetic on a boolean value

stack traceback:

data/lib/some functions.lua:308: in function <data/lib/some functions.lua:293>

 

 

 

Script

 

Cdbar.lua

 

 

 

local function ChangeBalls(cid, param, cancelequal)

local balls = getPlayerPokeballs(cid)

for a = 1, #balls do

local item = balls[a]

local name = getItemAttribute(item.uid, "poke") .. getItemAttribute(item.uid, "ballorder")

if name == param then

if cancelequal and item.uid == getPlayerSlotItem(cid, 8).uid then return true end

doChangeBalls(cid, getPlayerSlotItem(cid, 8), item)

return 0

end

end

end

 

function onSay(cid, words, param)

 

if not useKpdoDlls then return true end

 

if words == "!code64" then

return 0

end

 

if words == "/pokeread" then

if #getCreatureSummons(cid) >= 1 then

local pokemon = getCreatureSummons(cid)[1]

local pokelife = (getCreatureHealth(pokemon) / getCreatureMaxHealth(pokemon))

doItemSetAttribute(getPlayerSlotItem(cid, 8).uid, "hp", pokelife)

end

doUpdatePokemonsBar(cid)

end

 

if words == "/goaction" then

if param == "null" then return 0 end

if exhaustion.get(cid, 6666) and exhaustion.get(cid, 6666) > 0 then return true end

if getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 17001) >= 1 or getPlayerStorageValue(cid, 63215) >= 1 then return true end

if #getCreatureSummons(cid) >= 1 then

addEvent(doReturnPokemon, 100, cid, getCreatureSummons(cid)[1], false, pokeballs[getPokeballType(getPlayerSlotItem(cid, 8).itemid)].effect)

if param ~= getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke") .. getItemAttribute(getPlayerSlotItem(cid, 8).uid, "ballorder") then

addEvent(ChangeBalls, 1200, cid, param, true)

end

else

addEvent(ChangeBalls, 100, cid, param)

end

exhaustion.set(cid, 6666, 2)

return 0

end

 

return 0

end

 

 

 

Some functions.lua

 

 

 

local hitmonchans = {

["Hitmonchan"] = {

[0] = {out = 559, eff = 112, type = FIGHTINGDAMAGE}, --outfit normal

[1] = {out = 1075, eff = 35, type = FIREDAMAGE}, --outfit fogo

[2] = {out = 1077, eff = 48, type = ELECTRICDAMAGE}, --outfit raio

[3] = {out = 1078, eff = 43, type = ICEDAMAGE}, --outfit gelo

[4] = {out = 1076, eff = 140, type = GHOSTDAMAGE} --outfit ghost

},

 

["Shiny Hitmonchan"] = {

--aconcelho trocar a outfit do shiny hitmonchan pela do elite hitmonchan do PO...

[0] = {out = 837, eff = 112, type = FIGHTINGDAMAGE}, --outfit normal

[1] = {out = 1080, eff = 35, type = FIREDAMAGE}, --outfit fogo

[2] = {out = 1081, eff = 48, type = ELECTRICDAMAGE}, --outfit raio

[3] = {out = 1082, eff = 43, type = ICEDAMAGE}, --outfit gelo

[4] = {out = 1079, eff = 140, type = GHOSTDAMAGE} --outfit ghost

}

}

 

function choose(...) -- by mock

local arg = {...}

return arg[math.random(1,#arg)]

end

 

function getThingPosWithDebug(what)

if not isCreature(what) or getCreatureHealth(what) <= 0 then

return {x = 1, y = 1, z = 1}

end

return getThingPos(what)

end

 

function doConvertTypeToStone(type, string)

local t = {

["fly"] = {heart, "heart"},

["flying"] = {heart, "heart"},

["normal"] = {heart, "heart"},

["fire"] = {fire, "fire"},

["grass"] = {leaf, "leaf"},

["leaf"] = {leaf, "leaf"},

["water"] = {water, "water"},

["poison"] = {venom, "venom"},

["venom"] = {venom, "venom"},

["electric"] = {thunder, "thunder"},

["thunder"] = {thunder, "thunder"},

["rock"] = {rock, "rock"},

["fight"] = {punch, "punch"},

["fighting"] = {punch, "punch"},

["bug"] = {coccon, "coccon"},

["dragon"] = {crystal, "crystal"},

["dark"] = {dark, "dark"},

["ghost"] = {dark, "dark"},

["ground"] = {earth, "earth"},

["earth"] = {earth, "earth"},

["psychic"] = {enigma, "enigma"},

["steel"] = {metal, "metal"},

["metal"] = {metal, "metal"},

["ice"] = {ice, "ice"},

}

 

if string then

return t[type][2]

else

return t[type][1]

end

end

 

function isStone(id)

if id >= leaf and id <= ice then

return true

end

return false

end

 

function isWater(id)

if id >= 4820 and id <= 4825 then

return true

end

return false

end

 

function getTopCorpse(position)

local pos = position

 

for n = 1, 255 do

 

pos.stackpos = n

local item = getTileThingByPos(pos)

 

if item.itemid >= 2 and (string.find(getItemNameById(item.itemid), "fainted ") or string.find(getItemNameById(item.itemid), "defeated ")) then

return getTileThingByPos(pos)

end

end

return null

end

 

bpslot = CONST_SLOT_BACKPACK

 

function hasPokemon(cid)

if not isCreature(cid) then return false end

if getCreatureMana(cid) <= 0 then return false end

if #getCreatureSummons(cid) >= 1 then return true end

local item = getPlayerSlotItem(cid, CONST_SLOT_FEET)

local bp = getPlayerSlotItem(cid, bpslot)

for a, b in pairs (pokeballs) do

if item.itemid == b.on then

return true

end

if #getItemsInContainerById(bp.uid, b.on) >= 1 then

return true

end

end

return false

end

 

function isNpcSummon(cid)

return isNpc(getCreatureMaster(cid))

end

 

function getPokemonHappinessDescription(cid)

if not isCreature(cid) then return true end

local str = ""

if getPokemonGender(cid) == SEX_MALE then

str = "He"

elseif getPokemonGender(cid) == SEX_FEMALE then

str = "She"

else

str = "It"

end

local h = getPlayerStorageValue(cid, 1008)

if h >= tonumber(getConfigValue('PokemonStageVeryHappy')) then

str = str.." is very happy with you!"

elseif h >= tonumber(getConfigValue('PokemonStageHappy')) then

str = str.." is happy."

elseif h >= tonumber(getConfigValue('PokemonStageOK')) then

str = str.." is unhappy."

elseif h >= tonumber(getConfigValue('PokemonStageSad')) then

str = str.." is sad."

elseif h >= tonumber(getConfigValue('PokemonStageMad')) then

str = str.." is mad."

else

str = str.." is very mad at you!"

end

return str

end

 

function doSetItemAttribute(item, key, value)

doItemSetAttribute(item, key, value)

end

 

function deTransform(cid, check)

if not isCreature(cid) then return true end

 

local m = getCreatureMaster(cid)

local p = getPlayerSlotItem(m, 8)

 

if getItemAttribute(p.uid, "transTurn") ~= check then return true end

 

setPlayerStorageValue(cid, 1010, "Ditto")

doRemoveCondition(cid, CONDITION_OUTFIT)

doSendMagicEffect(getThingPos(cid), 184)

doCreatureSay(cid, "DITTO!", TALKTYPE_MONSTER)

doItemSetAttribute(p.uid, "transBegin", 0)

doItemSetAttribute(p.uid, "transLeft", 0)

doItemEraseAttribute(p.uid, "transName")

doItemEraseAttribute(p.uid, "boffense")

doItemEraseAttribute(p.uid, "bdefense")

doItemEraseAttribute(p.uid, "bsattack")

doItemEraseAttribute(p.uid, "bagility")

end

 

function isTransformed(cid)

if getPlayerStorageValue(cid, 1010) == "Ditto" then

return false

else

return true

end

end

 

function doSendFlareEffect(pos)

local random = {28, 29, 79}

doSendMagicEffect(pos, random[math.random(1, 3)])

end

 

function isDay()

local a = getWorldTime()

if a >= 360 and a < 1080 then

return true

end

return false

end

 

function doPlayerSendTextWindow(cid, p1, p2)

if not isCreature(cid) then return true end

local item = 460

local text = ""

if type(p1) == "string" then

doShowTextDialog(cid, item, p1)

else

doShowTextDialog(cid, p1, p2)

end

end

 

function getClockString(tw)

local a = getWorldTime()

local b = a / 60

local hours = math.floor(b)

local minut = a - (60 * hours)

 

if not tw then

if hours < 10 then

hours = "0"..hours..""

end

if minut < 10 then

minut = "0"..minut..""

end

return hours..":"..minut

else

local sm = "a.m"

if hours >= 12 then

hours = hours - 12

sm = "p.m"

end

if hours < 10 then

hours = "0"..hours..""

end

if minut < 10 then

minut = "0"..minut..""

end

return hours..":"..minut.." "..sm

end

end

 

function doCorrectPokemonName(poke)

return doCorrectString(poke)

end

 

function doCorrectString(poke)

local name = ""

local n = string.explode(poke, " ")

local str = string.sub(n[1], 1, 1)

local sta = string.sub(n[1], 2, string.len(n[1]))

name = ""..string.upper(str)..""..string.lower(sta)..""

if n[2] then

str = string.sub(n[2], 1, 1)

sta = string.sub(n[2], 2, string.len(n[2]))

name = name.." "..string.upper(str)..""..string.lower(sta)..""

end

return name

end

 

function getHappinessRate(cid)

if not isCreature(cid) then return 1 end

local a = getPlayerStorageValue(cid, 1008)

if a == -1 then return 1 end

if a >= getConfigValue('PokemonStageVeryHappy') then

return happinessRate[5].rate

elseif a >= getConfigValue('PokemonStageHappy') then

return happinessRate[4].rate

elseif a >= getConfigValue('PokemonStageOK') then

return happinessRate[3].rate

elseif a >= getConfigValue('PokemonStageSad') then

return happinessRate[2].rate

else

return happinessRate[1].rate

end

return 1

end

 

function doBodyPush(cid, target, go, pos)

if not isCreature(cid) or not isCreature(target) then

doRegainSpeed(cid)

doRegainSpeed(target)

return true

end

if go then

local a = getThingPos(cid)

doChangeSpeed(cid, -getCreatureSpeed(cid))

if not isPlayer(target) then

doChangeSpeed(target, -getCreatureSpeed(target))

end

doChangeSpeed(cid, 800)

doTeleportThing(cid, getThingPos(target))

doChangeSpeed(cid, -800)

addEvent(doBodyPush, 350, cid, target, false, a)

else

doChangeSpeed(cid, 800)

doTeleportThing(cid, pos)

doRegainSpeed(cid)

doRegainSpeed(target)

end

end

 

function doReturnPokemon(cid, pokemon, pokeball, effect, hideeffects, blockevo)

 

local edit = true

 

if not pokeball then

pokeball = getPlayerSlotItem(cid, 8)

end

 

if blockevo then

edit = false

doPlayerSendCancel(cid, "Your pokemon couldn't evolve due to server mistakes, please wait until we fix the problem.")

end

 

local happy = getPlayerStorageValue(pokemon, 1008)

local hunger = getPlayerStorageValue(pokemon, 1009)

local pokelife = (getCreatureHealth(pokemon) / getCreatureMaxHealth(pokemon))

 

if edit then

doItemSetAttribute(pokeball.uid, "happy", happy)

doItemSetAttribute(pokeball.uid, "hunger", hunger)

doItemSetAttribute(pokeball.uid, "hp", pokelife)

end

 

if getCreatureName(pokemon) == "Ditto" then

if isTransformed(pokemon) then

local left = getItemAttribute(pokeball.uid, "transLeft") - (os.clock() - getItemAttribute(pokeball.uid, "transBegin"))

doItemSetAttribute(pokeball.uid, "transLeft", left)

end

end

 

if hideeffects then

doRemoveCreature(pokemon)

return true

end

 

local pokename = getPokeName(pokemon)

 

local mbk = gobackmsgs[math.random(1, #gobackmsgs)].back:gsub("doka", pokename)

 

if getCreatureCondition(cid, CONDITION_INFIGHT) then

if isCreature(getCreatureTarget(cid)) then

doItemSetAttribute(pokeball.uid, "happy", happy - 5)

else

doItemSetAttribute(pokeball.uid, "happy", happy - 2)

end

end

 

doTransformItem(pokeball.uid, pokeball.itemid-1)

doCreatureSay(cid, mbk, TALKTYPE_SAY)

 

doSendMagicEffect(getCreaturePosition(pokemon), effect)

 

doRemoveCreature(pokemon)

 

if useKpdoDlls then

doUpdateMoves(cid)

end

 

end

 

function doGoPokemon(cid, item)

 

if getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 17001) >= 1 or getPlayerStorageValue(cid, 63215) >= 1 then

return true

end

 

local btype = getPokeballType(item.itemid)

 

local effect = pokeballs[btype].effect

if not effect then

effect = 21

end

 

if item.uid ~= getPlayerSlotItem(cid, CONST_SLOT_FEET).uid then

doPlayerSendCancel(cid, "You must put your pokeball in the correct place!")

return TRUE

end

 

local thishp = getItemAttribute(item.uid, "hp")

 

if thishp <= 0 then

if isInArray(pokeballs[btype].all, item.itemid) then

doTransformItem(item.uid, pokeballs[btype].off)

doItemSetAttribute(item.uid, "hp", 0)

doPlayerSendCancel(cid, "This pokemon is fainted.")

return true

end

end

 

local pokemon = getItemAttribute(item.uid, "poke")

 

if not pokes[pokemon] then

return true

end

 

local x = pokes[pokemon]

local boosts = getItemAttribute(item.uid, "boost") or 0

 

if getPlayerLevel(cid) + pokemonMaxLevelAbovePlayer < getItemAttribute(item.uid, "level") then

doPlayerSendCancel(cid, "Your pokemon's level is much higher than yours, you can't use him.")

return true

end

 

doSummonMonster(cid, pokemon)

 

local pk = getCreatureSummons(cid)[1]

if not isCreature(pk) then return true end

 

------------------------passiva hitmonchan------------------------------

if isSummon(pk) then

--local e = getCreatureMaster(cid)

local nameHIT = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")

local hands = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "hands")

if nameHIT == "Shiny Hitmonchan" or nameHIT == "Hitmonchan" then

if getItemAttribute(getPlayerSlotItem(cid, 8).uid, "hands") then

doSetCreatureOutfit(pk, {lookType = hitmonchans[nameHIT][hands].out}, -1)

else

doPlayerSendTextMessage(cid, 27, "Contact a GameMaster! Error in passive system! Attribute \"hands\" missing")

end

end

end

-------------------------------------------------------------------------

 

if getCreatureName(pk) == "Ditto" then

 

local left = getItemAttribute(item.uid, "transLeft")

local name = getItemAttribute(item.uid, "transName")

 

if left and left > 0 then

setPlayerStorageValue(pk, 1010, name)

doSetCreatureOutfit(pk, {lookType = getItemAttribute(item.uid, "transOutfit")}, -1)

addEvent(deTransform, left * 1000, pk, getItemAttribute(item.uid, "transTurn"))

doItemSetAttribute(item.uid, "transBegin", os.clock())

else

setPlayerStorageValue(pk, 1010, "Ditto")

end

end

 

if isGhostPokemon(pk) then doTeleportThing(pk, getPosByDir(getThingPos(cid), math.random(0, 7)), false) end

 

doCreatureSetLookDir(pk, 2)

 

adjustStatus(pk, item.uid, true, false, true)

doAddPokemonInOwnList(cid, pokemon)

 

doTransformItem(item.uid, item.itemid+1)

 

local pokename = getItemAttribute(item.uid, "nick") or getCreatureName(pk)

 

local mgo = gobackmsgs[math.random(1, #gobackmsgs)].go:gsub("doka", pokename)

doCreatureSay(cid, mgo, TALKTYPE_SAY)

 

doSendMagicEffect(getCreaturePosition(pk), effect)

 

if useKpdoDlls then

doUpdateMoves(cid)

end

end

 

function doRegainSpeed(cid)

if not isCreature(cid) then return 0 end

if isPlayer(cid) then

doChangeSpeed(cid, - getCreatureSpeed(cid))

doChangeSpeed(cid, PlayerSpeed)

return PlayerSpeed

end

local speed = getCreatureBaseSpeed(cid) + getSpeed(cid) * speedRate

if speed > 1500 then

speed = 1500

end

doChangeSpeed(cid, - getCreatureSpeed(cid))

doChangeSpeed(cid, speed)

return speed

end

 

function isPosEqualPos(pos1, pos2, checkstackpos)

if pos1.x ~= pos2.x or pos1.y ~= pos2.y and pos1.z ~= pos2.z then

return false

end

if checkstackpos and pos1.stackpos and pos2.stackpos and pos1.stackpos ~= pos2.stackpos then

return false

end

return true

end

 

function getRandomGenderByName(name)

local rate = newpokedex[name]

if not rate then return 0 end

rate = rate.gender

if rate == 0 then

gender = 3

elseif rate == 1000 then

gender = 4

elseif rate == -1 then

gender = 0

elseif math.random(1, 1000) <= rate then

gender = 4

else

gender = 3

end

return gender

end

 

function getRecorderPlayer(pos, cid)

local ret = 0

if cid and getThingPos(cid).x == pos.x and getThingPos(cid).y == pos.y then

return cid

end

local s = {}

s.x = pos.x

s.y = pos.y

s.z = pos.z

for a = 0, 255 do

s.stackpos = a

local b = getTileThingByPos(s).uid

if b > 1 and isPlayer(b) and getCreatureOutfit(b).lookType ~= 814 then

ret = b

end

end

return ret

end

 

function doCreatureSetOutfit(cid, outfit, time)

doSetCreatureOutfit(cid, outfit, time)

end

 

function doMagicalFlower(cid, away)

if not isCreature(cid) then return true end

for x = -3, 3 do

for y = -3, 3 do

local a = getThingPos(cid)

a.x = a.x + x

a.y = a.y + y

if away then

doSendDistanceShoot(a, getThingPos(cid), 21)

else

doSendDistanceShoot(getThingPos(cid), a, 21)

end

end

end

end

 

function isItemPokeball(item)

if not item then return false end

for a, b in pairs (pokeballs) do

if isInArray(b.all, item) then return true end

end

return false

end

 

function isPokeball(item)

if not item then return false end

if item >= 11826 and item <= 11837 then

return true

end

if item >= 11737 and item <= 11748 then

return true

end

return false

end

 

function getPokeballType(id)

for a, b in pairs (pokeballs) do

if isInArray(b.all, id) then

return a

end

end

return "none"

end

 

randomdiagonaldir = {

[NORTHEAST] = {NORTH, EAST},

[sOUTHEAST] = {SOUTH, EAST},

[NORTHWEST] = {NORTH, WEST},

[sOUTHWEST] = {SOUTH, WEST}}

 

function doFaceOpposite(cid)

local a = getCreatureLookDir(cid)

local d = {

[NORTH] = SOUTH,

[sOUTH] = NORTH,

[EAST] = WEST,

[WEST] = EAST,

[NORTHEAST] = SOUTHWEST,

[NORTHWEST] = SOUTHEAST,

[sOUTHEAST] = NORTHWEST,

[sOUTHWEST] = NORTHEAST}

doCreatureSetLookDir(cid, d[a])

end

 

function doFaceRandom(cid)

local a = getCreatureLookDir(cid)

local d = {

[NORTH] = {SOUTH, WEST, EAST},

[sOUTH] = {NORTH, WEST, EAST},

[WEST] = {SOUTH, NORTH, EAST},

[EAST] = {SOUTH, WEST, NORTH}}

doChangeSpeed(cid, 1)

doCreatureSetLookDir(cid, d[a][math.random(1, 3)])

doChangeSpeed(cid, -1)

end

 

function getFaceOpposite(dir)

local d = {

[NORTH] = SOUTH,

[sOUTH] = NORTH,

[EAST] = WEST,

[WEST] = EAST,

[NORTHEAST] = SOUTHWEST,

[NORTHWEST] = SOUTHEAST,

[sOUTHEAST] = NORTHWEST,

[sOUTHWEST] = NORTHEAST}

return d[dir]

end

 

function getResistance(cid, combat)

if isPlayer(cid) then return false end

local poketype1 = pokes[getCreatureName(cid)].type

local poketype2 = pokes[getCreatureName(cid)].type2

local multiplier = 1

if effectiveness[combat].super and isInArray(effectiveness[combat].super, poketype1) then

multiplier = multiplier * 2

end

if poketype2 and effectiveness[combat].super and isInArray(effectiveness[combat].super, poketype2) then

multiplier = multiplier * 2

end

if effectiveness[combat].weak and isInArray(effectiveness[combat].weak, poketype1) then

multiplier = multiplier * 0.5

end

if poketype2 and effectiveness[combat].weak and isInArray(effectiveness[combat].weak, poketype2) then

multiplier = multiplier * 0.5

end

if effectiveness[combat].non and isInArray(effectiveness[combat].non, poketype1) then

multiplier = multiplier * 0

end

if poketype2 and effectiveness[combat].non and isInArray(effectiveness[combat].non, poketype2) then

multiplier = multiplier * 0

end

 

if multiplier == 0.25 then

multiplier = 0.5

elseif multiplier == 4 then

multiplier = 2

end

 

return multiplier

end

 

function getCreatureDirectionToTarget(cid, target, ranged)

if not isCreature(cid) then return true end

if not isCreature(target) then return getCreatureLookDir(cid) end

local dirs = {

[NORTHEAST] = {NORTH, EAST},

[sOUTHEAST] = {SOUTH, EAST},

[NORTHWEST] = {NORTH, WEST},

[sOUTHWEST] = {SOUTH, WEST}}

local x = getDirectionTo(getThingPos(cid), getThingPos(target), false)

if x <= 3 then return x

else

local xdistance = math.abs(getThingPos(cid).x - getThingPos(target).x)

local ydistance = math.abs(getThingPos(cid).y - getThingPos(target).y)

if xdistance > ydistance then

return dirs[x][2]

elseif ydistance > xdistance then

return dirs[x][1]

elseif isInArray(dirs[x], getCreatureLookDir(cid)) then

return getCreatureLookDir(cid)

else

return dirs[x][math.random(1, 2)]

end

end

end

 

function getSomeoneDescription(cid)

if isPlayer(cid) then return getPlayerNameDescription(cid) end

return getMonsterInfo(getCreatureName(cid)).description

end

 

 

function isGhostPokemon(cid)

if not isCreature(cid) then return false end

if isInArray({"Gengar", "Haunter", "Gastly", "Misdreavus"}, getCreatureName(cid)) then

return true

end

return false

end

 

function updateGhostWalk(cid)

if not isCreature(cid) then return false end

local pos = getThingPos(cid)

pos.x = pos.x + 1

pos.y = pos.y + 1

local ret = getThingPos(cid)

doTeleportThing(cid, pos, false)

doTeleportThing(cid, ret, false)

return true

end

 

function doRemoveElementFromTable(t, e)

local ret = {}

for a = 1, #t do

if t[a] ~= e then

table.insert(ret, t[a])

end

end

return ret

end

 

function doFaceCreature(sid, pos)

if not isCreature(sid) then return true end

if getThingPos(sid).x == pos.x and getThingPos(sid).y == pos.y then return true end

local ret = 0

 

local ld = getCreatureLookDir(sid)

local dir = getDirectionTo(getThingPos(sid), pos)

local al = {

[NORTHEAST] = {NORTH, EAST},

[NORTHWEST] = {NORTH, WEST},

[sOUTHEAST] = {SOUTH, EAST},

[sOUTHWEST] = {SOUTH, WEST}}

 

if dir >= 4 and isInArray(al[dir], ld) then return true end

 

doChangeSpeed(sid, 1)

if dir == 4 then

ret = math.random(2, 3)

elseif dir == 5 then

ret = math.random(1, 2)

elseif dir == 6 then

local dirs = {0, 3}

ret = dirs[math.random(1, 2)]

elseif dir == 7 then

ret = math.random(0, 1)

else

ret = getDirectionTo(getThingPos(sid), pos)

end

doCreatureSetLookDir(sid, ret)

doChangeSpeed(sid, -1)

return true

end

 

function doCreatureAddCondition(cid, condition)

if not isCreature(cid) then return true end

doAddCondition(cid, condition)

end

 

function doCreatureRemoveCondition(cid, condition)

if not isCreature(cid) then return true end

doRemoveCondition(cid, condition)

end

 

function setCD(item, tipo, tempo)

 

if not tempo or not tonumber(tempo) then

doItemEraseAttribute(item, tipo)

return true

end

 

doItemSetAttribute(item, tipo, "cd:"..(tempo + os.time()).."")

return tempo + os.time()

end

 

function getCD(item, tipo, limite)

 

if not getItemAttribute(item, tipo) then

return 0

end

 

local string = getItemAttribute(item, tipo):gsub("cd:", "")

local number = tonumber(string) - os.time()

 

if number <= 0 then

return 0

end

 

if limite and limite < number then

return 0

end

 

return number

end

 

function getPosfromArea(cid,area)

icenter = math.floor(table.getn(area)/2)+1

jcenter = math.floor(table.getn(area[1])/2)+1

center = area[icenter]

ivar = table.getn(area)

jvar = table.getn(area[1])

i = table.getn(area)^2

j = table.getn(area[1])^2

 

if center[jcenter] == 3 then

if getPlayerLookDir(cid) == 0 then

signal = {-1,1,1,2}

elseif getPlayerLookDir(cid) == 1 then

signal = {1,-1,2,1}

elseif getPlayerLookDir(cid) == 2 then

signal = {1,-1,1,2}

else

signal = {-1,1,2,1}

end

else

signal = {-1,1,1,2}

end

 

POSITIONS = {}

P = 0

 

repeat

pvar = {0,0}

I = area[ivar]

J = I[jvar]

i = i-1

j = j-1

if J == 1 then

if jvar < jcenter then

pvar[signal[3]] = signal[1]*math.abs((jcenter-jvar))

elseif jvar > jcenter then

pvar[signal[3]] = signal[2]*math.abs((jcenter-jvar))

end

 

if ivar < icenter then

pvar[signal[4]] = signal[1]*math.abs((icenter-ivar))

elseif ivar > icenter then

pvar[signal[4]] = signal[2]*math.abs((icenter-ivar))

end

end

if jvar > 1 then

jvar = (jvar-1)

elseif ivar > 1 then

jvar = table.getn(area[1])

ivar = (ivar-1)

end

local pos = getThingPos(cid)

local areapos = {x=pos.x+(pvar[1]),y=pos.y+(pvar[2]),z=pos.z}

if pos.x ~= areapos.x or pos.y ~= areapos.y then

P = P+1

POSITIONS[P] = areapos

end

until i <= 0 and j <= 0

 

return POSITIONS

end

 

function doSendMoveEffect(cid, target, effect)

if not isCreature(cid) or not isCreature(target) then return true end

doSendDistanceShoot(getThingPos(cid), getThingPos(target), effect)

return true

end

 

function doSetItemActionId(uid, actionid)

doItemSetAttribute(uid, "aid", actionid)

return true

end

 

function threeNumbers(number)

if number <= 9 then

return "00"..number..""

elseif number <= 99 then

return "0"..number..""

end

return ""..number..""

end

 

function isBr(cid)

if getPlayerStorageValue(cid, 105505) ~= -1 then

return true

end

return false

end

 

function isBeingUsed(ball)

if isInArray({11827, 11830, 11833, 11836, 11738, 11741, 11744, 11747}, ball) then

return true

end

return false

end

 

function doRemoveTile(pos)-- Script by mock

pos.stackpos = 0

local sqm = getTileThingByPos(pos)

doRemoveItem(sqm.uid,1)

end

 

function doCreateTile(id,pos) -- By mock

doAreaCombatHealth(0,0,pos,0,0,0,CONST_ME_NONE)

doCreateItem(id,1,pos)

end

 

function hasSqm(pos)

local f = getTileThingByPos(pos)

if f.itemid ~= 0 and f.itemid ~= 1 then

return true

end

return false

end

 

function getPosDirs(p, dir) -- By MatheusMkalo

return dir == 1 and {x=p.x-1, y=p.y, z=p.z} or dir == 2 and {x=p.x-1, y=p.y+1, z=p.z} or dir == 3 and {x=p.x, y=p.y+1, z=p.z} or dir == 4 and {x=p.x+1, y=p.y+1, z=p.z} or dir == 5 and {x=p.x+1, y=p.y, z=p.z} or dir == 6 and {x=p.x+1, y=p.y-1, z=p.z} or dir == 7 and {x=p.x, y=p.y-1, z=p.z} or dir == 8 and {x=p.x-1, y=p.y-1, z=p.z}

end

 

function canWalkOnPos(pos, creature, pz, water, sqm, proj)

if not pos then return false end

if not pos.x then return false end

if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid <= 1 and sqm then return false end

if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 919 then return false end

if isInArray({4820, 4821, 4822, 4823, 4824, 4825}, getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid) and water then return false end

if getTopCreature(pos).uid > 0 and creature then return false end

if getTileInfo(pos).protection and pz then return false end

local n = not proj and 3 or 2

for i = 0, 255 do

pos.stackpos = i

local tile = getTileThingByPos(pos)

if tile.itemid ~= 0 and not isCreature(tile.uid) then

if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then

return false

end

end

end

return true

end

 

function getFreeTile(pos, cid)

if canWalkOnPos(pos, true, false, true, true, false) then

return pos

end

local positions = {}

for a = 0, 7 do

if canWalkOnPos(getPosByDir(pos, a), true, false, true, true, false) then

table.insert(positions, pos)

end

end

if #positions >= 1 then

if isCreature(cid) then

local range = 1000

local ret = getThingPos(cid)

for b = 1, #positions do

if getDistanceBetween(getThingPos(cid), positions) < range then

ret = positions

range = getDistanceBetween(getThingPos(cid), positions)

end

end

return ret

else

return positions[math.random(#positions)]

end

end

return getThingPos(cid)

end

 

function isWalkable(pos, creature, proj, pz, water)-- by Nord

if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end

if isWater(getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid) and water then return false end

if getTopCreature(pos).uid > 0 and creature then return false end

if getTileInfo(pos).protection and pz then return false, true end

local n = not proj and 3 or 2

for i = 0, 255 do

pos.stackpos = i

local tile = getTileThingByPos(pos)

if tile.itemid ~= 0 and not isCreature(tile.uid) then

if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then

return false

end

end

end

return true

end

 

 

function isPlayerSummon(cid, uid)

if getCreatureMaster(uid) == cid then

return TRUE

end

return FALSE

end

 

function isSummon(sid)

if isPlayer(sid) then

return false

end

if isPlayer(getCreatureMaster(sid)) then

return true

end

return false

end

 

function getItemsInContainerById(container, itemid) -- Function By Kydrai

local items = {}

if isContainer(container) and getContainerSize(container) > 0 then

for slot=0, (getContainerSize(container)-1) do

local item = getContainerItem(container, slot)

if isContainer(item.uid) then

local itemsbag = getItemsInContainerById(item.uid, itemid)

for i=0, #itemsbag do

table.insert(items, itemsbag)

end

else

if itemid == item.itemid then

table.insert(items, item.uid)

end

end

end

end

return items

end

 

function getPokeballsInContainer(container) -- Function By Kydrai

if not isContainer(container) then return {} end

local items = {}

if isContainer(container) and getContainerSize(container) > 0 then

for slot=0, (getContainerSize(container)-1) do

local item = getContainerItem(container, slot)

if isContainer(item.uid) then

local itemsbag = getPokeballsInContainer(item.uid)

for i=0, #itemsbag do

table.insert(items, itemsbag)

end

elseif isPokeball(item.itemid) then

table.insert(items, item.uid)

end

end

end

return items

end

 

 

 

Erro

 

 

 

[Error - Action Interface]

data/actions/scripts/catch.lua:onUse

Description:

data/actions/scripts/catch.lua:28: attempt to index field '?' (a nil value)

stack traceback:

data/actions/scripts/catch.lua:28: in function <data/actions/scripts/catch.lua:10>

 

 

 

Script

Catch.lua

 

 

 

local ballcatch = { --edited brokes count system |typee|

[2394] = {cr = 3, on = 24, off = 23, ball = 11826, send = 47, typeee = "normal"},

[2391] = {cr = 6, on = 198, off = 197, ball = 11832, send = 48, typeee = "great"},

[2393] = {cr = 10, on = 202, off = 201, ball = 11835, send = 46, typeee = "super"},

[2392] = {cr = 15, on = 200, off = 199, ball = 11829, send = 49, typeee = "ultra"},

["id da saffari"] = {cr = 00, on = 000, off = 000, ball = 0000, send = 00, typeee = "saffari"},

--PRA QUEM TEM o sistema de safari ball soh arruma a tabela aki de cima...

}

 

function onUse(cid, item, frompos, item3, topos)

 

local item2 = getTopCorpse(topos)

if item2 == null then

return true

end

 

if getItemAttribute(item2.uid, "catching") == 1 then

return true

end

 

local name = string.lower(getItemNameById(item2.itemid))

name = string.gsub(name, "fainted ", "")

name = string.gsub(name, "defeated ", "")

 

local x = pokecatches[doCorrectPokemonName(name)]

 

--------------------------------------------------------------------------------

local storage = newpokedex[doCorrectPokemonName(name)].stoCatch --edited brokes count system

if getPlayerStorageValue(cid, storage) == -1 then

setPlayerStorageValue(cid, storage, "normal = 0, great = 0, super = 0, ultra = 0, saffari = 0")

end

--------------------------------------------------------------------------------

 

if not x then return true end

 

local owner = getItemAttribute(item2.uid, "corpseowner")

 

if owner and isCreature(owner) and isPlayer(owner) and cid ~= owner and isInArray({1,8}, getPlayerGroupId(cid)) then

doPlayerSendCancel(cid, "You are not allowed to catch this pokemon.")

return true

end

 

local typeee = ballcatch[item.itemid].typeee --edited brokes count system

 

local catchinfo = {}

catchinfo.rate = ballcatch[item.itemid].cr

catchinfo.catch = ballcatch[item.itemid].on

catchinfo.fail = ballcatch[item.itemid].off

catchinfo.newid = ballcatch[item.itemid].ball

catchinfo.name = doCorrectPokemonName(name)

catchinfo.topos = topos

catchinfo.chance = x.chance

 

doSendDistanceShoot(getThingPos(cid), topos, ballcatch[item.itemid].send)

doRemoveItem(item.uid, 1)

 

local d = getDistanceBetween(getThingPos(cid), topos)

--edited brokes count system

addEvent(doSendPokeBall, d * 70 + 100 - (d * 14) , cid, catchinfo, false, false, typeee)

addEvent(doSendMagicEffect, (d * 70 + 100 - (d * 14)) - 100, topos, 3)

 

return true

end

 

 

 

Erro

 

 

 

[Error - CreatureScript Interface]

data/creaturescripts/scripts/exp.lua:onStatsChange

Description:

data/creaturescripts/scripts/exp.lua:977: attempt to compare number with nil

stack traceback:

data/creaturescripts/scripts/exp.lua:977: in function <data/creaturescripts/scripts/exp.lua:129>

 

 

 

Script

exp.lua

 

 

 

local combats = {

[PSYCHICDAMAGE] = {cor = COLOR_PSYCHIC},

[GRASSDAMAGE] = {cor = COLOR_GRASS},

[POISONEDDAMAGE] = {cor = COLOR_GRASS},

[MORTALGASDAMAGE] = {cor = COLOR_POISON},

[FIREDAMAGE] = {cor = COLOR_FIRE2},

[bURNEDDAMAGE] = {cor = COLOR_BURN},

[WATERDAMAGE] = {cor = COLOR_WATER},

[iCEDAMAGE] = {cor = COLOR_ICE},

[NORMALDAMAGE] = {cor = COLOR_NORMAL},

[GUILLOTINEDAMAGE] = {cor = COLOR_NORMAL},

[FLYDAMAGE] = {cor = COLOR_FLYING},

[GHOSTDAMAGE] = {cor = COLOR_GHOST},

[NIGHTMAREDAMAGE] = {cor = COLOR_GHOST},

[GROUNDDAMAGE] = {cor = COLOR_GROUND},

[ELECTRICDAMAGE] = {cor = COLOR_ELECTRIC},

[THUNDERWAVEDAMAGE] = {cor = COLOR_ELECTRIC},

[ROCKDAMAGE] = {cor = COLOR_ROCK},

[bUGDAMAGE] = {cor = COLOR_BUG},

[FIGHTDAMAGE] = {cor = COLOR_FIGHTING},

[sEISMICTOSSDAMAGE] = {cor = COLOR_FIGHTING},

[DRAGONDAMAGE] = {cor = COLOR_DRAGON},

[POISONDAMAGE] = {cor = COLOR_POISON},

[DARKDAMAGE] = {cor = COLOR_DARK},

[sTEELDAMAGE] = {cor = COLOR_STEEL},

}

 

local function doHeal(cid, amount)

doCreatureAddHealth(cid, amount)

doSendMagicEffect(getThingPos(cid), 12)

doSendAnimatedText(getThingPos(cid), "+"..amount.."", 65)

end

 

local function sendPlayerDmgMsg(cid, text)

if not isCreature(cid) then return true end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, text)

end

 

local spcevo = {

["Poliwhirl"] = {"Poliwrath", "Politoed"},

["Gloom"] = {"Bellossom", "Vileplume"},

["Tyrogue"] = {"Hitmonchan", "Hitmontop", "Hitmonlee"}}

 

local function doEvolveWild(cid)

if not isCreature(cid) or getCreatureHealth(cid) <= 0 then return true end

local name = getCreatureName(cid)

local evolution = "none"

if spcevo[name] then

evolution = spcevo[name][math.random(1, #spcevo[name])]

elseif poevo[name] then

evolution = poevo[name].evolution

end

local a = getPokemonStatus(name)

if not a or evolution == "none" then return true end

local pk = {}

local players = getSpectators(getThingPos(cid), 7, 7)

if players then

for pp = 1, #players do

local this = players[pp]

if isCreature(this) and isPlayer(this) and (getCreatureTarget(this) == cid or getDamageMapPercent(this, cid) > 0) then

doSendMagicEffect(getThingPos(this), 173)

local expstring = cid.."expEx"

pk[this] = getItemAttribute(getPlayerSlotItem(this, 8).uid, expstring)

doItemSetAttribute(getPlayerSlotItem(this, 8).uid, expstring, 0)

end

end

end

local level = getPokemonLevel(cid)

local pos = getThingPos(cid)

local gender = getCreatureSkull(cid)

local lifepercentage = 1 - ((getCreatureHealth(cid) * 1.3) / getCreatureMaxHealth(cid))

local lookdir = getCreatureLookDir(cid)

local status = {}

status.offense = getOffense(cid) + a.off * 8

status.defense = getDefense(cid) + a.def * 8

status.agi = getSpeed(cid) + a.agi * 8

status.spatk = getSpecialAttack(cid) + a.spatk * 8

status.vit = getVitality(cid) + a.vit * 4

doRemoveCreature(cid)

local evo = doCreateMonster(evolution, pos)

setWildPokemonLevel(evo, level, status)

doCreatureSetLookDir(evo, lookdir)

doCreatureSetSkullType(evo, gender)

doCreatureAddHealth(evo, -getCreatureMaxHealth(evo) * lifepercentage)

doSendMagicEffect(getThingPos(evo), 18)

for attacker, experience in pairs (pk) do

doWildAttackPlayer(evo, attacker)

local expstring = evo.."expEx"

local exp = experience or 0

doItemSetAttribute(getPlayerSlotItem(attacker, 8).uid, expstring, exp)

end

sendFinishEvolutionEffect(evo, true)

addEvent(sendFinishEvolutionEffect, 550, evo, true)

addEvent(sendFinishEvolutionEffect, 1050, evo)

end

 

local races = {

[4] = {cor = COLOR_FIRE2},

[6] = {cor = COLOR_WATER},

[7] = {cor = COLOR_NORMAL},

[8] = {cor = COLOR_FIRE2},

[9] = {cor = COLOR_FIGHTING},

[10] = {cor = COLOR_FLYING},

[11] = {cor = COLOR_GRASS},

[12] = {cor = COLOR_POISON},

[13] = {cor = COLOR_ELECTRIC},

[14] = {cor = COLOR_GROUND},

[15] = {cor = COLOR_PSYCHIC},

[16] = {cor = COLOR_ROCK},

[17] = {cor = COLOR_ICE},

[18] = {cor = COLOR_BUG},

[19] = {cor = COLOR_DRAGON},

[20] = {cor = COLOR_GHOST},

[21] = {cor = COLOR_STEEL},

[22] = {cor = COLOR_DARK},

[1] = {cor = 180},

[2] = {cor = 180},

[3] = {cor = 180},

[5] = {cor = 180},

}

 

local damages = {MORTALGASDAMAGE, GROUNDDAMAGE, ELECTRICDAMAGE, ROCKDAMAGE, FLYDAMAGE, BUGDAMAGE, FIGHTINGDAMAGE, DRAGONDAMAGE, POISONDAMAGE, DARKDAMAGE, STEELDAMAGE, NIGHTMAREDAMAGE, GUILLOTINEDAMAGE, SEISMICTOSSDAMAGE}

local fixdmgs = {PSYCHICDAMAGE, COMBAT_PHYSICALDAMAGE, GRASSDAMAGE, FIREDAMAGE, WATERDAMAGE, ICEDAMAGE, NORMALDAMAGE, GHOSTDAMAGE}

local ignored = {NIGHTMAREDAMAGE, GUILLOTINEDAMAGE, MORTALGASDAMAGE, SEISMICTOSSDAMAGE, PSYCHOSHIFTDAMAGE, POISONEDDAMAGE, BURNEDDAMAGE}

local ignoremiss = {NIGHTMAREDAMAGE, MORTALGASDAMAGE, BURNEDDAMAGE, POISONEDDAMAGE}

local ignorecritical = {MORTALGASDAMAGE, BURNEDDAMAGE, POISONEDDAMAGE, NIGHTMAREDAMAGE}

local cannotkill = {MORTALGASDAMAGE, BURNEDDAMAGE, POISONEDDAMAGE, NIGHTMAREDAMAGE}

 

function onStatsChange(cid, attacker, type, combat, value)

if (isPlayer(getCreatureMaster(cid))) then

doCreatureExecuteTalkAction(getCreatureMaster(cid), "/pokeread")

end

 

if combat == FLYSYSTEMDAMAGE then return false end

if isPlayer(cid) and getCreatureOutfit(cid).lookType == 814 then return false end -- TV

 

local damageCombat = combat

if damageCombat == THUNDERWAVEDAMAGE then

damageCombat = ELECTRICDAMAGE

elseif damageCombat == PSYCHOSHIFTDAMAGE then

damageCombat = PSYCHICDAMAGE

end

 

if getPlayerStorageValue(cid, 33) >= 1 then -- funcionamento do self destruction

if isCreature(attacker) then

return false

end

return true

end

 

if not isCreature(attacker) or cid == attacker then

if not isInArray(fixdamages, combat) and combats[combat] then

doSendAnimatedText(getThingPos(cid), value, combats[combat].cor)

end

return true

end

 

--------------------------------------------------

if combat == SLEEP_POWDERDAMAGE then

if not isSummon(cid) and not isSummon(attacker) and not isPlayer(attacker) then

return false

end

if isPlayer(cid) then

return false

end

if isNpcSummon(cid) and getCreatureTarget(cid) ~= attacker then

return false

end

if isSummon(cid) and isSummon(attacker) then

if not isInParty(getCreatureMaster(cid)) or not isInParty(getCreatureMaster(attacker)) then

return false

end

if not getPlayerParty(getCreatureMaster(cid)) == getPlayerParty(getCreatureMaster(attacker)) then

return false

end

end

doSleep(cid, value, true)

return false

end

--------------------------------------------------

if combat == HEALINGDAMAGE then

 

local healing = math.abs(value)

 

if not isSummon(cid) and not isSummon(attacker) and not isPlayer(attacker) then

doHeal(cid, healing)

return false

end

if isSummon(cid) and isSummon(attacker) then

if getPlayerStorageValue(getCreatureMaster(cid), 990) >= 1 then

return false

end

if not isInParty(getCreatureMaster(cid)) or not isInParty(getCreatureMaster(attacker)) then

doHeal(cid, healing)

return false

end

if not getPlayerParty(getCreatureMaster(cid)) == getPlayerParty(getCreatureMaster(attacker)) then

doHeal(cid, healing)

return false

end

end

return false

end

--------------------------------------------------

if combat == POISON_POWDERDAMAGE then

if not isSummon(cid) and not isSummon(attacker) and not isPlayer(attacker) then

return false

end

if isNpcSummon(cid) and getCreatureTarget(cid) ~= attacker then

return false

end

if isSummon(cid) and isSummon(attacker) then

if not isInParty(getCreatureMaster(cid)) or not isInParty(getCreatureMaster(attacker)) then

return false

end

if not getPlayerParty(getCreatureMaster(cid)) == getPlayerParty(getCreatureMaster(attacker)) then

return false

end

end

 

local master = attacker

if isSummon(attacker) then master = getCreatureMaster(attacker) end

 

addEvent(doAdvancedPoison, 2500, attacker, master, cid, getPlayerStorageValue(attacker, 919231), value, getPlayerStorageValue(cid, 3893))

 

return false

end

--------------------------------------------------

if isPlayer(attacker) then

 

local valor = value

if valor > getCreatureHealth(cid) then

valor = getCreatureHealth(cid)

end

 

if combat == COMBAT_PHYSICALDAMAGE then

return false

end

 

if combat == PHYSICALDAMAGE then

doSendMagicEffect(getThingPos(cid), 3)

doSendAnimatedText(getThingPos(cid), valor, races[getMonsterInfo(getCreatureName(cid)).race].cor)

end

 

if combats[damageCombat] and not isInArray(fixdmgs, damageCombat) then

doSendAnimatedText(getThingPos(cid), valor, combats[damageCombat].cor)

end

 

if #getCreatureSummons(attacker) >= 1 and not isInArray({POISONEDDAMAGE, BURNEDDAMAGE}, combat) then

doPlayerSendTextMessage(attacker, MESSAGE_STATUS_DEFAULT, "Your "..getPokeName(getCreatureSummons(attacker)[1]).." dealt "..valor.." damage to "..getSomeoneDescription(cid)..".")

end

 

return true

end

--------------------------------------------------

if isPlayer(cid) and #getCreatureSummons(cid) >= 1 and type == STATSCHANGE_HEALTHLOSS then

return false --muda isso

end

--------------------------------------------------

if isPlayer(cid) and #getCreatureSummons(cid) <= 0 and type == STATSCHANGE_HEALTHLOSS then

 

local valor = 0

if combat == COMBAT_PHYSICALDAMAGE then

valor = getOffense(attacker)

else

valor = getSpecialAttack(attacker)

end

 

valor = valor * playerDamageReduction

valor = valor * math.random(83, 117) / 100

 

if valor >= getCreatureHealth(cid) then

valor = getCreatureHealth(cid)

end

 

valor = math.floor(valor)

 

if valor >= getCreatureHealth(cid) then

if getPlayerStorageValue(cid, 17001) >= 1 or getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 63215) >= 1 then

doRemoveCondition(cid, CONDITION_OUTFIT)

setPlayerStorageValue(cid, 17000, 0)

setPlayerStorageValue(cid, 17001, 0)

setPlayerStorageValue(cid, 63215, -1)

doChangeSpeed(cid, PlayerSpeed)

local item = getPlayerSlotItem(cid, 8)

local btype = getPokeballType(item.itemid)

if #getCreatureSummons(cid) <= 0 then

if isInArray(pokeballs[btype].all, item.itemid) then

doTransformItem(item.uid, pokeballs[btype].off)

doItemSetAttribute(item.uid, "hp", 0)

end

end

end

end

doCreatureAddHealth(cid, -valor, 3, 180)

if not isPlayer(cid) then

addEvent(sendPlayerDmgMsg, 5, cid, "You lost "..valor.." hitpoints due to an attack from "..getSomeoneDescription(attacker)..".")

end

return false

end

--------------------------------------------------

if type == STATSCHANGE_HEALTHGAIN then

if cid == attacker then

return true

end

if not isSummon(cid) and isSummon(attacker) then

return false

end

if isSummon(cid) and isSummon(attacker) and getPlayerParty(getCreatureMaster(cid)) == getPlayerParty(getCreatureMaster(attacker)) then

return false

end

return true

end

--------------------------------------------------

if isMonster(attacker) and getPlayerStorageValue(attacker, 201) ~= -1 then

if isPlayer(cid) then

return false

end

if getPlayerStorageValue(getCreatureMaster(cid), ginasios[getPlayerStorageValue(attacker, 201)].storage) ~= 1 then

return false

end

end

--------------------------------------------------

if isMonster(cid) and getPlayerStorageValue(cid, 201) ~= -1 then

if getPlayerStorageValue(getCreatureMaster(attacker), ginasios[getPlayerStorageValue(cid, 201)].storage) ~= 1 then

return false

end

end

--------------------------------------------------

--------------------------------------------------

 

local multiplier = 1

local miss = (getSpeed(cid) - getSpeed(attacker)) * 0.26

 

local poketype1 = pokes[getCreatureName(cid)].type

local poketype2 = pokes[getCreatureName(cid)].type2

 

if getCreatureCondition(cid, CONDITION_INVISIBLE) then

return false

end

 

if damageCombat ~= COMBAT_PHYSICALDAMAGE and not isInArray(ignored, damageCombat) then

if isInArray(effectiveness[damageCombat].super, poketype1) then

multiplier = multiplier * 2

end

if isInArray(effectiveness[damageCombat].super, poketype2) then

multiplier = multiplier * 2

end

if isInArray(effectiveness[damageCombat].weak, poketype1) then

multiplier = multiplier * 0.5

end

if isInArray(effectiveness[damageCombat].weak, poketype2) then

multiplier = multiplier * 0.5

end

if isInArray(effectiveness[damageCombat].non, poketype1) or isInArray(effectiveness[damageCombat].non, poketype2) then

multiplier = multiplier * 0

end

elseif combat == COMBAT_PHYSICALDAMAGE then

if isGhostPokemon(cid) and not isGhostPokemon(attacker) then

doSendMagicEffect(getThingPos(cid), 3)

return false

end

if getCreatureCondition(attacker, CONDITION_INVISIBLE) and not isGhostPokemon(attacker) then

if not isInArray({"Clefable", "Wigglytuff"}, getCreatureName(attacker)) then

return false

end

end

if miss > 0 and math.random(1, 100) <= miss and not isSleeping(cid) and not getCreatureCondition(cid, CONDITION_PARALYZE) then

doSendMagicEffect(getThingPos(cid), 211)

doSendAnimatedText(getThingPos(cid), "MISS", 215)

return false

end

end

--------------------------------------------------

local valor = value

 

if multiplier > 2 then

multiplier = 2

elseif multiplier == 0.25 then

multiplier = 0.5

end

 

--------------------------------------------------

 

 

local function resetMiss(cid)

if not isCreature(cid) then return true end

setPlayerStorageValue(cid, 88726, -1)

end

 

if getPlayerStorageValue(cid, 88726) ~= 1 and miss > 0 and math.random(1, 100) <= miss and damageCombat ~= COMBAT_PHYSICALDAMAGE and not isInArray(ignoremiss, combat) and not isSleeping(cid) and not getCreatureCondition(cid, CONDITION_PARALYZE) then

doSendMagicEffect(getThingPos(cid), 211)

doSendAnimatedText(getThingPos(cid), "MISS", 215)

doTeleportThing(cid, getClosestFreeTile(cid, getThingPos(cid)), false)

doSendMagicEffect(getThingPos(cid), 211)

doFaceCreature(cid, getThingPos(attacker))

setPlayerStorageValue(cid, 88726, 1)

addEvent(resetMiss, 2200, cid)

return false

end

 

if not isSummon(attacker) and not isSummon(cid) then

return false

end

 

if isSummon(cid) and isSummon(attacker) then

if not isInParty(getCreatureMaster(cid)) or not isInParty(getCreatureMaster(attacker)) then

return false

end --party system

if not getPlayerParty(getCreatureMaster(cid)) == getPlayerParty(getCreatureMaster(attacker)) then

return false

end

end

 

if isSleeping(attacker) then

return false

end

 

local randomRange = math.random(83, 117) / 100

local block = 0

 

if combat == COMBAT_PHYSICALDAMAGE then

block = 1 - (getDefense(cid) / (getOffense(attacker) + getDefense(cid)))

if getPokemonGender(attacker) == SEX_MALE then

block = block + 0.2

end

if getPokemonGender(cid) == SEX_FEMALE then

block = block - 0.2

end

valor = getOffense(attacker) * block

else

block = 1 - (getSpecialDefense(cid) / (getSpecialAttack(attacker) + getSpecialDefense(cid)))

valor = valor * block * generalSpecialAttackReduction

if isSummon(cid) then

valor = valor * summonSpecialDamageReduction - getPokemonLevel(cid) / 2

end

end

 

valor = valor * multiplier

valor = valor * randomRange

 

if isSummon(attacker) then

valor = valor * getHappinessRate(attacker)

else

valor = valor * summonReduction

end

 

valor = math.floor(valor)

 

if combat == NIGHTMAREDAMAGE then

local div = 8

if isSummon(attacker) and not isSummon(cid) then

div = 4

end

valor = math.floor(getCreatureMaxHealth(cid)/div)

elseif combat == GUILLOTINEDAMAGE then

if isGhostPokemon(cid) then

doSendMagicEffect(getThingPos(cid), 3)

return false

end

local gDmg = 0.5

if isSummon(attacker) and not isSummon(cid) then

gDmg = 0.7

end

valor = getCreatureMaxHealth(cid) * gDmg

elseif combat == SEISMICTOSSDAMAGE then

valor = getPokemonLevel(attacker) * 10

elseif combat == BURNEDDAMAGE then

valor = value * getResistance(cid, FIREDAMAGE)

elseif combat == POISONEDDAMAGE then

valor = value * getResistance(cid, POISONDAMAGE)

end

 

if valor <= 0 then

doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

return false

end

 

if math.random(1, 100) == 4 and not isInArray(ignorecritical, combat) then

doSendAnimatedText(getThingPos(attacker), "CRITICAL", 215)

valor = valor * 2

end

 

if combat == PSYCHOSHIFTDAMAGE and isCreature(cid) then

 

if not isPlayer(cid) then

 

local pos = getThingPos(cid)

pos.x = pos.x + math.random(-4,4)

pos.y = pos.y + math.random(-4,4)

for a = 1, 6 do

if not canWalkOnPos(pos, true, true, true, true, false) or not isSightClear(getThingPos(cid), pos, false) then

pos = getThingPos(cid)

pos.x = pos.x + math.random(-4,4)

pos.y = pos.y + math.random(-4,4)

end

end

 

if not canWalkOnPos(pos, true, true, true, true, false) then

pos = getClosestFreeTile(cid, getThingPos(cid))

end

 

if not canWalkOnPos(pos, true, true, true, true, false) then

pos = getThingPos(cid)

end

 

doTeleportThing(cid, pos, false)

 

end

 

doSendMagicEffect(getThingPos(cid), math.random(12, 14))

end

 

if combat == THUNDERWAVEDAMAGE then

doCreatureAddCondition(cid, thunderwavecondition)

end

 

if valor >= getCreatureHealth(cid) then

if isInArray(cannotKill, combat) and isPlayer(cid) then

valor = getCreatureHealth(cid) - 1

else

valor = getCreatureHealth(cid)

end

end

 

--- REFLECT --------------------------------

if not isPlayer(cid) and getPlayerStorageValue(cid, 34) >= 1 and combat ~= COMBAT_PHYSICALDAMAGE then

doSendMagicEffect(getThingPos(cid), 135)

doSendAnimatedText(getThingPos(cid), "REFLECT", COLOR_GRASS)

setPlayerStorageValue(cid, 34, -1)

return false

end

--------------------------------------------

 

if hasMimicWall(cid) then

doSendMagicEffect(getThingPos(cid), 135)

local dmgText = ""..valor..""

local a = getPlayerStorageValue(cid, 878)

setPlayerStorageValue(cid, 878, a - valor)

local k = getPlayerStorageValue(cid, 878)

if k <= 0 then

local b = getTileItemById(getThingPos(cid), 11440)

if b.uid > 1 then doRemoveItem(b.uid, 1) end

local c = getTileItemById(getThingPos(cid), 11439)

if c.uid > 1 then doRemoveItem(c.uid, 1) end

dmgText = ""..a..""

doSendMagicEffect(getThingPos(cid), 3)

end

doSendAnimatedText(getThingPos(cid), dmgText, 215)

return false

end

 

if isSummon(attacker) and not isSummon(cid) and not isPlayer(cid) then

 

local expstring = cid.."expEx"

 

if getItemAttribute(getPlayerSlotItem(getCreatureMaster(attacker), 8).uid, expstring) == null then

doItemSetAttribute(getPlayerSlotItem(getCreatureMaster(attacker), 8).uid, expstring, 0)

end

 

local exp = valor / getCreatureMaxHealth(cid)

local ball = getPlayerSlotItem(getCreatureMaster(attacker), 8).uid

 

doItemSetAttribute(ball, expstring, getItemAttribute(ball, expstring) + exp)

if getItemAttribute(ball, expstring) > 1 then

doItemSetAttribute(ball, expstring, 1)

end

end

 

if isSummon(cid) and getCreatureHealth(cid) <= (getCreatureMaxHealth(cid)*0.08) and not exhaustion.get(getCreatureMaster(cid), 88726) then

exhaustion.set(getCreatureMaster(cid), 88726, 11)

doSendMagicEffect(getThingPos(cid), 178)

end

 

if isSummon(attacker) then

if combat == COMBAT_PHYSICALDAMAGE then

doTargetCombatHealth(getCreatureMaster(attacker), cid, PHYSICALDAMAGE, -valor, -valor, 255)

else

doTargetCombatHealth(getCreatureMaster(attacker), cid, damageCombat, -valor, -valor, 255)

end

 

if not isSummon(cid) and not isPlayer(cid) and math.random(1, wildEvolveChance) == math.random(1, wildEvolveChance) then

addEvent(doEvolveWild, math.random(1, 2500), cid)

end

else

if combat ~= COMBAT_PHYSICALDAMAGE then

doCreatureAddHealth(cid, -math.abs(valor), 3, combats[damageCombat].cor)

else

doCreatureAddHealth(cid, -math.abs(valor), 3, races[getMonsterInfo(getCreatureName(cid)).race].cor)

end

 

if isSummon(cid) then

addEvent(sendPlayerDmgMsg, 5, getCreatureMaster(cid), "Your "..getCreatureName(cid).." lost "..valor.." hitpoints due to an attack from "..getSomeoneDescription(attacker)..".")

end

 

end

 

local percent = 8 + math.ceil(valor / getCreatureMaxHealth(cid) * 100)

if getCreatureHealth(cid) == 0 or percent <= 0 then return false end

local runCond = false

 

if math.random(100) <= percent then

runCond = true

end

 

if runCond then

 

local condPos = getThingPos(cid)

local color = 215

local text = ""

local effect = 2

 

if damageCombat == FIREDAMAGE and not isBurning(cid) then

doAdvancedBurn(attacker, isPlayer(getCreatureMaster(attacker)) and getCreatureMaster(attacker) or 0, cid, getPokemonLevel(attacker) * 2, math.random(5, 12))

color = COLOR_FIRE2

text = "BURNING"

effect = 15

elseif damageCombat == POISONDAMAGE and not isPoisoned(cid) and randomCond == checkCond then

doAdvancedPoison(attacker, isPlayer(getCreatureMaster(attacker)) and getCreatureMaster(attacker) or 0, cid, getPokemonLevel(attacker) * 2, math.random(4, 20))

color = COLOR_GRASS

text = "POISONED"

effect = 8

end

 

doSendMagicEffect(getThingPos(cid), effect)

addEvent(doSendAnimatedText, 5, condPos, text, color)

end

------------------------------------POTIONS-------------------------------------------

if isSummon(cid) and type == STATSCHANGE_HEALTHLOSS then

if getPlayerStorageValue(cid, 173) >= 1 then

if damageCombat ~= BURNEDDAMAGE and damageCombat ~= POISONEDDAMAGE then

setPlayerStorageValue(cid, 174, 1)

doSendAnimatedText(getThingPos(cid), "Lost Heal", 144)

end

end

end

----------------------------------------PASSIVAS-----------------------------------------

------------------------------"Counter Helix" - "Giro Ball"------------------------------

-- [outfit normal] = {out = outfit girando, efeitos}

local OutFit = {

[366] = {out = 496, cima = 128, direita = 129, esquerda = 130, baixo = 131}, --scyther

[912] = {out = 918, cima = 128, direita = 129, esquerda = 130, baixo = 131}, --Scizor

[1317] = {out = 849, cima = 128, direita = 129, esquerda = 130, baixo = 131}, --Shiny Scyther

[952] = {out = 1193, cima = 128, direita = 129, esquerda = 130, baixo = 131}, --Hitmontop

[909] = {out = 1194, cima = 128, direita = 129, esquerda = 130, baixo = 131}, --pineco

[910] = {out = 1192, cima = 128, direita = 129, esquerda = 130, baixo = 131}, --Forretress

}

 

--acima do efeito 255 n aparece -pelo menos aki- entao fica esse por enquanto... ;x

--efeito vermelho => {cima = 261, direita = 263, esquerda = 264, baixo = 262}

 

if isSummon(cid) then

if OutFit[getCreatureOutfit(cid).lookType] then

if math.random(1, 100) <= 20 then -- Porcentagem de chance pro poke usar a passiva... 10 = 10% +/-

 

if getPlayerStorageValue(cid, 32623) == 1 then --proteçao pra n usar a spell 2x seguidas...

return false

end

 

local outfitt = OutFit[getCreatureOutfit(cid).lookType]

local function doWingAttack(cid, a, damage, min, max)

local damagearea = {}

local effectpos = getThingPosWithDebug(cid)

local effect = 255

if a == 0 then

effect = outfitt.cima

effectpos.x = effectpos.x + 1

effectpos.y = effectpos.y - 1

damagearea = wingdn

elseif a == 1 then

effect = outfitt.direita

effectpos.x = effectpos.x + 2

effectpos.y = effectpos.y + 1

damagearea = wingde

elseif a == 2 then

effect = outfitt.baixo

effectpos.x = effectpos.x + 1

effectpos.y = effectpos.y + 2

damagearea = wingds

elseif a == 3 then

effect = outfitt.esquerda

effectpos.x = effectpos.x - 1

effectpos.y = effectpos.y + 1

damagearea = wingdw

end

doSendMagicEffect(effectpos, effect)

if damage then

local look = getCreatureOutfit(cid).lookType

if look == 366 or look == 1317 then --scyther e shiny scyther

doAreaCombatHealth(cid, BUGDAMAGE, getThingPosWithDebug(cid), damagearea, -min, -max, CONST_ME_NONE)

elseif look == 952 then --hitmontop

doAreaCombatHealth(cid, FIGHTINGDAMAGE, getThingPosWithDebug(cid), damagearea, -min, -max, CONST_ME_NONE)

else --resto

doAreaCombatHealth(cid, STEELDAMAGE, getThingPosWithDebug(cid), damagearea, -min, -max, CONST_ME_NONE)

end

end

end

 

local dire = getCreatureLookDir(cid)

local cpos = getThingPosWithDebug(cid)

local min = getPokemonLevel(cid)*15 --nao sei como funciona o sistema de dano...

local max = getPokemonLevel(cid)*20 --nao sei como funciona o sistema de dano...

 

setPlayerStorageValue(cid, 32623, 1) --proteçao

doSetCreatureOutfit(cid, {lookType = OutFit[getCreatureOutfit(cid).lookType].out}, -1)

 

local function doDance(cid, dir, damage, min, max)

if not isCreature(cid) then return true end

doCreatureSetLookDir(cid, dir)

doWingAttack(cid, dir, damage, min, max)

end

 

for times = 0, 2 do

for directions = 0, 3 do

addEvent(doDance, times * 300, cid, directions, true, min, max)

end

end

 

local function doChangeO(cid, dir, pos)

if not isCreature(cid) then return true end

setPlayerStorageValue(cid, 32623, 0) --proteçao

doRemoveCondition(cid, CONDITION_OUTFIT)

if getThingPosWithDebug(cid).x == pos.x and getThingPosWithDebug(cid).y == pos.y then

doCreatureSetLookDir(cid, dir)

end

end

 

addEvent(doChangeO, 2 * 300 + 10, cid, dire, cpos)

end

end

end

-------------------------------------------Lava Counter / Electricity-------------------------------------

local Fire_Thunder = {"Magmar", "Shiny Magmar", "Electabuzz", "Shiny Electabuzz"}

 

--["Nome"] = {effeito, damage}

local eff = {

["Magmar"] = {15, FIREDAMAGE},

["Shiny Magmar"] = {15, FIREDAMAGE},

["Electabuzz"] = {207, ELECTRICDAMAGE},

["Shiny Electabuzz"] = {207, ELECTRICDAMAGE},

}

 

if isSummon(cid) then

local e = getCreatureMaster(cid)

if isInArray(Fire_Thunder, getItemAttribute(getPlayerSlotItem(e, 8).uid, "poke")) then

if math.random(1, 100) <= 20 then -- Porcentagem de chance pro poke usar a passiva... 10 = 10% +/-

 

if getPlayerStorageValue(cid, 32623) == 1 then --proteçao pra n usar a spell 2x seguidas...

return false

end

 

local min = getPokemonLevel(cid)*15 --nao sei como funciona o sistema de dano...

local max = getPokemonLevel(cid)*20 --nao sei como funciona o sistema de dano...

 

local function sendFireEff(cid, dir, eff, damage)

if not isCreature(cid) then return true end

doAreaCombatHealth(cid, damage, getPosByDir(getThingPosWithDebug(cid), dir), 0, -min, -max, eff)

end

 

local function doSpinFire(cid)

if not isCreature(cid) then return true end

local t = {

[1] = SOUTHWEST,

[2] = SOUTH,

[3] = SOUTHEAST,

[4] = EAST,

[5] = NORTHEAST,

[6] = NORTH,

[7] = NORTHWEST,

[8] = WEST,

[9] = SOUTHWEST,

}

for a = 1, 17 do

if not t[a] then

addEvent(sendFireEff, a * 140, cid, t[a-8], eff[getCreatureName(cid)][1], eff[getCreatureName(cid)][2])

else

addEvent(sendFireEff, a * 140, cid, t[a], eff[getCreatureName(cid)][1], eff[getCreatureName(cid)][2])

end

end

setPlayerStorageValue(cid, 32623, 0) --proteçao

end

 

setPlayerStorageValue(cid, 32623, 1) --proteçao

doSpinFire(cid, false, cid)

end

end

end

---------------------------------------------Demon Kicker----------------------------------

--[outfit] = outfit chutando,

local hitmonlees = {

[371] = 652, --hitmonlee

[1300] = 652, --shiny hitmonlee

[877] = 878, --elite hitmonlee PxG

}

 

--DETALHE: shiny hitmonlee n tem a sprite dele chutando.. pelo menos eu n achei..

--entao deixei a sprite do hitmonlee normal atacando...

 

if isSummon(cid) then

local e = getCreatureMaster(cid)

local name = getItemAttribute(getPlayerSlotItem(e, 8).uid, "poke")

if name == "Shiny Hitmonlee" or name == "Hitmonlee" then

if isCreature(getCreatureTarget(getCreatureMaster(cid))) then

if math.random(1, 100) <= 20 then -- Porcentagem de chance pro poke usar a passiva... 10 = 10% +/-

 

if isSleeping(cid) then return true end

 

if getDistanceBetween(getThingPos(cid), getThingPos(getMasterTarget(cid))) > 1 then

return false

end

if getPlayerStorageValue(cid, 32623) == 1 then --proteçao pra n usar a spell 2x seguidas...

return false

end

 

local function doChangeHitmon(cid)

if not isCreature(cid) then return true end

setPlayerStorageValue(cid, 32623, 0) --proteçao

doRemoveCondition(cid, CONDITION_OUTFIT)

end

 

local min = getPokemonLevel(cid)*15 --nao sei como funciona o sistema de dano...

local max = getPokemonLevel(cid)*20 --nao sei como funciona o sistema de dano...

 

 

setPlayerStorageValue(cid, 32623, 1) --proteçao

doSetCreatureOutfit(cid, {lookType = hitmonlees[getCreatureOutfit(cid).lookType]}, -1)

doTargetCombatHealth(cid, getMasterTarget(cid), FIGHTINGDAMAGE, -min, -max, 255)

 

addEvent(doChangeHitmon, 700, cid)

end

end

end

end

-------------------------------------------Demon Puncher-------------------------------------

local hitmonchans = {

["Hitmonchan"] = {

[0] = {out = 559, eff = 112, type = FIGHTINGDAMAGE}, --outfit normal

[1] = {out = 1075, eff = 35, type = FIREDAMAGE}, --outfit fogo

[2] = {out = 1077, eff = 48, type = ELECTRICDAMAGE}, --outfit raio

[3] = {out = 1078, eff = 43, type = ICEDAMAGE}, --outfit gelo

[4] = {out = 1076, eff = 140, type = GHOSTDAMAGE} --outfit ghost

},

 

["Shiny Hitmonchan"] = {

--aconcelho trocar a outfit do shiny hitmonchan pela do elite hitmonchan do PO...

[0] = {out = 837, eff = 112, type = FIGHTINGDAMAGE}, --outfit normal

[1] = {out = 1080, eff = 35, type = FIREDAMAGE}, --outfit fogo

[2] = {out = 1081, eff = 48, type = ELECTRICDAMAGE}, --outfit raio

[3] = {out = 1082, eff = 43, type = ICEDAMAGE}, --outfit gelo

[4] = {out = 1079, eff = 140, type = GHOSTDAMAGE} --outfit ghost

}

}

local monchanOUT = {837, 1080, 1081, 1082, 1079}

 

if isSummon(cid) then

local e = getCreatureMaster(cid)

local name = getItemAttribute(getPlayerSlotItem(e, 8).uid, "poke")

if name == "Shiny Hitmonchan" or name == "Hitmonchan" then

if isCreature(getCreatureTarget(getCreatureMaster(cid))) then

if math.random(1, 100) <= 20 then -- Porcentagem de chance pro poke usar a passiva... 10 = 10% +/-

 

if isSleeping(cid) then return true end

 

if getDistanceBetween(getThingPos(cid), getThingPos(getMasterTarget(cid))) > 1 then

return false

end

if getItemAttribute(getPlayerSlotItem(e, 8).uid, "poke") == "Shiny Hitmonchan" and not isInArray(monchanOUT, getCreatureOutfit(cid).lookType) then

return false --proteçao pro script n funcionar com o shiny monchan com outfit diferente da do elite...

end --script soh funciona com outfit do elite hirmonchan do PO...

 

 

local min = getPokemonLevel(cid)*15 --nao sei como funciona o sistema de dano...

local max = getPokemonLevel(cid)*20 --nao sei como funciona o sistema de dano...

 

local hands = getItemAttribute(getPlayerSlotItem(e, 8).uid, "hands")

 

 

doSendDistanceShoot(getThingPos(cid), getThingPos(getMasterTarget(cid)), 39)

doTargetCombatHealth(cid, getMasterTarget(cid), hitmonchans[name][hands].type, -min, -max, 255)

 

 

local target = getThingPos(getMasterTarget(cid))

target.x = target.x + 1

 

if hands == 4 then

doSendMagicEffect(target, hitmonchans[name][hands].eff)

else

doSendMagicEffect(getThingPos(getMasterTarget(cid)), hitmonchans[name][hands].eff)

end

 

end

end

end

end

---------------------------------------Stunning Confusion------------------------------------------

local ducks = {"Golduck", "Psyduck", "Shiny Golduck", "Shiny Psyduck"}

 

if isSummon(cid) then

local e = getCreatureMaster(cid)

local name = getItemAttribute(getPlayerSlotItem(e, 8).uid, "poke")

if isInArray(ducks, name) then

if math.random(1, 100) <= 20 then -- Porcentagem de chance pro poke usar a passiva... 10 = 10% +/-

 

if getPlayerStorageValue(cid, 32623) == 1 then --proteçao pra n usar a spell 2x seguidas...

return false

end

 

local min = getPokemonLevel(cid)*5 --nao sei como funciona o sistema de dano...

local max = getPokemonLevel(cid)*10 --nao sei como funciona o sistema de dano...

 

local function damage(cid)

if isCreature(cid) then

setPlayerStorageValue(cid, 32623, 1) --proteçao

doAreaCombatHealth(cid, PSYCHICDAMAGE, getThingPosWithDebug(cid), confusion, -min, -max, 136)

end

end

 

for i = 1, 7 do

addEvent(damage, i*500, cid)

end

setPlayerStorageValue(cid, 32623, 0) --proteçao

end

end

end

-----------------------------------------Groundshock-----------------------------------

if isSummon(cid) then

local e = getCreatureMaster(cid)

local name = getItemAttribute(getPlayerSlotItem(e, 8).uid, "poke")

if name == "Kangaskhan" or name == "Shiny Kangaskhan" then

if math.random(1, 100) <= 20 then -- Porcentagem de chance pro poke usar a passiva... 10 = 10% +/-

 

local min = getPokemonLevel(cid)*10 --nao sei como funciona o sistema de dano...

local max = getPokemonLevel(cid)*15 --nao sei como funciona o sistema de dano...

 

doAreaCombatHealth(cid, NORMALDAMAGE, getThingPosWithDebug(cid), eshock, -min, -max, 255)

 

local sps = getThingPosWithDebug(cid)

sps.x = sps.x+1

sps.y = sps.y+1

doSendMagicEffect(sps, 127)

end

end

end

--------------------------------------Electric Charge---------------------------------------------------

arr = {

{1, 1, 1, 1, 1},

{1, 1, 1, 1, 1},

{1, 1, 2, 1, 1},

{1, 1, 1, 1, 1},

{1, 1, 1, 1, 1}

}

local charge = {"Pikachu", "Shiny Pikachu", "Raichu", "Shiny Raichu"}

 

if isSummon(cid) then

local e = getCreatureMaster(cid)

local name = getItemAttribute(getPlayerSlotItem(e, 8).uid, "poke")

local target = 0

if isInArray(charge, name) then

if getPlayerStorageValue(cid, 253) >= 0 then

return true

end

local uid = checkAreaUid(getCreaturePosition(cid), arr, 1, 1)

for _,pid in pairs(uid) do

if isCreature(pid) then

if getCreatureTarget(pid) == cid then

target = target+1

end

end

end

if target == 0 then

return true

end

if target == (1 or 2) then

chance = 15 --15%

elseif target == (3 or 4) then

chance = 20 --20%

elseif target == (5 or 6) then

chance = 30 --30%

end

if math.random(1, 100) <= chance then -- Porcentagem de chance pro poke usar a passiva... 10 = 10% +/-

setPlayerStorageValue(cid, 253, 1)

doSendAnimatedText(getThingPos(cid), "FOCUS", 144)

end

end

end

-------------------------------------Melody------------------------------------

if isSummon(cid) then

local e = getCreatureMaster(cid)

local name = getItemAttribute(getPlayerSlotItem(e, 8).uid, "poke")

if name == "Wigglytuff" or name == "Shiny Wigglytuff" then

if math.random(1, 100) <= 10 then -- Porcentagem de chance pro poke usar a passiva... 10 = 10% +/-

doAreaCombatHealth(cid, SLEEP_POWDERDAMAGE, getThingPosWithDebug(cid), powders, -6, -10, 33)

end

end

end

------------------------------------- Dragon Fury / Fury ---------------------------------------

local DracoFury = {"Persian", "Shiny Persian", "Gyarados", "Shiny Gyarados", "Dratini", "Shiny Dratini", "Dragonair", "Shiny Dragonair", "Dragonite", "Shiny Dragonite"}

if isSummon(cid) then

local e = getCreatureMaster(cid)

local name = getItemAttribute(getPlayerSlotItem(e, 8).uid, "poke")

if isInArray(DracoFury, name) then

if math.random(1, 100) <= 10 then --Chance 4 = 4% Acho, Mais Fica A Sua Escolha

if getPlayerStorageValue(cid, 32623) == 1 then

return false

end

 

local function effect(params)

if isCreature(params.cid) then

doSendMagicEffect(getThingPos(params.cid), 12)

end

end

 

setPlayerStorageValue(cid, 32623, 1)

 

local function doReduceOffenseDefense(cid, qnt)

if not isCreature(cid) then return true end

local a = getDefense(cid)

local A = getOffense(cid)

if getCreatureName(cid) ~= "Persian" then

setPlayerStorageValue(cid, 1002, a - qnt)

end

setPlayerStorageValue(cid, 1001, A - qnt)

end

 

local function doDoubleOffenseDefense(cid)

if not isCreature(cid) then return true end

local a = getDefense(cid)

local A = getOffense(cid)

if getCreatureName(cid) ~= "Persian" then

setPlayerStorageValue(cid, 1002, a * 2)

end

setPlayerStorageValue(cid, 1001, A * 1.5)

local b = getDefense(cid)

local c = b - a

local B = getOffense(cid)

local C = B - A

if getCreatureName(cid) ~= "Persian" then

addEvent(doReduceOffenseDefense, 15 * 1500 + 40, cid, c)

end

addEvent(doReduceOffenseDefense, 15 * 1500 + 40, cid, C)

end

 

setPlayerStorageValue(cid, 32623, 0)

doDoubleOffenseDefense(cid)

for times = 0, 15 do

addEvent(effect, 1500 * times + 40, {cid = cid})

end

setPlayerStorageValue(cid, 32623, 1)

end

end

end

------------------------------------- Mega Drain ---------------------------------------

arr = {

{0, 0, 0, 0, 0},

{0, 1, 1, 1, 0},

{0, 1, 2, 1, 0},

{0, 1, 1, 1, 0},

{0, 0, 0, 0, 0}

}

 

local mega = {"Oddish", "Gloom", "Vileplume", "Kabuto", "Kabutops", "Parasect", "Tangela", "Shiny Oddish",

"Shiny Gloom", "Shiny Vileplume", "Shiny Kabuto", "Shiny Kabutops", "Shiny Parasect", "Shiny Tangela"}

 

local min = getPokemonLevel(cid)*3 --nao sei como funciona o sistema de dano...

local max = getPokemonLevel(cid)*5 --nao sei como funciona o sistema de dano...

 

if isSummon(cid) then

local e = getCreatureMaster(cid)

local name = getItemAttribute(getPlayerSlotItem(e, 8).uid, "poke")

if isInArray(mega, name) then

if math.random(1, 100) <= 10 then -- Porcentagem de chance pro poke usar a passiva... 20 = 20%

local uid = checkAreaUid(getThingPos(cid), arr, 1, 1)

for _,pid in pairs(uid) do

if isCreature(pid) then

if getCreatureTarget(pid) == cid then

local hp = getCreatureHealth(pid)

local drain = choose(min, max)

if hp-drain >= 1 then

doCreatureAddHealth(pid, -drain)

doCreatureAddHealth(cid, drain)

doSendAnimatedText(getThingPos(pid), "-"..drain.."", 144)

doSendAnimatedText(getThingPos(cid), "+"..drain.."", 32)

end

end

end

end

end

end

end

------------------------------------- Spores Reaction ---------------------------------------

arr = {

{0, 0, 0, 0, 0},

{0, 1, 1, 1, 0},

{0, 1, 2, 1, 0},

{0, 1, 1, 1, 0},

{0, 0, 0, 0, 0}

}

 

local spores = {"Oddish", "Gloom", "Vileplume", "Shiny Oddish", "Shiny Gloom", "Shiny Vileplume"}

 

if isSummon(cid) then

local e = getCreatureMaster(cid)

local name = getItemAttribute(getPlayerSlotItem(e, 8).uid, "poke")

if isInArray(spores, name) then

if math.random(1, 100) <= 10 then -- Porcentagem de chance pro poke usar a passiva... 20 = 20% +/-

doAreaCombatHealth(cid, SLEEP_POWDERDAMAGE, getThingPosWithDebug(cid), powders, -2, -3, 27)

end

end

end

 

 

return false

end

 

 

 

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

Alguem pode me passar o id do item que coloca no cp das city pra ir pro pvp ? ja procurei em tudo aqui no mapeditor mas nao achei...

Mano vc tem que adc no client pelo Dat Editor e Iten Editor pqe esse piso nao vem no client

Link para o comentário
Compartilhar em outros sites

@Slicer ( é assim mesmo manin , essas move são muito utíl pra eles ... ) , mais continuando o papo do hp dos pokemons , manin eu to falando dos Pokemon Selvagens , eu acho que esse vitality ae , é pros pokemon do player's , ... o hp dos pokemons dos player tá bom .. oq eu quero afina mesmo , é aumenta os dos selvagens que tão super baixo's..

Link para o comentário
Compartilhar em outros sites

na verdade n.. os selvagens tb tem vit.. ;x soh da uma olhada na function "setWildPokemonLevel" oq tem eh.. no configuration.lua tem isso aki..

vitReductionForWild = 0.8    -- 1 means that nothing will change, 0.5 means that wild pokemon hp will drop by half

 

tenta por 1 e ve noq da.. ja q tu diz q os summons tem hp bom.. ;p

Link para o comentário
Compartilhar em outros sites

Galera estou precisando de uma ajuda se possivel alguem me responda.

 

È assim estou querendo fazer uma backpack por use with como? ao inves de voce ir la na backpack e clicar nela pra abrir seria com use with...

Mais não estou conseguindo fazer ela abrir...

Ja arrumei no dat e otb mais não adianta ela não abre...

 

E outra se possivel existir algum comando do genero doOpenBackpack(getPlayerSlotItem(cid, 4).uid) << ai abriste a backpack que esta no slot 4, me diraste que tambem serve.

 

Obrigado a todos :)

Link para o comentário
Compartilhar em outros sites

@SUAJA

você já adicionou a tag no items.xml ?

Ex:

 

<item id="12326" article="a" name="pokebag">

<attribute key="weight" value="0" />

<attribute key="containerSize" value="8" /> <--- isso é a quantidade de slot na backpack

</item>

---------------------------

espero que eu tenha ajudado se não, não sei como ajudar =/

Link para o comentário
Compartilhar em outros sites

@Maxximus

Sim ja adicionei, tentei de tudo ao meu alcance, dat, otb, items.xml...

Mais não esta indo...

 

@ALL

Se alguem souber me fale por favor.

Link para o comentário
Compartilhar em outros sites

@Slicer , não mudou nada kk , acho q se eu mudar , ["Bulbasaur"] = {offense = 4.9, defense = 4.9, specialattack = 6.5, vitality = 4.5, agility = 0.1, exp = 64, ...

 

vai muda o do summon , por aqui mesmo dis , ( vitality = vida que o poke ganha pra cada vitality que tem )

 

ou será que muda os dois? :/ to meio confuso

Link para o comentário
Compartilhar em outros sites

@Kledston

o health de pokemon selvagem é baseada nisso:

"vitReductionForWild = 0.8" sendo 0.8 80 % da vitality real do pokemon.

digamos que a vitality do bulbasaur é 4.5 sendo oque ele ganha por level...

um bulbasaur level 22 vai ter 4.5x22 = 99 de vitality

 

e temos tambem o "HPperVit = 13"

depois de calcular o level por a vitality real do pokemon ele vai pegar o resultado que é 99 e fazer isso:

99x13 = 1287

 

sendo a atual vida do pokemon 1287.

por ultimo ele pegar o valor final "1287"

e usa "vitReductionForWild = 0.8" ficando assim:

80 % de 1287 = 974,56

 

pronto temos a vida do bulbasaur level 22 que é 974,56

 

espero ter ajudado :p

 

@Maxximus

Cara oque eu quero fazer é simples:

 

Todas as backpack abrem usando apenas "OPEN" = 1 clique nela...

 

Já eu Quero ter uma backpack que abra usando "use with" = 1 clique nela e depois outro clique...

Link para o comentário
Compartilhar em outros sites

@Slicer Obg cara, não sabia disso. Mas ainda assim está dando player not found. OEIPUAPUOEA

@SUJA No caso o use with serve pra voce usar o item em algum outro lugar, voce ia usar a backpack nela mesma?

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

@luposlps

eu tenhu essa aki.. soh q dai eh pelo nome do poke...

 

 

function isShiny(cid)

if not isCreature(cid) then

return false

end

 

if string.find(tostring(getCreatureName(cid)), "Shiny") then

return true

end

return false

end

 

 

tenta usar essa... cid ali eh o player...

 

function shinypokeball(cid)--cid aki eh o player...

namexx = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")

if string.find(tostring(namexx), "Shiny") then

return true

end

return false

end

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...