Ir para conteúdo
  • 0

Spawn Aleatorio de Megas (Igual os Shinys)


Pergunta

Galera Seguinte, Queria adicionar um Spawn aleatorio de pokemons megas no meu servidor...

Tentei fazer de um jeito que vi aqui no forum só que bugou tudo meu server, os ataques em area dos pokemons selvagens começaram a acertar os outros selvagens...

 

Este é meu Spawn.lua

 

  Mostrar conteúdo oculto

 

Pf ajudem ai Rep+++

Link para o comentário
https://xtibia.com/forum/topic/249194-spawn-aleatorio-de-megas-igual-os-shinys/
Compartilhar em outros sites

Posts Recomendados

  • 0
local megas = {"Venusaur", "Blastoise"} 
local shinys = {
"Venusaur", "Blastoise", "Butterfree", "Beedrill", "Pidgeot", "Rattata", "Raticate", "Raichu", "Golbat", "Paras", "Parasect", "Magmar", "Typhlosion", "Xatu", "Growlithe", "Arcanine", "Tentacruel", "Farfetch'd", "Gengar", "Krabby", "Tauros", 
"Kingler", "Cubone", "Horsea", "Seadra", "Weezing", "Scyther", "Pinsir", "Crobat", "Zubat", "Tentacool", "Feraligatr", "Machamp", "Tangela", "Ampharos", "Electabuzz", "Jynx", "Charizard", "Voltorb", "Electrode", "Megenium", "Blaziken"}

local raros = {"Dragonair", "Dratini", "Alakazam", "Gyarados", "Azumarill", "Dragonite", "Salamence", "Mantine", "Gardevoir", "Steelix", "Porygon", "Porygon2", "Shedinja"}                               

local function ShinyName(cid)
if isCreature(cid) then
   if string.find(tostring(getCreatureName(cid)), "Shiny") then
      local newName = tostring(getCreatureName(cid)):match("(.*)")          
      doCreatureSetNick(cid, newName)
      if isMonster(cid) then
         doSetCreatureDropLoot(cid, false)  
      end
   end
end
end

local function doSetRandomGender(cid)
    if not isCreature(cid) then return true end
    if isSummon(cid) then return true end
    local gender = 0
    local name = getCreatureName(cid)
    if not newpokedex[name] then return true end
    local rate = newpokedex[name].gender
        if rate == 0 then
            gender = 3
        elseif rate == 500 then
            gender = 4
        elseif rate == -1 then
            gender = 2
        elseif math.random(1, 500) <= rate then
            gender = 4
        else
            gender = 3
        end
    doCreatureSetSkullType(cid, gender)
end

local function doShiny(cid)
if isCreature(cid) then
   if isSummon(cid) then return true end
   if getPlayerStorageValue(cid, 74469) >= 1 then return true end
   if getPlayerStorageValue(cid, 22546) >= 1 then return true end 
   if isNpcSummon(cid) then return true end
   if getPlayerStorageValue(cid, 637500) >= 1 then return true end  --alterado v1.9
   
if isInArray(shinys, getCreatureName(cid)) then  --alterado v1.9 \/
   chance = 10.0    --1% chance        
elseif isInArray(raros, getCreatureName(cid)) then   --n coloquem valores menores que 0.1 !!
   chance = 5.8   --1% chance       
else
   return true
end    
    if math.random(1, 500) <= chance*10 then  
      doSendMagicEffect(getThingPos(cid), 18)               
      local name, pos = "Shiny ".. getCreatureName(cid), getThingPos(cid)
      doRemoveCreature(cid)
      local shi = doCreateMonster(name, pos, false)
      setPlayerStorageValue(shi, 74469, 1)      
   else
       setPlayerStorageValue(cid, 74469, 1)
   end                                        --/\
else                                                            
return true
end
end

local function doMega(cid)
if isCreature(cid) then
   if isSummon(cid) then return true end
   if getPlayerStorageValue(cid, 74469) >= 1 then return true end
   if getPlayerStorageValue(cid, 22546) >= 1 then return true end 
   if isNpcSummon(cid) then return true end
   if getPlayerStorageValue(cid, 637500) >= 1 then return true end  --alterado v1.9
   
if isInArray(megas, getCreatureName(cid)) then  --alterado v1.9 \/
   chance = 100.0    --1% chance        
   return true
end    
    if math.random(1, 500) <= chance*10 then  
      doSendMagicEffect(getThingPos(cid), 18)               
      local name, pos = "Mega ".. getCreatureName(cid), getThingPos(cid)
      doRemoveCreature(cid)
      local shi = doCreateMonster(name, pos, false)
      setPlayerStorageValue(shi, 74469, 1)      
   else
       setPlayerStorageValue(cid, 74469, 1)
   end                                        --/\
else                                                            
return true
end
end

                                                                
function onSpawn(cid)

    registerCreatureEvent(cid, "Experience")
    registerCreatureEvent(cid, "GeneralConfiguration")
    registerCreatureEvent(cid, "DirectionSystem")
    registerCreatureEvent(cid, "CastSystem")
    
    if isSummon(cid) then
        registerCreatureEvent(cid, "SummonDeath")
    return true
    end
    
    addEvent(doShiny, 10, cid)
    addEvent(doMega, 10, cid)
    addEvent(ShinyName, 15, cid)
    addEvent(adjustWildPoke, 5, cid)

return true
end

 

Não tenho certeza se vai funcionar, mas testa aí. Adiciona ali os mega que tem. Tá com 100% de chance de spawnar só pra testar, dps vc coloca a chance que vc quiser ai.

Atenção: Siga o prefixo de postagem, primeiro aviso.

 

Link para o comentário
https://xtibia.com/forum/topic/249194-spawn-aleatorio-de-megas-igual-os-shinys/#findComment-1748864
Compartilhar em outros sites

  • 0
  Em 21/02/2019 em 15:15, bXnny disse:
local megas = {"Venusaur", "Blastoise"} 
local shinys = {
"Venusaur", "Blastoise", "Butterfree", "Beedrill", "Pidgeot", "Rattata", "Raticate", "Raichu", "Golbat", "Paras", "Parasect", "Magmar", "Typhlosion", "Xatu", "Growlithe", "Arcanine", "Tentacruel", "Farfetch'd", "Gengar", "Krabby", "Tauros", 
"Kingler", "Cubone", "Horsea", "Seadra", "Weezing", "Scyther", "Pinsir", "Crobat", "Zubat", "Tentacool", "Feraligatr", "Machamp", "Tangela", "Ampharos", "Electabuzz", "Jynx", "Charizard", "Voltorb", "Electrode", "Megenium", "Blaziken"}

