• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Question] Passing contests stats down via breeding

  • 10
    Posts
    8
    Years
    • Seen Mar 12, 2023
    I'm still super new to Ruby (I know python kinda well) and I'd like to set it up so breeding passes down contest stats like IVs and I'm unsure of what all I need to address. I would love some directions on anything I might need to change to make sure this works. Specifically, what parts of the scripts I might not be able to find looking for codewords like ivinherit. Hard to find every instance when you have to click through a bunch of individual scripts.

    Edit: After realizing just how my code would not work, I've instead replaced that all with this code in Overworld_Daycare

    Code:
      # Inheriting contest Values
      cvspassed = 3
      conteststats = [cool,beauty,tough,cute,smart]
      contestvalue = [0,1,2,3,4]
      contestvalue = contestvalue.sort{rand()-0.5}
      cvroll = contestvalue[0..(cvspassed - 1)]
      cvroll.each do |stat|
        cvspassed = conteststats[stat]
      r = rand(2)
      num = 0
      2.times do
        parent = [mother,father][r]
        egg.cvspassed[num] = parent.cvspassed[num]
        num += 1
      end

    My main worry is if .cvspassed[num] will actually go to egg.cool and parent.cool, etc.?
     
    Last edited:
  • 10
    Posts
    8
    Years
    • Seen Mar 12, 2023
    So this is what I got working in the end, in case anyone wants to replicate it later.

    Code:
    # Inheriting contest Values
      cvspassed = 2
      statspassed = []
      num = 0
      egg.cool = father.cool and statspassed.push(0) and num +=1 if father.hasItem?(:REDSCARF)
      egg.beauty = father.beauty and statspassed.push(1) and num +=1 if father.hasItem?(:BLUESCARF)
      egg.tough = father.tough and statspassed.push(2) and num +=1 if father.hasItem?(:YELLOWSCARF)
      egg.cute = father.cute and statspassed.push(3) and num +=1 if father.hasItem?(:PINKSCARF)
      egg.smart = father.smart and statspassed.push(4) and num +=1 if father.hasItem?(:GREENSCARF)
      egg.cool = mother.cool and statspassed.push(0) and num +=1 if mother.hasItem?(:REDSCARF)
      egg.beauty = mother.beauty and statspassed.push(1) and num +=1 if mother.hasItem?(:BLUESCARF)
      egg.tough = mother.tough and statspassed.push(2) and num +=1 if mother.hasItem?(:YELLOWSCARF)
      egg.cute = mother.cute and statspassed.push(3) and num +=1 if mother.hasItem?(:PINKSCARF)
      egg.smart = mother.smart and statspassed.push(4) and num +=1 if mother.hasItem?(:GREENSCARF)
      r = rand(2)
      loop do
        roll = rand(5)
        while statspassed.include?(roll) do
          roll = rand(5)
        end
        if r == 0
          if roll == 0
            egg.cool = father.cool
            statspassed.push(0)
          elsif roll == 1
            egg.beauty = father.beauty
            statspassed.push(1)
          elsif roll == 2
            egg.tough = father.tough
            statspassed.push(2)
          elsif roll == 3
            egg.cute = father.cute
            statspassed.push(3)
          elsif roll == 4
            egg.smart = father.smart
            statspassed.push(4)
          end
        elsif r == 1
          if roll == 0
            egg.cool = mother.cool
            statspassed.push(0)
          elsif roll == 1
            egg.beauty = mother.beauty
            statspassed.push(1)
          elsif roll == 2
            egg.tough = mother.tough
            statspassed.push(2)
          elsif roll == 3
            egg.cute = mother.cute
            statspassed.push(3)
          elsif roll == 4
            egg.smart = mother.smart
            statspassed.push(4)
          end
        end
        num += 1
        r = (r+1)%2
        break if num>=cvspassed
      end
     
    Back
    Top