Postado Maio 28, 2016 9 anos Oi galerinha do tk,estava fazendo algumas alteracoes nos npcs rocket e police a fim de tentar com que o npc rocket atacase o npc police e o police atacase o rocket tentei mudar a storage que o npc ataca para a storage que ganha ao se tornar um dos nos mais nao deu certo os npcs pararam de atacar, queria ajuda de voces com isso aqui a script deles --- Police local target = 1 local prevTarget = 0 local origPos = 0 local max_distance = 12 local fighting = true local challenger = 0 local battle_turn = 1 -- don't change local challenger_turn = 0 -- don't change --- --/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////-- local function doSummonGymPokemon(npc) local this = npc if not isCreature(this) or not ehNPC(this) then return true end --alterado v1.6 if #getCreatureSummons(this) >= 1 or target == 0 then return true end local it = wildCommanderOfficer[getPlayerStorageValue(this, 665461)][battle_turn] if not it then return true end doSummonMonster(this, it.name) local summon = getCreatureSummons(this)[1] if not summon then --alterado v1.6 print("Error in npc: "..getCreatureName(this)..", tring to execute function 'doSummonGymPokemon', poke: "..it.name) battle_turn = battle_turn+1 return true end local balleffect = pokeballs["normal"].effect if it.ball and pokeballs[it.ball] then balleffect = pokeballs[it.ball].effect end doSendMagicEffect(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) end local name = it.nick ~= "" and it.nick or getCreatureName(this).."s "..it.name --alterado v1.3 doCreatureSay(this, gobackmsgs[math.random(#gobackmsgs)].go:gsub("doka", getPlayerStorageValue(summon, 1007)), 1) fighting = true battle_turn = battle_turn + 1 end --/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////-- local function goToOrigPos() target = 0 selfFollow(0) fighting = false challenger = 0 challenger_turn = 0 if #getCreatureSummons(getNpcCid()) >= 1 then setPlayerStorageValue(getCreatureSummons(getNpcCid())[1], 1006, 0) doCreatureAddHealth(getCreatureSummons(getNpcCid())[1], -getCreatureMaxHealth(getCreatureSummons(getNpcCid())[1])) end doChangeSpeed(getNpcCid(), -getCreatureSpeed(getNpcCid())) doTeleportThing(getNpcCid(), origPos) end --/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////-- local function updateTarget() if(target == 0) then local list = getSpectators(getNpcPos(), 9, 9, false) for i = 1, table.getn(list) do local _target = list if(_target ~= 0) then if isPlayer(_target) and isRocket(_target) and not getTileInfo(getThingPos(_target)).protection then --alterado v1.8 selfSay(policeTalks[math.random(#policeTalks)]) doNpcSetCreatureFocus(_target) target = _target prevTarget = target break end end endendend--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--function onCreatureAppear(cid)end function onCreatureDisappear(cid)end function onCreatureMove(creature, oldPos, newPos)--end--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--function onThink()if not isCreature(getNpcCid()) then return false end --alterado v1.6if origPos == 0 then origPos = getNpcPos()endif getPlayerStorageValue(getNpcCid(), 665461) <= 0 then setPlayerStorageValue(getNpcCid(), 665461, 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 then goToOrigPos() --alterado v1.9end------------------------------------------------------if(target == 0) thenif getPlayerStorageValue(getNpcCid(), 154788) <= 0 then setPlayerStorageValue(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 then setPlayerStorageValue(getNpcCid(), 154788, -1) doRegainSpeed(getNpcCid()) if isCreature(target) then selfFollow(target) endendend------------------------------------------------------if getDistanceBetween(playerPos, myPos) <= 3 thenif getPlayerStorageValue(getNpcCid(), 154788) <= 0 then setPlayerStorageValue(getNpcCid(), 154788, 1) doChangeSpeed(getNpcCid(), -getCreatureSpeed(getNpcCid())) addEvent(randWalk, 2000, getNpcCid(), 1000, getPlayerStorageValue(getNpcCid(), 154788), target)endend------------------------------------------------------if getDistanceBetween(playerPos, myPos) <= 5 then challenger = target addEvent(doSummonGymPokemon, 850, getNpcCid()) local change = false if not isCreature(target) then target = 0 battle_turn = battle_turn == 1 and battle_turn or battle_turn-1 return trueend if fighting then if not isCreature(getCreatureTarget(getNpcCid())) then if #getCreatureSummons(challenger) >= 1 then selfAttackCreature(getCreatureSummons(challenger)[1]) change = true else if change then change = false challenger_turn = challenger_turn + 1 end end end if #getCreatureSummons(getNpcCid()) == 0 and isCreature(target) then if battle_turn > #wildCommanderOfficer[getPlayerStorageValue(getNpcCid(), 665461)] then addEvent(doCreateNpc, 300000, ".aCommanderOfficer", myPos) --alterado v1.5 local outfit = getCreatureOutfit(getNpcCid()) doRemoveCreature(getNpcCid()) ---------------------------------------- if outfit.lookType == 1184 then --verifica se o npc eh female.. ;p monster = doCreateMonster("aCommanderOfficerFemale", myPos) else monster = doCreateMonster("aCommanderOfficer", myPos) end ---------------------------------------- doCloneOut(monster, outfit) addEvent(beDrunk, 100, monster) end addEvent(doSummonGymPokemon, 1000, getNpcCid()) end if #getCreatureSummons(challenger) <= 0 then selfAttackCreature(challenger) end endendend ---Rocket local target = 1local prevTarget = 0local origPos = 0local max_distance = 12local fighting = truelocal challenger = 0local battle_turn = 1 -- don't changelocal challenger_turn = 0 -- don't change-----/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--local function doSummonGymPokemon(npc) local this = npc if not isCreature(this) or not ehNPC(this) then return true end --alterado v1.6 if #getCreatureSummons(this) >= 1 or target == 0 then return true end local it = wildCommanderRocket[getPlayerStorageValue(this, 665451)][battle_turn] local it = wildCommanderRocket[getPlayerStorageValue(this, 665450)][battle_turn] if not it then return true end doSummonMonster(this, it.name) local summon = getCreatureSummons(this)[1] if not summon then --alterado v1.6 print("Error in npc: "..getCreatureName(this)..", tring to execute function 'doSummonGymPokemon', poke: "..it.name) battle_turn = battle_turn+1 return true end local balleffect = pokeballs["normal"].effect if it.ball and pokeballs[it.ball] then balleffect = pokeballs[it.ball].effect end doSendMagicEffect(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) end local name = it.nick ~= "" and it.nick or getCreatureName(this).."s "..it.name --alterado v1.3 doCreatureSay(this, gobackmsgs[math.random(#gobackmsgs)].go:gsub("doka", getPlayerStorageValue(summon, 1007)), 1) fighting = true battle_turn = battle_turn + 1end--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--local function goToOrigPos()target = 0selfFollow(0)fighting = falsechallenger = 0challenger_turn = 0if #getCreatureSummons(getNpcCid()) >= 1 then setPlayerStorageValue(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) then local list = getSpectators(getNpcPos(), 9, 9, false) for i = 1, table.getn(list) do local _target = list if(_target ~= 0) then if isPlayer(_target) and isOfficer(_target) and not getTileInfo(getThingPos(_target)).protection then --alterado v1.8 selfSay(rocketTalks[math.random(#rocketTalks)]) doNpcSetCreatureFocus(_target) target = _target prevTarget = target break end end endendend--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--function onCreatureAppear(cid)end function onCreatureDisappear(cid)end function onCreatureMove(creature, oldPos, newPos)--end--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--function onThink()if not isCreature(getNpcCid()) then return false end --alterado v1.6if origPos == 0 then origPos = getNpcPos()endif getPlayerStorageValue(getNpcCid(), 665451) <= 0 then setPlayerStorageValue(getNpcCid(), 665451, 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 then goToOrigPos() --alterado v1.9end------------------------------------------------------if(target == 0) thenif getPlayerStorageValue(getNpcCid(), 154788) <= 0 then setPlayerStorageValue(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 then setPlayerStorageValue(getNpcCid(), 154788, -1) doRegainSpeed(getNpcCid()) if isCreature(target) then selfFollow(target) endendend------------------------------------------------------if getDistanceBetween(playerPos, myPos) <= 3 thenif getPlayerStorageValue(getNpcCid(), 154788) <= 0 then setPlayerStorageValue(getNpcCid(), 154788, 1) doChangeSpeed(getNpcCid(), -getCreatureSpeed(getNpcCid())) addEvent(randWalk, 2000, getNpcCid(), 1000, getPlayerStorageValue(getNpcCid(), 154788), target)endend------------------------------------------------------if getDistanceBetween(playerPos, myPos) <= 5 then challenger = target addEvent(doSummonGymPokemon, 850, getNpcCid()) local change = false if not isCreature(target) then target = 0 battle_turn = battle_turn == 1 and battle_turn or battle_turn-1 return trueend if fighting then if not isCreature(getCreatureTarget(getNpcCid())) then if #getCreatureSummons(challenger) >= 1 then selfAttackCreature(getCreatureSummons(challenger)[1]) change = true else if change then change = false challenger_turn = challenger_turn + 1 end end end if #getCreatureSummons(getNpcCid()) == 0 and isCreature(target) then if battle_turn > #wildCommanderRocket[getPlayerStorageValue(getNpcCid(), 665451)] then addEvent(doCreateNpc, 300000, ".aCommanderRocket", myPos) --alterado v1.5 local outfit = getCreatureOutfit(getNpcCid()) doRemoveCreature(getNpcCid()) ---------------------------------------- if outfit.lookType == 605 then --verifica se o npc eh female.. ;p monster = doCreateMonster("aCommanderRocketFemale", myPos) else monster = doCreateMonster("aCommanderRocket", myPos) end ---------------------------------------- doCloneOut(monster, outfit) addEvent(beDrunk, 100, monster) end addEvent(doSummonGymPokemon, 1000, getNpcCid()) end if #getCreatureSummons(challenger) <= 0 then selfAttackCreature(challenger) end endendend Lembrando quero que um ataque o outro mais que nao deixe de atacar o player com a storage rocket ou police
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.