local raros = {"Dragonair", "Dratini", "Alakazam", "Gyarados", "Azumarill", "Dragonite", "Salamence", "Mantine", "Gardevoir", "Steelix", "Porygon", "Porygon2", "Shedinja"}                               

local function ShinyName(cid)
if isCreature(cid) then
   if string.find(tostring(getCreatureName(cid)), "Shiny") then
      local newName = tostring(getCreatureName(cid)):match("(.*)")          
      doCreatureSetNick(cid, newName)
      if isMonster(cid) then
         doSetCreatureDropLoot(cid, false)  
      end
   end
end
end

local function doSetRandomGender(cid)
    if not isCreature(cid) then return true end
    if isSummon(cid) then return true end
    local gender = 0
    local name = getCreatureName(cid)
    if not newpokedex[name] then return true end
    local rate = newpokedex[name].gender
        if rate == 0 then
            gender = 3
        elseif rate == 500 then
            gender = 4
        elseif rate == -1 then
            gender = 2
        elseif math.random(1, 500) <= rate then
            gender = 4
        else
            gender = 3
        end
    doCreatureSetSkullType(cid, gender)
end

local function doShiny(cid)
if isCreature(cid) then
   if isSummon(cid) then return true end
   if getPlayerStorageValue(cid, 74469) >= 1 then return true end
   if getPlayerStorageValue(cid, 22546) >= 1 then return true end 
   if isNpcSummon(cid) then return true end
   if getPlayerStorageValue(cid, 637500) >= 1 then return true end  --alterado v1.9
   
if isInArray(shinys, getCreatureName(cid)) then  --alterado v1.9 \/
   chance = 10.0    --1% chance        
elseif isInArray(raros, getCreatureName(cid)) then   --n coloquem valores menores que 0.1 !!
   chance = 5.8   --1% chance       
else
   return true
end    
    if math.random(1, 500) <= chance*10 then  
      doSendMagicEffect(getThingPos(cid), 18)               
      local name, pos = "Shiny ".. getCreatureName(cid), getThingPos(cid)
      doRemoveCreature(cid)
      local shi = doCreateMonster(name, pos, false)
      setPlayerStorageValue(shi, 74469, 1)      
   else
       setPlayerStorageValue(cid, 74469, 1)
   end                                        --/\
else                                                            
return true
end
end

local function doMega(cid)
if isCreature(cid) then
   if isSummon(cid) then return true end
   if getPlayerStorageValue(cid, 74469) >= 1 then return true end
   if getPlayerStorageValue(cid, 22546) >= 1 then return true end 
   if isNpcSummon(cid) then return true end
   if getPlayerStorageValue(cid, 637500) >= 1 then return true end  --alterado v1.9
   
if isInArray(megas, getCreatureName(cid)) then  --alterado v1.9 \/
   chance = 100.0    --1% chance        
   return true
end    
    if math.random(1, 500) <= chance*10 then  
      doSendMagicEffect(getThingPos(cid), 18)               
      local name, pos = "Mega ".. getCreatureName(cid), getThingPos(cid)
      doRemoveCreature(cid)
      local shi = doCreateMonster(name, pos, false)
      setPlayerStorageValue(shi, 74469, 1)      
   else
       setPlayerStorageValue(cid, 74469, 1)
   end                                        --/\
else                                                            
return true
end
end

                                                                
function onSpawn(cid)

    registerCreatureEvent(cid, "Experience")
    registerCreatureEvent(cid, "GeneralConfiguration")
    registerCreatureEvent(cid, "DirectionSystem")
    registerCreatureEvent(cid, "CastSystem")
    
    if isSummon(cid) then
        registerCreatureEvent(cid, "SummonDeath")
    return true
    end
    
    addEvent(doShiny, 10, cid)
    addEvent(doMega, 10, cid)
    addEvent(ShinyName, 15, cid)
    addEvent(adjustWildPoke, 5, cid)

return true
end

 

Não tenho certeza se vai funcionar, mas testa aí. Adiciona ali os mega que tem. Tá com 100% de chance de spawnar só pra testar, dps vc coloca a chance que vc quiser ai.

Atenção: Siga o prefixo de postagem, primeiro aviso.

 

Expand  
  Em 21/02/2019 em 15:15, bXnny disse:
local megas = {"Venusaur", "Blastoise"} 
local shinys = {
"Venusaur", "Blastoise", "Butterfree", "Beedrill", "Pidgeot", "Rattata", "Raticate", "Raichu", "Golbat", "Paras", "Parasect", "Magmar", "Typhlosion", "Xatu", "Growlithe", "Arcanine", "Tentacruel", "Farfetch'd", "Gengar", "Krabby", "Tauros", 
"Kingler", "Cubone", "Horsea", "Seadra", "Weezing", "Scyther", "Pinsir", "Crobat", "Zubat", "Tentacool", "Feraligatr", "Machamp", "Tangela", "Ampharos", "Electabuzz", "Jynx", "Charizard", "Voltorb", "Electrode", "Megenium", "Blaziken"}

local raros = {"Dragonair", "Dratini", "Alakazam", "Gyarados", "Azumarill", "Dragonite", "Salamence", "Mantine", "Gardevoir", "Steelix", "Porygon", "Porygon2", "Shedinja"}                               

local function ShinyName(cid)
if isCreature(cid) then
   if string.find(tostring(getCreatureName(cid)), "Shiny") then
      local newName = tostring(getCreatureName(cid)):match("(.*)")          
      doCreatureSetNick(cid, newName)
      if isMonster(cid) then
         doSetCreatureDropLoot(cid, false)  
      end
   end
end
end

local function doSetRandomGender(cid)
    if not isCreature(cid) then return true end
    if isSummon(cid) then return true end
    local gender = 0
    local name = getCreatureName(cid)
    if not newpokedex[name] then return true end
    local rate = newpokedex[name].gender
        if rate == 0 then
            gender = 3
        elseif rate == 500 then
            gender = 4
        elseif rate == -1 then
            gender = 2
        elseif math.random(1, 500) <= rate then
            gender = 4
        else
            gender = 3
        end
    doCreatureSetSkullType(cid, gender)
