Advertiser Content
Male
Seen 2 Weeks Ago
Posted 4 Weeks Ago
153 posts
186 Days
paste the definition of your function pbBallTypeToBall

Edit: oh actually it's a intern function

def pbBallTypeToBall(balltype)
  if $BallTypes[balltype]
    ret=getID(PBItems,$BallTypes[balltype])
    return ret if ret!=0
  end
  if $BallTypes[0]
    ret=getID(PBItems,$BallTypes[0])
    return ret if ret!=0
  end
  return getID(PBItems,:POKEBALL)
end
Male
Seen 2 Weeks Ago
Posted 4 Weeks Ago
153 posts
186 Days
The first problem in your event is that your two script lines are separated so there is no way a variable is kept from one to the other. you need to keep the value of the variable. you could try something like this
value=pbChooseBallList
pbBallTypeToBall(value)
in a single script command

I guess the choose pokemon should also be in the same script
Seen 1 Day Ago
Posted 3 Weeks Ago
4 posts
34 Days
uh, all right i did that

[IMG]cdn.discordapp.com/attachments/350448314099040258/634584927165349891/unknown.png[/IMG]

and i suppose i could leave the other code too? this is how it shows up in the original script

    when "setpokeball"
      commands = []; balls = []
      for key in $BallTypes.keys
        item = getID(PBItems,$BallTypes[key])
        balls.push([key.to_i,PBItems.getName(item)]) if item && item>0
      end
      balls.sort! {|a,b| a[1]<=>b[1]}
      cmd = 0
      for i in 0...balls.length
        if balls[i][0]==pkmn.ballused
          cmd = i; break
        end
      end
      for i in balls
        commands.push(i[1])
      end
      loop do
        oldball = PBItems.getName(pbBallTypeToBall(pkmn.ballused))
        cmd = @scene.pbShowCommands(_INTL("{1} used.",oldball),commands,cmd)
        break if cmd<0
        pkmn.ballused = balls[cmd][0]
      end
    #=========
not really sure how to call it; pretty sure it isn't an issue with THIS code since it works fine when invoked via debug menu
Male
Seen 2 Weeks Ago
Posted 4 Weeks Ago
153 posts
186 Days
I can't check the script now, but I checked the picture of your event and you also need a link between the chosen poke and the pokeball that needs to be changed. I dont know which arguments the method is taking but it could look like this:

poke=pbChooseNonEggPokemon(1,2)
newballtogive=pbChooseBallList
poke.ballused=newballtogive
I'am not sure pbBallTypeToBall(newballtogive) is actually necessary you have to check with what kind of arguments are needed but in general to transfer values from a function to another in a non confusing way the best is to use variables. And it's also nice to give them obvious names so everyone understands what they are used for.

I found this mother.ballused in the daycare script and mother refers as a pokemon so this might work
Advertiser Content