FL

[Resolvido] Arrumar o código

Por FlamesAdmin, 31 de ago. de 2018 em Resolvidos

7
1.7k
31 de agosto de 2018 às 02:24

alguem por favor poderia arrumar meu spawn.lua?
 



local shinys = {
"Oddish", "Venusaur", "Charizard", "Blastoise", "Butterfree", "Beedrill", "Pidgeot", "Rattata", "Raticate", "Raichu", "Zubat", "Golbat", "Paras", "Parasect", 
"Venonat", "Venomoth", "Growlithe", "Arcanine", "Alakazam", "Tentacool", "Tentacruel", "Farfetch'd", "Grimer", "Muk", "Gengar", "Krabby", 
"Kingler", "Voltorb", "Electrode", "Cubone", "Marowak", "Tangela", "Horsea", "Seadra", "Scyther", "Jynx", "Electabuzz", "Pinsir", 
"Magikarp", "Magmar", "Typhlosion", "Feraligatr", "Meganium", "Xatu", "Machamp", "Tauros", "Larvitar", "Pupitar", "Ampharos", "Magcargo", "Lanturn"}
local raros = {"Dragonair", "Dratini", "Dragonite", "Gyarados"}
local new = {"Lanturn"}
local specialSummon = {
    chance = 1,
    pokes = {
        {"Milotic", "Electivire", "Magmortar", "Metagross", "Tangrowth", "Slaking", "Rhyperior"},
        {"Manectric", "Camerupt", "Blaziken", "Sceptile", "Swampert", "Glalie", "Flygon", "Kirlia", "Lairon", "Lucario", "Metang", "Ludicolo", "Banette", "Claydol", "Swellow", "Altaria", "Mawile"},
        }
local outlandSpawn = {
    chance = 500,
    pokes = {
        {"Zapdos", "Moltres", "Mew", "Mewtwo", "Articuno", "Entei", "Raikou", "Suicune"},
        {"Boxer Hitmonchan", "Capoeira Hitmontop", "Dragon Machamp", "Undefeated Machamp", "Tribal Feraligatr", "War Gyarados", "Brave Blastoise", "Furious Mantine", "Octopus Octillery", "Ancient Alakazam", "Tribal Xatu", "Enigmatic Girafarig", "Furious Girafarig", "Furious Scyther", "War Pinsir", "War Heracross", "Brute Rhydon", "Hard Golem", "Bone Marowak", "Furious Sandslash", "Roll Donphan", "Ancient Meeganium", "Brave Venusaur", "Charged Raichu", "Furious Ampharos", "Magnet Electabuzz", "Brave Nidoqueen", "Brave Nidoking", "Furious Crobat", "War Muk", "Banshee Misdreavus", "Trickmaster Gengar", "Brave Charizard", "Enraged Typhlosion", "Lava Magmar", "Wardog Arcanine", "War Granbull", "Singer Wigglytuff", "Moon Clefable", "Milch-Miltank", "Aviator Pidgeot", "Metal Skarmory", "Brave Noctowl", "Evil Cloyster", "Freezing Dewgong", "Heavy Piloswine", "Psy Jynx", "Ancient Dragonair"},
    },
}

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

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

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

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

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

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

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

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

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

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

local function GrassName(cid)
if isCreature(cid) then
   if string.find(tostring(getCreatureName(cid)), "Grass") then
      local newName = tostring(getCreatureName(cid)):match("Grass (.*)")
      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 == 1000 then
            gender = 4
        elseif rate == -1 then
            gender = 0
        elseif math.random(1, 1000) <= 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
   
if isInArray(shinys, getCreatureName(cid)) then
   chance = 3    
elseif isInArray(raros, getCreatureName(cid)) then
   chance = 3    
elseif isInArray(new, getCreatureName(cid)) then
   chance = 3
   else
   return true
end    
    if math.random(1, 1000) <= 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
                                                                
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(function()
        if isCreature(cid) then
            if isInArray(specialSummon.pokes[2], getCreatureName(cid)) then
                if math.random(1, 10000) <= specialSummon.chance*10 then
                    local position = getThingPos(cid)
                    doRemoveCreature(cid)
                    doCreateMonster(specialSummon.pokes[1][math.random(#specialSummon.pokes[1])], position)
                end
            end
        end
        addEvent(function()
        if isCreature(cid) then
            if isInArray(outlandSpawn.pokes[2], getCreatureName(cid)) then
                if math.random(1, 10000) <= outlandSpawn.chance*10 then
                    local position = getThingPos(cid)
                    doRemoveCreature(cid)
                    doCreateMonster(outlandSpawn.pokes[1][math.random(#outlandSpawn.pokes[1])], position)
                end
            end
        end
    end, 15)   
    addEvent(doSetRandomGender, 5, cid)
    addEvent(doShiny, 10, cid)
    addEvent(ShinyName, 15, cid)
    addEvent(MegaName, 15, cid)
    addEvent(LightName, 15, cid)
    addEvent(AncienttName, 15, cid)
    addEvent(GhostName, 15, cid)
    addEvent(WaterName, 15, cid)
    addEvent(FireName, 15, cid)
    addEvent(IceName, 15, cid)
    addEvent(FlyingName, 15, cid)
    addEvent(GrassName, 15, cid)
    addEvent(GiantName, 15, cid)
    addEvent(adjustWildPoke, 5, cid)

return true
end

 

[31/08/2018 02:24:19] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/spawn.lua:14: '}' expected (to close '{' at line 8) near 'local'
[31/08/2018 02:24:19] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/spawn.lua)
[31/08/2018 02:24:19] data/creaturescripts/scripts/spawn.lua:14: '}' expected (to close '{' at line 8) near 'local'

 

31 de agosto de 2018 às 12:10

@Narusenão é bem isso que quero
eu adicionei a parte outlandSpawn = { só que ta dando erro, e quero desse jeito que postei ai, nao sei oq falta ai

 

GengoG
31 de agosto de 2018 às 12:59

Ve se dá algum erro:

Spoiler
local shinys = {
"Oddish", "Venusaur", "Charizard", "Blastoise", "Butterfree", "Beedrill", "Pidgeot", "Rattata", "Raticate", "Raichu", "Zubat", "Golbat", "Paras", "Parasect", 
"Venonat", "Venomoth", "Growlithe", "Arcanine", "Alakazam", "Tentacool", "Tentacruel", "Farfetch'd", "Grimer", "Muk", "Gengar", "Krabby", 
"Kingler", "Voltorb", "Electrode", "Cubone", "Marowak", "Tangela", "Horsea", "Seadra", "Scyther", "Jynx", "Electabuzz", "Pinsir", 
"Magikarp", "Magmar", "Typhlosion", "Feraligatr", "Meganium", "Xatu", "Machamp", "Tauros", "Larvitar", "Pupitar", "Ampharos", "Magcargo", "Lanturn"}
local raros = {"Dragonair", "Dratini", "Dragonite", "Gyarados"}
local new = {"Lanturn"}
local specialSummon = {
    chance = 1,
    pokes = {
        {"Milotic", "Electivire", "Magmortar", "Metagross", "Tangrowth", "Slaking", "Rhyperior"},
        {"Manectric", "Camerupt", "Blaziken", "Sceptile", "Swampert", "Glalie", "Flygon", "Kirlia", "Lairon", "Lucario", "Metang", "Ludicolo", "Banette", "Claydol", "Swellow", "Altaria", "Mawile"},
        }
}
local outlandSpawn = {
    chance = 500,
    pokes = {
        {"Zapdos", "Moltres", "Mew", "Mewtwo", "Articuno", "Entei", "Raikou", "Suicune"},
        {"Boxer Hitmonchan", "Capoeira Hitmontop", "Dragon Machamp", "Undefeated Machamp", "Tribal Feraligatr", "War Gyarados", "Brave Blastoise", "Furious Mantine", "Octopus Octillery", "Ancient Alakazam", "Tribal Xatu", "Enigmatic Girafarig", "Furious Girafarig", "Furious Scyther", "War Pinsir", "War Heracross", "Brute Rhydon", "Hard Golem", "Bone Marowak", "Furious Sandslash", "Roll Donphan", "Ancient Meeganium", "Brave Venusaur", "Charged Raichu", "Furious Ampharos", "Magnet Electabuzz", "Brave Nidoqueen", "Brave Nidoking", "Furious Crobat", "War Muk", "Banshee Misdreavus", "Trickmaster Gengar", "Brave Charizard", "Enraged Typhlosion", "Lava Magmar", "Wardog Arcanine", "War Granbull", "Singer Wigglytuff", "Moon Clefable", "Milch-Miltank", "Aviator Pidgeot", "Metal Skarmory", "Brave Noctowl", "Evil Cloyster", "Freezing Dewgong", "Heavy Piloswine", "Psy Jynx", "Ancient Dragonair"},
    },
} 

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

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

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

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

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

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

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

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

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

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

local function GrassName(cid)
if isCreature(cid) then
   if string.find(tostring(getCreatureName(cid)), "Grass") then
      local newName = tostring(getCreatureName(cid)):match("Grass (.*)")
      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 == 1000 then
            gender = 4
        elseif rate == -1 then
            gender = 0
        elseif math.random(1, 1000) <= 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
   
if isInArray(shinys, getCreatureName(cid)) then
   chance = 3    
elseif isInArray(raros, getCreatureName(cid)) then
   chance = 3    
elseif isInArray(new, getCreatureName(cid)) then
   chance = 3
   else
   return true
end    
    if math.random(1, 1000) <= 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
                                                                
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(function()
        if isCreature(cid) then
            if isInArray(specialSummon.pokes[2], getCreatureName(cid)) then
                if math.random(1, 10000) <= specialSummon.chance*10 then
                    local position = getThingPos(cid)
                    doRemoveCreature(cid)
                    doCreateMonster(specialSummon.pokes[1][math.random(#specialSummon.pokes[1])], position)
                end
            end
        end
        addEvent(function()
        if isCreature(cid) then
            if isInArray(outlandSpawn.pokes[2], getCreatureName(cid)) then
                if math.random(1, 10000) <= outlandSpawn.chance*10 then
                    local position = getThingPos(cid)
                    doRemoveCreature(cid)
                    doCreateMonster(outlandSpawn.pokes[1][math.random(#outlandSpawn.pokes[1])], position)
                end
            end
        end
    end, 15)   
    addEvent(doSetRandomGender, 5, cid)
    addEvent(doShiny, 10, cid)
    addEvent(ShinyName, 15, cid)
    addEvent(MegaName, 15, cid)
    addEvent(LightName, 15, cid)
    addEvent(AncienttName, 15, cid)
    addEvent(GhostName, 15, cid)
    addEvent(WaterName, 15, cid)
    addEvent(FireName, 15, cid)
    addEvent(IceName, 15, cid)
    addEvent(FlyingName, 15, cid)
    addEvent(GrassName, 15, cid)
    addEvent(GiantName, 15, cid)
    addEvent(adjustWildPoke, 5, cid) 

return true
end

 

 

31 de agosto de 2018 às 13:02

@luis700

[31/08/2018 13:01:41] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/spawn.lua:255: ')' expected (to close '(' at line 218) near '<eof>'
[31/08/2018 13:01:41] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/spawn.lua)
[31/08/2018 13:01:41] data/creaturescripts/scripts/spawn.lua:255: ')' expected (to close '(' at line 218) near '<eof>'

GengoG
31 de agosto de 2018 às 13:06
5 minutos atrás, Naruse disse:

Me ajuda lá no topico la do dialogo

Do que precisa exatamente, pode falar por PM ou naquele topico mesmo, senão vai encher o topico aqui de outra questão

31 de agosto de 2018 às 13:09

@Naruse @luis700deu certo valeeeeu

6 meses depois...
MarshmelloM
20 de fevereiro de 2019 às 16:19
A questão neste tópico de suporte foi respondida e/ou o autor do tópico resolveu o problema. Este tópico está fechado e foi movido para Suporte - Resolvidos. Se você tiver outras dúvidas, crie um novo tópico.