end

local function doShiny(cid)
if isCreature(cid) then
   if isSummon(cid) then return true end
   if getPlayerStorageValue(cid, 74469) >= 1 then return true end
   if getPlayerStorageValue(cid, 22546) >= 1 then return true end 
   if isNpcSummon(cid) then return true end
   if getPlayerStorageValue(cid, 637500) >= 1 then return true end  --alterado v1.9
   
if isInArray(shinys, getCreatureName(cid)) then  --alterado v1.9 \/
   chance = 10.0    --1% chance        
elseif isInArray(raros, getCreatureName(cid)) then   --n coloquem valores menores que 0.1 !!
   chance = 5.8   --1% chance       
else
   return true
end    
    if math.random(1, 500) <= chance*10 then  
      doSendMagicEffect(getThingPos(cid), 18)               
      local name, pos = "Shiny ".. getCreatureName(cid), getThingPos(cid)
      doRemoveCreature(cid)
      local shi = doCreateMonster(name, pos, false)
      setPlayerStorageValue(shi, 74469, 1)      
   else
       setPlayerStorageValue(cid, 74469, 1)
   end                                        --/\
else                                                            
return true
end
end

local function doMega(cid)
if isCreature(cid) then
   if isSummon(cid) then return true end
   if getPlayerStorageValue(cid, 74469) >= 1 then return true end
   if getPlayerStorageValue(cid, 22546) >= 1 then return true end 
   if isNpcSummon(cid) then return true end
   if getPlayerStorageValue(cid, 637500) >= 1 then return true end  --alterado v1.9
   
if isInArray(megas, getCreatureName(cid)) then  --alterado v1.9 \/
   chance = 100.0    --1% chance        
   return true
end    
    if math.random(1, 500) <= chance*10 then  
      doSendMagicEffect(getThingPos(cid), 18)               
      local name, pos = "Mega ".. getCreatureName(cid), getThingPos(cid)
      doRemoveCreature(cid)
      local shi = doCreateMonster(name, pos, false)
      setPlayerStorageValue(shi, 74469, 1)      
   else
       setPlayerStorageValue(cid, 74469, 1)
   end                                        --/\
else                                                            
return true
end
end

                                                                
function onSpawn(cid)

    registerCreatureEvent(cid, "Experience")
    registerCreatureEvent(cid, "GeneralConfiguration")
    registerCreatureEvent(cid, "DirectionSystem")
    registerCreatureEvent(cid, "CastSystem")
    
    if isSummon(cid) then
        registerCreatureEvent(cid, "SummonDeath")
    return true
    end
    
    addEvent(doShiny, 10, cid)
    addEvent(doMega, 10, cid)
    addEvent(ShinyName, 15, cid)
    addEvent(adjustWildPoke, 5, cid)

return true
end

 

Não tenho certeza se vai funcionar, mas testa aí. Adiciona ali os mega que tem. Tá com 100% de chance de spawnar só pra testar, dps vc coloca a chance que vc quiser ai.

Atenção: Siga o prefixo de postagem, primeiro aviso.

 

Expand  

Amigo eu testei aqui... Infelizmente não funcionou e ainda apareceu esse erro na distro: 

 

[Error - CreatureScript Interface]
In a timer event called from:
data/creaturescripts/scripts/spawn.lua:onSpawn
Description:
data/creaturescripts/scripts/spawn.lua:82: attempt to perform arithmetic on global 'chance' (a nil value)
stack traceback:
        data/creaturescripts/scripts/spawn.lua:82: in function <data/creaturescripts/scripts/spawn.lua:70>

Link para o comentário
https://xtibia.com/forum/topic/249194-spawn-aleatorio-de-megas-igual-os-shinys/#findComment-1748865
Compartilhar em outros sites

  • 0

Erro meu

local megas = {"Venusaur", "Blastoise"} 
local shinys = {
"Venusaur", "Blastoise", "Butterfree", "Beedrill", "Pidgeot", "Rattata", "Raticate", "Raichu", "Golbat", "Paras", "Parasect", "Magmar", "Typhlosion", "Xatu", "Growlithe", "Arcanine", "Tentacruel", "Farfetch'd", "Gengar", "Krabby", "Tauros", 
"Kingler", "Cubone", "Horsea", "Seadra", "Weezing", "Scyther", "Pinsir", "Crobat", "Zubat", "Tentacool", "Feraligatr", "Machamp", "Tangela", "Ampharos", "Electabuzz", "Jynx", "Charizard", "Voltorb", "Electrode", "Megenium", "Blaziken"}

local raros = {"Dragonair", "Dratini", "Alakazam", "Gyarados", "Azumarill", "Dragonite", "Salamence", "Mantine", "Gardevoir", "Steelix", "Porygon", "Porygon2", "Shedinja"}                               

local function ShinyName(cid)
if isCreature(cid) then
   if string.find(tostring(getCreatureName(cid)), "Shiny") then
      local newName = tostring(getCreatureName(cid)):match("(.*)")          
      doCreatureSetNick(cid, newName)
      if isMonster(cid) then
         doSetCreatureDropLoot(cid, false)  
      end
   end
end
end

local function doSetRandomGender(cid)
    if not isCreature(cid) then return true end
    if isSummon(cid) then return true end
    local gender = 0
    local name = getCreatureName(cid)
    if not newpokedex[name] then return true end
    local rate = newpokedex[name].gender
        if rate == 0 then
            gender = 3
        elseif rate == 500 then
            gender = 4
        elseif rate == -1 then
            gender = 2
        elseif math.random(1, 500) <= rate then
            gender = 4
        else
            gender = 3
        end
    doCreatureSetSkullType(cid, gender)
end

local function doShiny(cid)
if isCreature(cid) then
   if isSummon(cid) then return true end
   if getPlayerStorageValue(cid, 74469) >= 1 then return true end
   if getPlayerStorageValue(cid, 22546) >= 1 then return true end 
   if isNpcSummon(cid) then return true end
   if getPlayerStorageValue(cid, 637500) >= 1 then return true end  --alterado v1.9
   
