clebao666 6 Postado Julho 7, 2015 Share Postado Julho 7, 2015 local target = 0local prevTarget = 0local origPos = 0local max_distance = 50local fighting = falselocal challenger = 0local battle_turn = 1 -- don't changelocal challenger_turn = 0 -- don't change-----/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--local function doSummonGymPokemon(npc)local this = npcif not isCreature(this) or not ehNPC(this) then return true end --alterado v1.6if #getCreatureSummons(this) >= 1 or target == 0 then return true endlocal it = wildHunter[getPlayerStorageValue(this, 665471)][battle_turn]if not it then return true enddoSummonMonster(this, it.name)local summon = getCreatureSummons(this)[1]if not summon then --alterado v1.6print("Error in npc: "..getCreatureName(this)..", tring to execute function 'doSummonGymPokemon', poke: "..it.name)battle_turn = battle_turn+1return trueendlocal balleffect = pokeballs["normal"].effectif it.ball and pokeballs[it.ball] thenballeffect = pokeballs[it.ball].effectenddoSendMagicEffect(getThingPos(summon), balleffect)setPlayerStorageValue(summon, 10000, balleffect)setPlayerStorageValue(summon, 10001, gobackmsgs[math.random(#gobackmsgs)].back:gsub("doka", it.nick ~= "" and it.nick or it.name))setPlayerStorageValue(summon, 1007, it.nick ~= "" and it.nick or it.name)doSetMonsterGym(summon, target)addEvent(adjustWildPoke, 15, summon, it.optionalLevel)if it.nick ~= "" then doCreatureSetNick(summon, it.nick) endlocal name = it.nick ~= "" and it.nick or getCreatureName(this).."s "..it.name --alterado v1.3doCreatureSay(this, gobackmsgs[math.random(#gobackmsgs)].go:gsub("doka", getPlayerStorageValue(summon, 1007)), 1)fighting = truebattle_turn = battle_turn + 1end--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--local function goToOrigPos()target = 0selfFollow(0)fighting = falsechallenger = 0challenger_turn = 0if #getCreatureSummons(getNpcCid()) >= 1 thensetPlayerStorageValue(getCreatureSummons(getNpcCid())[1], 1006, 0)doCreatureAddHealth(getCreatureSummons(getNpcCid())[1], -getCreatureMaxHealth(getCreatureSummons(getNpcCid())[1]))enddoChangeSpeed(getNpcCid(), -getCreatureSpeed(getNpcCid()))doTeleportThing(getNpcCid(), origPos)end--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--local function updateTarget()if(target == 0) thenlocal list = getSpectators(getNpcPos(), 9, 9, false)for i = 1, table.getn(list) dolocal _target = listif(_target ~= 0) thenif isPlayer(_target) and isRocket(_target) and not getTileInfo(getThingPos(_target)).protection then --alterado v1.8selfSay(hunterTalks[math.random(#hunterTalks)])doNpcSetCreatureFocus(_target)target = _targetprevTarget = targetbreakendendendendend--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--function onCreatureAppear(cid)endfunction onCreatureDisappear(cid)endfunction onCreatureMove(creature, oldPos, newPos)--end--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--function onThink()if not isCreature(getNpcCid()) then return false end --alterado v1.6if origPos == 0 thenorigPos = getNpcPos()endif getPlayerStorageValue(getNpcCid(), 665471) <= 0 thensetPlayerStorageValue(getNpcCid(), 665471, math.random(1, 5))randOutfit(getNpcCid())endupdateTarget()------------------------------------------------------if getDistanceBetween(getNpcPos(), origPos) >= max_distance or (isCreature(target) and getTileInfo(getThingPos(target)).protection) or getTileInfo(getThingPos(getNpcCid())).protection thengoToOrigPos() --alterado v1.9end------------------------------------------------------if(target == 0) thenif getPlayerStorageValue(getNpcCid(), 154788) <= 0 thensetPlayerStorageValue(getNpcCid(), 154788, 1)doChangeSpeed(getNpcCid(), -getCreatureSpeed(getNpcCid()))addEvent(randWalk, 2000, getNpcCid(), 1000, getPlayerStorageValue(getNpcCid(), 154788), target)endreturn trueend------------------------------------------------------local playerPos = getThingPosWithDebug(target) --alterado v1.6local myPos = getNpcPos()------------------------------------------------------if(myPos.z ~= playerPos.z) thengoToOrigPos()battle_turn = battle_turn == 1 and battle_turn or battle_turn-1return trueend------------------------------------------------------if getDistanceBetween(playerPos, myPos) > max_distance thengoToOrigPos()battle_turn = battle_turn == 1 and battle_turn or battle_turn-1return trueend------------------------------------------------------if getDistanceBetween(playerPos, myPos) >= 5 thenif getPlayerStorageValue(getNpcCid(), 154788) >= 1 thensetPlayerStorageValue(getNpcCid(), 154788, -1)doRegainSpeed(getNpcCid())if isCreature(target) thenselfFollow(target)endendend------------------------------------------------------if getDistanceBetween(playerPos, myPos) <= 3 thenif getPlayerStorageValue(getNpcCid(), 154788) <= 0 thensetPlayerStorageValue(getNpcCid(), 154788, 1)doChangeSpeed(getNpcCid(), -getCreatureSpeed(getNpcCid()))addEvent(randWalk, 2000, getNpcCid(), 1000, getPlayerStorageValue(getNpcCid(), 154788), target)endend------------------------------------------------------if getDistanceBetween(playerPos, myPos) <= 5 thenchallenger = targetaddEvent(doSummonGymPokemon, 850, getNpcCid())local change = falseif not isCreature(target) thentarget = 0battle_turn = battle_turn == 1 and battle_turn or battle_turn-1return trueendif fighting thenif not isCreature(getCreatureTarget(getNpcCid())) thenif #getCreatureSummons(challenger) >= 1 thenselfAttackCreature(getCreatureSummons(challenger)[1])change = trueelseif change thenchange = falsechallenger_turn = challenger_turn + 1endendendif #getCreatureSummons(getNpcCid()) == 0 and isCreature(target) thenif battle_turn > #wildRoket[getPlayerStorageValue(getNpcCid(), 665471)] thenaddEvent(doCreateNpc, 300000, ".aPolice Recruit", myPos) --alterado v1.5local outfit = getCreatureOutfit(getNpcCid())doRemoveCreature(getNpcCid())----------------------------------------if outfit.lookType == 1016 then --verifica se o npc eh female.. ;pmonster = doCreateMonster("aPolice RecruitFemale", myPos)elsemonster = doCreateMonster("aPolice Recruit", myPos)end----------------------------------------doCloneOut(monster, outfit)addEvent(beDrunk, 100, monster)endaddEvent(doSummonGymPokemon, 1000, getNpcCid())endif #getCreatureSummons(challenger) <= 0 thenselfAttackCreature(challenger)endendendend gostaria que alguem modificasse esse npc pra que varios players possam bater nos pokes que ele invoca ao mesmo tempo.do jeito que esta somente o 1 player que esse npc começa atacar que pode atacar tbmporem os players roket que estao proximos a ele tbm tomam o dano.desde ja agradeço muito quem puder ajudar. vlw Link para o comentário Compartilhar em outros sites More sharing options...
Posts Recomendados