if isInArray(shinys, getCreatureName(cid)) then  --alterado v1.9 \/
   chance = 10.0    --1% chance        
elseif isInArray(raros, getCreatureName(cid)) then   --n coloquem valores menores que 0.1 !!
   chance = 5.8   --1% chance       
else
   return true
end    
    if math.random(1, 500) <= chance*10 then  
      doSendMagicEffect(getThingPos(cid), 18)               
      local name, pos = "Shiny ".. getCreatureName(cid), getThingPos(cid)
      doRemoveCreature(cid)
      local shi = doCreateMonster(name, pos, false)
      setPlayerStorageValue(shi, 74469, 1)      
   else
       setPlayerStorageValue(cid, 74469, 1)
   end                                        --/\
else                                                            
return true
end
end

local function doMega(cid)
if isCreature(cid) then
   if isSummon(cid) then return true end
   if getPlayerStorageValue(cid, 74469) >= 1 then return true end
   if getPlayerStorageValue(cid, 22546) >= 1 then return true end 
   if isNpcSummon(cid) then return true end
   if getPlayerStorageValue(cid, 637500) >= 1 then return true end  --alterado v1.9
   
if isInArray(megas, getCreatureName(cid)) then  --alterado v1.9 \/
   local chancemega = 100.0    --1% chance        
   return true
end    
    if math.random(1, 500) <= chancemega*10 then  
      doSendMagicEffect(getThingPos(cid), 18)               
      local name, pos = "Mega ".. getCreatureName(cid), getThingPos(cid)
      doRemoveCreature(cid)
      local shi = doCreateMonster(name, pos, false)
      setPlayerStorageValue(shi, 74469, 1)      
   else
       setPlayerStorageValue(cid, 74469, 1)
   end                                        --/\
else                                                            
return true
end
end

                                                                
function onSpawn(cid)

    registerCreatureEvent(cid, "Experience")
    registerCreatureEvent(cid, "GeneralConfiguration")
    registerCreatureEvent(cid, "DirectionSystem")
    registerCreatureEvent(cid, "CastSystem")
    
    if isSummon(cid) then
        registerCreatureEvent(cid, "SummonDeath")
    return true
    end
    
    addEvent(doShiny, 10, cid)
    addEvent(doMega, 10, cid)
    addEvent(ShinyName, 15, cid)
    addEvent(adjustWildPoke, 5, cid)

return true
end

 

Link para o comentário
https://xtibia.com/forum/topic/249194-spawn-aleatorio-de-megas-igual-os-shinys/#findComment-1748867
Compartilhar em outros sites

  • 0
  Em 21/02/2019 em 15:35, bXnny disse:

Erro meu

local megas = {"Venusaur", "Blastoise"} 
local shinys = {
"Venusaur", "Blastoise", "Butterfree", "Beedrill", "Pidgeot", "Rattata", "Raticate", "Raichu", "Golbat", "Paras", "Parasect", "Magmar", "Typhlosion", "Xatu", "Growlithe", "Arcanine", "Tentacruel", "Farfetch'd", "Gengar", "Krabby", "Tauros", 
"Kingler", "Cubone", "Horsea", "Seadra", "Weezing", "Scyther", "Pinsir", "Crobat", "Zubat", "Tentacool", "Feraligatr", "Machamp", "Tangela", "Ampharos", "Electabuzz", "Jynx", "Charizard", "Voltorb", "Electrode", "Megenium", "Blaziken"}

local raros = {"Dragonair", "Dratini", "Alakazam", "Gyarados", "Azumarill", "Dragonite", "Salamence", "Mantine", "Gardevoir", "Steelix", "Porygon", "Porygon2", "Shedinja"}                               

local function ShinyName(cid)
if isCreature(cid) then
   if string.find(tostring(getCreatureName(cid)), "Shiny") then
      local newName = tostring(getCreatureName(cid)):match("(.*)")          
      doCreatureSetNick(cid, newName)
      if isMonster(cid) then
         doSetCreatureDropLoot(cid, false)  
      end
   end
end
end

local function doSetRandomGender(cid)
    if not isCreature(cid) then return true end
    if isSummon(cid) then return true end
    local gender = 0
    local name = getCreatureName(cid)
    if not newpokedex[name] then return true end
    local rate = newpokedex[name].gender
        if rate == 0 then
            gender = 3
        elseif rate == 500 then
            gender = 4
        elseif rate == -1 then
            gender = 2
        elseif math.random(1, 500) <= rate then
            gender = 4
        else
            gender = 3
        end
    doCreatureSetSkullType(cid, gender)
end

local function doShiny(cid)
if isCreature(cid) then
   if isSummon(cid) then return true end
   if getPlayerStorageValue(cid, 74469) >= 1 then return true end
   if getPlayerStorageValue(cid, 22546) >= 1 then return true end 
   if isNpcSummon(cid) then return true end
   if getPlayerStorageValue(cid, 637500) >= 1 then return true end  --alterado v1.9
   
if isInArray(shinys, getCreatureName(cid)) then  --alterado v1.9 \/
   chance = 10.0    --1% chance        
elseif isInArray(raros, getCreatureName(cid)) then   --n coloquem valores menores que 0.1 !!
   chance = 5.8   --1% chance       
else
   return true
end    
    if math.random(1, 500) <= chance*10 then  
      doSendMagicEffect(getThingPos(cid), 18)               
      local name, pos = "Shiny ".. getCreatureName(cid), getThingPos(cid)
      doRemoveCreature(cid)
      local shi = doCreateMonster(name, pos, false)
      setPlayerStorageValue(shi, 74469, 1)      
   else
       setPlayerStorageValue(cid, 74469, 1)
   end                                        --/\
else                                                            
return true
end
end

local function doMega(cid)
if isCreature(cid) then
   if isSummon(cid) then return true end
   if getPlayerStorageValue(cid, 74469) >= 1 then return true end
   if getPlayerStorageValue(cid, 22546) >= 1 then return true end 
   if isNpcSummon(cid) then return true end
   if getPlayerStorageValue(cid, 637500) >= 1 then return true end  --alterado v1.9
   
if isInArray(megas, getCreatureName(cid)) then  --alterado v1.9 \/
   local chancemega = 100.0    --1% chance        
   return true
end    
    if math.random(1, 500) <= chancemega*10 then  
      doSendMagicEffect(getThingPos(cid), 18)               
      local name, pos = "Mega ".. getCreatureName(cid), getThingPos(cid)
      doRemoveCreature(cid)
      local shi = doCreateMonster(name, pos, false)
      setPlayerStorageValue(shi, 74469, 1)      
   else
       setPlayerStorageValue(cid, 74469, 1)
   end                                        --/\
else                                                            
return true
end
end

                                                                
function onSpawn(cid)

    registerCreatureEvent(cid, "Experience")
    registerCreatureEvent(cid, "GeneralConfiguration")
    registerCreatureEvent(cid, "DirectionSystem")
    registerCreatureEvent(cid, "CastSystem")
    
    if isSummon(cid) then
        registerCreatureEvent(cid, "SummonDeath")
    return true
    end
    
    addEvent(doShiny, 10, cid)
    addEvent(doMega, 10, cid)
    addEvent(ShinyName, 15, cid)
    addEvent(adjustWildPoke, 5, cid)

return true
end

começou a dar esse erro sem parar! 

image.thumb.png.98c771ed01f97b5275cd4311b285617e.png

Expand  

 

Editado por fhoenix00
[Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/spawn.lua:114: unexpected symbol near '´' [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/spawn.lua) data/creaturescripts/scripts/spawn.lua:114: unexpected
Link para o comentário
https://xtibia.com/forum/topic/249194-spawn-aleatorio-de-megas-igual-os-shinys/#findComment-1748869
Compartilhar em outros sites

  • 0
local megas = {"Venusaur", "Blastoise"}
local shinys = {
  "Venusaur", "Blastoise", "Butterfree", "Beedrill", "Pidgeot", "Rattata", "Raticate", "Raichu", "Golbat", "Paras", "Parasect", "Magmar", "Typhlosion", "Xatu", "Growlithe", "Arcanine", "Tentacruel", "Farfetch'd", "Gengar", "Krabby", "Tauros",
  "Kingler", "Cubone", "Horsea", "Seadra", "Weezing", "Scyther", "Pinsir", "Crobat", "Zubat", "Tentacool", "Feraligatr", "Machamp", "Tangela", "Ampharos", "Electabuzz", "Jynx", "Charizard", "Voltorb", "Electrode", "Megenium", "Blaziken"}

  local raros = {"Dragonair", "Dratini", "Alakazam", "Gyarados", "Azumarill", "Dragonite", "Salamence", "Mantine", "Gardevoir", "Steelix", "Porygon", "Porygon2", "Shedinja"}

  local function ShinyName(cid)
    if isCreature(cid) then
      if string.find(tostring(getCreatureName(cid)), "Shiny") then
        local newName = tostring(getCreatureName(cid)):match("(.*)")
        doCreatureSetNick(cid, newName)
        if isMonster(cid) then
          doSetCreatureDropLoot(cid, false)
        end
      end
    end
  end

  local function doSetRandomGender(cid)
    if not isCreature(cid) then return true end
    if isSummon(cid) then return true end
    local gender = 0
    local name = getCreatureName(cid)
    if not newpokedex[name] then return true end
    local rate = newpokedex[name].gender
    if rate == 0 then
      gender = 3
    elseif rate == 500 then
      gender = 4
    elseif rate == -1 then
      gender = 2
    elseif math.random(1, 500) <= rate then
      gender = 4
    else
      gender = 3
    end
    doCreatureSetSkullType(cid, gender)
  end

  local function doShiny(cid)
    if isCreature(cid) then
      if isSummon(cid) then return true end
      if getPlayerStorageValue(cid, 74469) >= 1 then return true end
      if getPlayerStorageValue(cid, 22546) >= 1 then return true end
      if isNpcSummon(cid) then return true end
      if getPlayerStorageValue(cid, 637500) >= 1 then return true end  --alterado v1.9

      if isInArray(shinys, getCreatureName(cid)) then  --alterado v1.9 \/
        chance = 10.0    --1% chance
      elseif isInArray(raros, getCreatureName(cid)) then   --n coloquem valores menores que 0.1 !!
        chance = 5.8   --1% chance
      else
        return true
      end
      if math.random(1, 500) <= chance*10 then
        doSendMagicEffect(getThingPos(cid), 18)
        local name, pos = "Shiny ".. getCreatureName(cid), getThingPos(cid)
        doRemoveCreature(cid)
        local shi = doCreateMonster(name, pos, false)
        setPlayerStorageValue(shi, 74469, 1)
      else
        setPlayerStorageValue(cid, 74469, 1)
      end                                        --/\
    else
      return true
    end
  end

  local function doMega(cid)
    if isCreature(cid) then
      if isSummon(cid) then return true end
      if getPlayerStorageValue(cid, 74469) >= 1 then return true end
      if getPlayerStorageValue(cid, 22546) >= 1 then return true end
      if isNpcSummon(cid) then return true end
      if getPlayerStorageValue(cid, 637500) >= 1 then return true end  --alterado v1.9

      if isInArray(megas, getCreatureName(cid)) then  --alterado v1.9 \/
        local chancemega = 100.0    --1% chance
        return true
      end
      if math.random(1, 500) <= chancemega*10 then
        doSendMagicEffect(getThingPos(cid), 18)
        local name, pos = "Mega ".. getCreatureName(cid), getThingPos(cid)
        doRemoveCreature(cid)
        local shi = doCreateMonster(name, pos, false)
        setPlayerStorageValue(shi, 74469, 1)
      else
        setPlayerStorageValue(cid, 74469, 1)
      end                                        --/\
    else
      return true
    end
  end


  function onSpawn(cid)

    registerCreatureEvent(cid, "Experience")
    registerCreatureEvent(cid, "GeneralConfiguration")
    registerCreatureEvent(cid, "DirectionSystem")
    registerCreatureEvent(cid, "CastSystem")

    if isSummon(cid) then
      registerCreatureEvent(cid, "SummonDeath")
      return true
    end

    addEvent(doShiny, 10, cid)
    addEvent(doMega, 10, cid)
    addEvent(ShinyName, 15, cid)
    addEvent(adjustWildPoke, 5, cid)

    return true
  end

 

Cara, tá achando um caractere que nem tem no script.
Copia do jeito que tá e na hora de jogar no notepad++ da um ctr+a e seleciona essa opção: 

image.png

Link para o comentário
https://xtibia.com/forum/topic/249194-spawn-aleatorio-de-megas-igual-os-shinys/#findComment-1748871
Compartilhar em outros sites

  • 0
  Em 21/02/2019 em 16:00, bXnny disse:
local megas = {"Venusaur", "Blastoise"}
local shinys = {
  "Venusaur", "Blastoise", "Butterfree", "Beedrill", "Pidgeot", "Rattata", "Raticate", "Raichu", "Golbat", "Paras", "Parasect", "Magmar", "Typhlosion", "Xatu", "Growlithe", "Arcanine", "Tentacruel", "Farfetch'd", "Gengar", "Krabby", "Tauros",
  "Kingler", "Cubone", "Horsea", "Seadra", "Weezing", "Scyther", "Pinsir", "Crobat", "Zubat", "Tentacool", "Feraligatr", "Machamp", "Tangela", "Ampharos", "Electabuzz", "Jynx", "Charizard", "Voltorb", "Electrode", "Megenium", "Blaziken"}

  local raros = {"Dragonair", "Dratini", "Alakazam", "Gyarados", "Azumarill", "Dragonite", "Salamence", "Mantine", "Gardevoir", "Steelix", "Porygon", "Porygon2", "Shedinja"}

  local function ShinyName(cid)
    if isCreature(cid) then
      if string.find(tostring(getCreatureName(cid)), "Shiny") then
        local newName = tostring(getCreatureName(cid)):match("(.*)")
        doCreatureSetNick(cid, newName)
        if isMonster(cid) then
          doSetCreatureDropLoot(cid, false)
        end
      end
    end
  end

  local function doSetRandomGender(cid)
    if not isCreature(cid) then return true end
    if isSummon(cid) then return true end
    local gender = 0
    local name = getCreatureName(cid)
    if not newpokedex[name] then return true end
    local rate = newpokedex[name].gender
    if rate == 0 then
      gender = 3
    elseif rate == 500 then
      gender = 4
    elseif rate == -1 then
      gender = 2
    elseif math.random(1, 500) <= rate then
      gender = 4
    else
      gender = 3
    end
    doCreatureSetSkullType(cid, gender)
  end

  local function doShiny(cid)
    if isCreature(cid) then
      if isSummon(cid) then return true end
      if getPlayerStorageValue(cid, 74469) >= 1 then return true end
      if getPlayerStorageValue(cid, 22546) >= 1 then return true end
      if isNpcSummon(cid) then return true end
      if getPlayerStorageValue(cid, 637500) >= 1 then return true end  --alterado v1.9

      if isInArray(shinys, getCreatureName(cid)) then  --alterado v1.9 \/
        chance = 10.0    --1% chance
      elseif isInArray(raros, getCreatureName(cid)) then   --n coloquem valores menores que 0.1 !!
        chance = 5.8   --1% chance
      else
        return true
      end
      if math.random(1, 500) <= chance*10 then
        doSendMagicEffect(getThingPos(cid), 18)
        local name, pos = "Shiny ".. getCreatureName(cid), getThingPos(cid)
        doRemoveCreature(cid)
        local shi = doCreateMonster(name, pos, false)
        setPlayerStorageValue(shi, 74469, 1)
      else
        setPlayerStorageValue(cid, 74469, 1)
      end                                        --/\
    else
      return true
    end
  end

  local function doMega(cid)
    if isCreature(cid) then
      if isSummon(cid) then return true end
      if getPlayerStorageValue(cid, 74469) >= 1 then return true end
      if getPlayerStorageValue(cid, 22546) >= 1 then return true end
      if isNpcSummon(cid) then return true end
      if getPlayerStorageValue(cid, 637500) >= 1 then return true end  --alterado v1.9

      if isInArray(megas, getCreatureName(cid)) then  --alterado v1.9 \/
        local chancemega = 100.0    --1% chance
        return true
      end
      if math.random(1, 500) <= chancemega*10 then
        doSendMagicEffect(getThingPos(cid), 18)
        local name, pos = "Mega ".. getCreatureName(cid), getThingPos(cid)
        doRemoveCreature(cid)
        local shi = doCreateMonster(name, pos, false)
        setPlayerStorageValue(shi, 74469, 1)
      else
        setPlayerStorageValue(cid, 74469, 1)
      end                                        --/\
    else
      return true
    end
  end


  function onSpawn(cid)

    registerCreatureEvent(cid, "Experience")
    registerCreatureEvent(cid, "GeneralConfiguration")
    registerCreatureEvent(cid, "DirectionSystem")
    registerCreatureEvent(cid, "CastSystem")

    if isSummon(cid) then
      registerCreatureEvent(cid, "SummonDeath")
      return true
    end

    addEvent(doShiny, 10, cid)
    addEvent(doMega, 10, cid)
    addEvent(ShinyName, 15, cid)
    addEvent(adjustWildPoke, 5, cid)

    return true
  end

 

Cara, tá achando um caractere que nem tem no script.
Copia do jeito que tá e na hora de jogar no notepad++ da um ctr+a e seleciona essa opção: 

image.png

Expand  

 

Nada ainda :( 

 

image.thumb.png.c80b851b3790f318e68939f3146e4eda.png

  Em 21/02/2019 em 15:57, Refe disse:

Manda seu creaturescripts.xml

Expand  

<?xml version="1.0" encoding="UTF-8"?>

<creaturescripts>


    
     <event type="joinchannel" name="ShowPokedex" event="script" value="newpokedex.lua"/>
    <event type="leavechannel" name="ClosePokedex" event="script" value="newpokedex.lua"/>
    <event type="kill" name="pokemons" event="script" value="bosses.lua"/>
    <event type="login" name="aloot_reg" event="script" value="aloot.lua"/>
    <event type="kill" name="aloot_kill" event="script" value="aloot.lua"/>
    <event type="kill" name="dropStone" script="dropStone.lua"/>
    <event type="login" name="PlayerLogin" event="script" value="login.lua"/>
     <event type="login" name="AntiMc" event="script" value="antimc.lua"/>
    <event type="kill" name="ExpBonus" event="script" value="exp.lua"/>
    <event type="login" name="ExpVip" event="script" value="vipexp.lua"/>    
    <event type="logout" name="flylogoutno" registerTo="player" event="script" value="Flylogout.lua"/>
    <event type="logout" name="surflogoutno" registerTo="player" event="script" value="Surflogout.lua"/>
    <event type="logout" name="ridelogoutno" registerTo="player" event="script" value="Ridelogout.lua"/>


        <event type="death" name="ArticunoTeleport" script="tparticuno.lua"/>

       <event type="death" name="tel" event="script" value="tel.lua"/>

    <event type="receivemail" name="Mail" event="script" value="mail.lua"/>

    <event type="reportbug" name="SaveReportBug" script="reportbug.lua"/>
    
    <event type="think" name="Idle" event="script" value="idle.lua"/>


    <event type="death" name="Experience" event="script" value="pokeexp.lua"/>

    <event type="spawn" name="Spawn" event="script" value="spawn.lua"/>

    <event type="think" name="t" event="script" value="wildpoke.lua"/>

    <event type="think" name="PokemonIdle" event="script" value="poketele.lua"/>

    <event type="statschange" name="GeneralConfiguration" event="script" value="exp2.0.lua"/>
    <event type="advance" name="EffectOnAdvance" event="script" value="levelup.lua"/>


    <event type="direction" name="DirectionSystem" event="script" value="wildpoke.lua"/>
    <event type="attack" name="AttackSystem" event="script" value="wildpoke.lua"/>
    <event type="cast" name="CastSystem" event="script" value="wildpoke.lua"/>
    <event type="target" name="WildAttack" event="script" value="playerattack.lua"/>
    <event type="death" name="tp1" event="script" value="Tp-Celebi.lua"/>
    <event type="death" name="tp2" event="script" value="Tp-Heatran.lua"/>
    <event type="death" name="tp3" event="script" value="Tp-Keldeo.lua"/>
    <event type="death" name="tp4" event="script" value="Tp-Zekrom.lua"/>
    <event type="death" name="tp5" event="script" value="Tp-Giratina.lua"/>
    <event type="death" name="tp6" event="script" value="Tp-Arceus.lua"/>
    <event type="death" name="tp7" event="script" value="Tp-Cresselia.lua"/>    
    <event type="death" name="tp8" event="script" value="Tp-Terrakion.lua"/>
    <event type="death" name="tp9" event="script" value="Tp-Ho-oh.lua"/>    
    <event type="death" name="tp10" event="script" value="Tp-Cobalion.lua"/>
    <event type="death" name="tp11" event="script" value="Tp-Reshiram.lua"/>
    <event type="death" name="tp12" event="script" value="Tp-Genesect.lua"/>    


    <event type="look" name="LookSystem" event="script" value="look.lua"/>


    <event type="death" name="SummonDeath" event="script" value="goback.lua"/>
    <event type="logout" name="PlayerLogout" event="script" value="goback.lua"/>


    <event type="traderequest" name="T2" event="script" value="trade system.lua"/>

    <event type="tradeaccept" name="T1" event="script" value="trade system.lua"/>
    
    
</creaturescripts>
 

Ta ai 

Link para o comentário
https://xtibia.com/forum/topic/249194-spawn-aleatorio-de-megas-igual-os-shinys/#findComment-1748872
Compartilhar em outros sites

  • 0
  Em 21/02/2019 em 16:18, fhoenix00 disse:

 

Nada ainda :( 

 

image.thumb.png.c80b851b3790f318e68939f3146e4eda.png

<?xml version="1.0" encoding="UTF-8"?>

<creaturescripts>


    
     <event type="joinchannel" name="ShowPokedex" event="script" value="newpokedex.lua"/>
    <event type="leavechannel" name="ClosePokedex" event="script" value="newpokedex.lua"/>
    <event type="kill" name="pokemons" event="script" value="bosses.lua"/>
    <event type="login" name="aloot_reg" event="script" value="aloot.lua"/>
    <event type="kill" name="aloot_kill" event="script" value="aloot.lua"/>
    <event type="kill" name="dropStone" script="dropStone.lua"/>
    <event type="login" name="PlayerLogin" event="script" value="login.lua"/>
     <event type="login" name="AntiMc" event="script" value="antimc.lua"/>
    <event type="kill" name="ExpBonus" event="script" value="exp.lua"/>
    <event type="login" name="ExpVip" event="script" value="vipexp.lua"/>    
    <event type="logout" name="flylogoutno" registerTo="player" event="script" value="Flylogout.lua"/>
    <event type="logout" name="surflogoutno" registerTo="player" event="script" value="Surflogout.lua"/>
    <event type="logout" name="ridelogoutno" registerTo="player" event="script" value="Ridelogout.lua"/>


        <event type="death" name="ArticunoTeleport" script="tparticuno.lua"/>

       <event type="death" name="tel" event="script" value="tel.lua"/>

    <event type="receivemail" name="Mail" event="script" value="mail.lua"/>

    <event type="reportbug" name="SaveReportBug" script="reportbug.lua"/>
    
    <event type="think" name="Idle" event="script" value="idle.lua"/>


    <event type="death" name="Experience" event="script" value="pokeexp.lua"/>

    <event type="spawn" name="Spawn" event="script" value="spawn.lua"/>

    <event type="think" name="t" event="script" value="wildpoke.lua"/>

    <event type="think" name="PokemonIdle" event="script" value="poketele.lua"/>

    <event type="statschange" name="GeneralConfiguration" event="script" value="exp2.0.lua"/>
    <event type="advance" name="EffectOnAdvance" event="script" value="levelup.lua"/>


    <event type="direction" name="DirectionSystem" event="script" value="wildpoke.lua"/>
    <event type="attack" name="AttackSystem" event="script" value="wildpoke.lua"/>
    <event type="cast" name="CastSystem" event="script" value="wildpoke.lua"/>
    <event type="target" name="WildAttack" event="script" value="playerattack.lua"/>
    <event type="death" name="tp1" event="script" value="Tp-Celebi.lua"/>
    <event type="death" name="tp2" event="script" value="Tp-Heatran.lua"/>
    <event type="death" name="tp3" event="script" value="Tp-Keldeo.lua"/>
    <event type="death" name="tp4" event="script" value="Tp-Zekrom.lua"/>
    <event type="death" name="tp5" event="script" value="Tp-Giratina.lua"/>
    <event type="death" name="tp6" event="script" value="Tp-Arceus.lua"/>
    <event type="death" name="tp7" event="script" value="Tp-Cresselia.lua"/>    
    <event type="death" name="tp8" event="script" value="Tp-Terrakion.lua"/>
    <event type="death" name="tp9" event="script" value="Tp-Ho-oh.lua"/>    
    <event type="death" name="tp10" event="script" value="Tp-Cobalion.lua"/>
    <event type="death" name="tp11" event="script" value="Tp-Reshiram.lua"/>
    <event type="death" name="tp12" event="script" value="Tp-Genesect.lua"/>    


    <event type="look" name="LookSystem" event="script" value="look.lua"/>


    <event type="death" name="SummonDeath" event="script" value="goback.lua"/>
    <event type="logout" name="PlayerLogout" event="script" value="goback.lua"/>


    <event type="traderequest" name="T2" event="script" value="trade system.lua"/>

    <event type="tradeaccept" name="T1" event="script" value="trade system.lua"/>
    
    
</creaturescripts>
 

Ta ai 

Expand  

Utilize a opção image.png para postar seus códigos, por favor.

Link para o comentário
https://xtibia.com/forum/topic/249194-spawn-aleatorio-de-megas-igual-os-shinys/#findComment-1748873
Compartilhar em outros sites

  • 0

@UP

 

Fui testar o script e no meu server ta dando isso .. 

[24/02/2019 07:52:56] >> Cargando scripts
[24/02/2019 07:52:58] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/spawn.lua:115: unexpected symbol near 'ï'
[24/02/2019 07:52:58] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/spawn.lua)
[24/02/2019 07:52:58] data/creaturescripts/scripts/spawn.lua:115: unexpected symbol near 'ï'
[24/02/2019 07:52:58] >> Cargando chat channels

Esse "symbol near 'i' " aparecia quando eu editava os .lua por bloco de notas, comecei a abrir em Notepad ++ e tinha parado de dar esse error, provavelmente era a formatação do bloco de notas. Mas mesmo no Notepad ++ ta dando esse error, mesmo formatando para ANSI como você @bXnny sugeriu .

Link para o comentário
https://xtibia.com/forum/topic/249194-spawn-aleatorio-de-megas-igual-os-shinys/#findComment-1749092
Compartilhar em outros sites

  • 0
  Em 24/02/2019 em 10:56, Kooask disse:

@UP

 

Fui testar o script e no meu server ta dando isso .. 

[24/02/2019 07:52:56] >> Cargando scripts
[24/02/2019 07:52:58] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/spawn.lua:115: unexpected symbol near 'ï'
[24/02/2019 07:52:58] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/spawn.lua)
[24/02/2019 07:52:58] data/creaturescripts/scripts/spawn.lua:115: unexpected symbol near 'ï'
[24/02/2019 07:52:58] >> Cargando chat channels

Esse "symbol near 'i' " aparecia quando eu editava os .lua por bloco de notas, comecei a abrir em Notepad ++ e tinha parado de dar esse error, provavelmente era a formatação do bloco de notas. Mas mesmo no Notepad ++ ta dando esse error, mesmo formatando para ANSI como você @bXnny sugeriu .

Expand  

Me envia a linha 115

Link para o comentário
https://xtibia.com/forum/topic/249194-spawn-aleatorio-de-megas-igual-os-shinys/#findComment-1749099
Compartilhar em outros sites

  • 0
  Em 24/02/2019 em 14:58, Refe disse:

Me envia a linha 115

Expand  

Foi falta de curiosidade minha não olhar a linha 115 ... Ela estava assim   

  Citar

end

Expand  

 O problema que deu agora foi exatamente onde o guri ali tinha falado 

 

  Citar

  local function doMega(cid)
    if isCreature(cid) then
      if isSummon(cid) then return true end
      if getPlayerStorageValue(cid, 74469) >= 1 then return true end
      if getPlayerStorageValue(cid, 22546) >= 1 then return true end
      if isNpcSummon(cid) then return true end
      if getPlayerStorageValue(cid, 637500) >= 1 then return true end  --alterado v1.9

      if isInArray(megas, getCreatureName(cid)) then  --alterado v1.9 \/
        local chancemega = 100.0    --1% chance                 
        return true
      end
      if math.random(1, 500) <= chancemega*10 then
        doSendMagicEffect(getThingPos(cid), 18)
        local name, pos = "Mega ".. getCreatureName(cid), getThingPos(cid)
        doRemoveCreature(cid)
        local shi = doCreateMonster(name, pos, false)
        setPlayerStorageValue(shi, 74469, 1)
      else
        setPlayerStorageValue(cid, 74469, 1)
      end                                        --/\
    else
      return true
    end
  end

Expand  

 O problema ta vindo dessa linha 79 e 82 que coloquei em Amarelo. No executável fica mostrando error nesse 'chancemega'

Editado por Kooask
Link para o comentário
https://xtibia.com/forum/topic/249194-spawn-aleatorio-de-megas-igual-os-shinys/#findComment-1749122
Compartilhar em outros sites

  • 0

@fhoenix00 Teste

 

  Mostrar conteúdo oculto

 

Link para o comentário
https://xtibia.com/forum/topic/249194-spawn-aleatorio-de-megas-igual-os-shinys/#findComment-1749238
Compartilhar em outros sites

  • 0
  Em 26/02/2019 em 14:33, Marshmello disse:

@fhoenix00 Teste

 

  Mostrar conteúdo oculto

 

Expand  

ok vou testar, qualquer coisa eu aviso

Acabei de testar aqui e não funcionou :/

Link para o comentário
https://xtibia.com/forum/topic/249194-spawn-aleatorio-de-megas-igual-os-shinys/#findComment-1749290
Compartilhar em outros sites

  • 0
  Em 27/02/2019 em 14:54, fhoenix00 disse:

ok vou testar, qualquer coisa eu aviso

Acabei de testar aqui e não funcionou :/

Expand  

Da algum erro na distro?, oque aconteceu que n funcionou?

Link para o comentário
https://xtibia.com/forum/topic/249194-spawn-aleatorio-de-megas-igual-os-shinys/#findComment-1749299
Compartilhar em outros sites

×
×
  • Criar Novo...