It looks fantastic! Thank you so much!!Radius 144
I can't seem to get it to rotate perfectly no matter how hard I try. I think this is more than acceptable though
#Find
@style=WheelStyles[0]
#Change to
@style=WheelStyles[style]
	["100","2500","100","7500","100","10000","100","5000","100","15000"],
	!$PokemonBag.pbHasItem?(:COINCASE)
\CN\rYou don't have a Coin Case.
Exit Event Processing
else
Wheel(0,0,style=0)
	      if Input.trigger?(Input::C)
        if @cost>0
          confirmtext="\\CNSpin the wheel for #{@cost} coins? (ESC to quit)"
        else
          confirmtext="\\CNSpin the wheel?"
        end
          if pbConfirmMessage("#{confirmtext}")
            pbSEPlay(@style[4],@style[5],@style[6])
            if $Trainer.coins>=@cost
              $Trainer.coins-=@cost
            else
              pbMessage(_INTL("\\CNYou don't have enough coins..."))
              break
            end
	Some beautiful new graphics made by AiurJordan!
Not at all! You've been a huge help! I'll update the post again, thank you so much!Last one, sorry to keep hitting you with notifications.
Hm, that's really strange- it's treating ItemIconSprite like a constant, but I can't see any reason why that would be, and I'm not getting this error myself. Can you share your version of the script just so I can make sure nothing got messed up? And it looks like you've got some other scripts installed, could you tell me what all you have? I wonder if one of them doesn't have a compatibility issue with this.o que fazer?
Hm, that's really strange- it's treating ItemIconSprite like a constant, but I can't see any reason why that would be, and I'm not getting this error myself. Can you share your version of the script just so I can make sure nothing got messed up? And it looks like you've got some other scripts installed, could you tell me what all you have? I wonder if one of them doesn't have a compatibility issue with this.
Prizes = [
[:POKEBALL,:REPEATBALL,:FASTBALL,:LEVELBALL,:NESTBALL,:DUSKBALL,:DIVEBALL,:HEAVYBALL,:GREATBALL,:MASTERBALL],
[:CHARMANDER,:CYNDAQUIL,:EEVEE,:PIKACHU,:CHIKORITA,:BULBASAUR,:SQUIRTLE,:TOTODILE,:MARILL,:RATTATA],
["100","200","300","400","500","600","700","800","900","1000"],
[:POKEBALL,"100",:CHARMANDER,:POKEBALL,"100",:CHARMANDER,:POKEBALL,"100",:CHARMANDER,:POKEBALL,"100",:CHARMANDER,],
["100","2500","100","7500","100","10000","100","5000","100","15000"],
]
WheelStyles = [
#bg graphic, wheel graphic, radius, minimum spins,
#spin SFX, volume, pitch
#winning sfx, volume, pitch
["hatchbg","prizewheel",110,3,"battle ball shake",80,150,"mining reveal full",100,100],
["hatchbg","prizewheel2",110,3,"battle ball shake",80,150,"mining reveal full",100,100]
]
def Wheel(prizelist,cost,style=0,costcoins=false,prizecoins=false)
  PrizeWheel.new(prizelist,cost,style,costcoins,prizecoins)
end
class PrizeWheel
  def pbUpdate
    pbUpdateSpriteHash(@sprites)
  end
  def initialize(prizelist,cost,style=0,costcoins=false,prizecoins=false)
    @viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
    @prizes=Prizes[prizelist]
    @costcoins = costcoins
    @prizecoins = prizecoins
    @sprites = {}
    @cost=cost
    @style=WheelStyles[style]
    @bg=@style[0]
    @wheel=@style[1]
    @minspins=@style[3]
    @prizespin=0
    @angle=[72,36,0,313,287,251,216,180,144,108]
    @xyangle=[198,234,270,306,340,16,52,90,126,162]
    @sprites["bg"] = Sprite.new(@viewport)
    @sprites["bg"].bitmap = Bitmap.new("Graphics/Pictures/#{@bg}")
    @sprites["downarrow"] = AnimatedSprite.new("Graphics/Pictures/downarrow",8,28,40,2,@viewport)
    @sprites["downarrow"].x = (Graphics.width/2)-15
    @sprites["downarrow"].y = 10
    @sprites["downarrow"].z = 5
    @sprites["downarrow"].play
    @sprites["wheel"] = Sprite.new(@viewport)
    @sprites["wheel"].bitmap = Bitmap.new("Graphics/Pictures/#{@wheel}")
    @sprites["wheel"].center_origins
    @sprites["wheel"].x=Graphics.width/2
    @sprites["wheel"].y=Graphics.height/2
    for i in 0...10
      if getID(PBItems,@prizes[i])>0
        @sprites["prize#{i}"]=ItemIconSprite.new(0,0,0,@viewport)
        @sprites["prize#{i}"].item=getID(PBItems,@prizes[i])
        @sprites["prize#{i}"].center_origins
      elsif getID(PBSpecies,@prizes[i])>0
        @sprites["prize#{i}"]=PokemonSpeciesIconSprite.new(getID(PBSpecies,@prizes[i]),@viewport)
        @sprites["prize#{i}"].ox=32
        @sprites["prize#{i}"].oy=32
      else
        @sprites["prize#{i}"] = Sprite.new(@viewport)
        if @prizecoins == true
          @sprites["prize#{i}"].bitmap = Bitmap.new("Graphics/Items/COINCASE")
        else
          @sprites["prize#{i}"].bitmap = Bitmap.new("Graphics/Pictures/Money")
        end
        @sprites["prize#{i}"].center_origins
      end
      @sprites["prize#{i}"].angle = @angle[i]
      @sprites["prize#{i}"].x=(Graphics.width/2) + Math.cos(@xyangle[i].degrees)*@style[2]
      @sprites["prize#{i}"].y=(Graphics.height/2) + Math.sin(@xyangle[i].degrees)*@style[2]
    end
    main
  end
  def main
    loop do
      Graphics.update
      Input.update
      pbUpdate
      if Input.trigger?(Input::C)
        if @cost>0
          if @costcoins == true
            confirmtext="Spin the wheel for #{@cost} coins?"
          else
            confirmtext="Spin the wheel for $#{@cost}?"
          end
        else
          confirmtext="Spin the wheel?"
        end
          if pbConfirmMessage("#{confirmtext}")
            if @costcoins == true
              if $Trainer.coins>=@cost
                $Trainer.coins-=@cost
              else
               pbMessage(_INTL("You don't have enough coins..."))
                break
              end
            else
              if $Trainer.money>=@cost
                $Trainer.money-=@cost
              else
                pbMessage(_INTL("You don't have enough money..."))
                break
              end
            end
          spins=rand(360)
          spins+=360*(@minspins)
          spun=0
          click=true
          loop do
          pbUpdate
            @sprites["wheel"].angle -= 5
            @prizespin+=5
             for i in 0...10
              @sprites["prize#{i}"].angle -= 5
                @sprites["prize#{i}"].x= (Graphics.width/2) + Math.cos((@xyangle[i]+@prizespin).degrees)*@style[2]
                @sprites["prize#{i}"].y= (Graphics.height/2) + Math.sin((@xyangle[i]+@prizespin).degrees)*@style[2]
            end
            spun+=5
            Graphics.update
            if click=true
                pbSEPlay(@style[4],@style[5],@style[6])
                click=false
              else
                click=true
            end
            if spun>=spins
            prize=0
            prizey=[]
            for i in 0...10
              prizey[i]=@sprites["prize#{i}"].y
            end
             winner=prizey.min
              for i in 0...10
                if @sprites["prize#{i}"].y==winner
                   prize=i
                 end
              end
              prize=@prizes[prize]
              pbSEPlay(@style[7],@style[8],@style[9])
                if getID(PBItems,prize)>0
                pbUpdate
                pbReceiveItem(prize)
              elsif
                getID(PBSpecies,prize)>0
                pbUpdate
                  pbAddPokemon(prize,20)
              else
                if @prizecoins == true
                  pbMessage("You won #{prize} coins!")
                  prize = prize.to_i
                  $Trainer.coins+=prize
                else
                  pbMessage("You won $#{prize}!")
                  prize = prize.to_i
                  $Trainer.money+=prize
                end
              end
            break
            end
          end
        end
      end
      if Input.trigger?(Input::B)
        break
      end
    end
    pbFadeOutAndHide(@sprites) {pbUpdate}
    dispose
  end
  def dispose
    pbDisposeSpriteHash(@sprites)
    @viewport.dispose
  end
end
#center_origins command from Marin's Scripting Utilities.
#If you have that script, you can delete this section
class Sprite
    def center_origins
      return if !self.bitmap
      self.ox = self.bitmap.width / 2
      self.oy = self.bitmap.height / 2
  end
end
#.degrees command, to convert degrees to radians
class Numeric
     def degrees
     self * Math::PI / 180
     end
end
	Oh, that's fun! I think daily events are a nice way to keep minigames like this relevant!Hi Tech. I was wondering if there was a way to kick the player from the Prize Wheel screen once they've spun the wheel once. I'm trying to make it a daily event in my game, but right now I can spin endlessly as long as I stay in the Prize Wheel screen. Thanks in advance!
                  pbFadeOutAndHide(@sprites) {pbUpdate}
                  dispose
	              if GameData::Item.try_get(prize)
                pbUpdate
                pbReceiveItem(prize)
                  pbFadeOutAndHide(@sprites) {pbUpdate}
                  dispose
              elsif GameData::Species.try_get(prize)
                pbUpdate
                  pbAddPokemon(prize,20)
                  pbFadeOutAndHide(@sprites) {pbUpdate}
                  dispose
              else
                if @prizecoins == true
                  pbMessage("You won #{prize} coins!")
                  prize = prize.to_i
                  $Trainer.coins+=prize
                  pbFadeOutAndHide(@sprites) {pbUpdate}
                  dispose
                else
                  pbMessage("You won $#{prize}!")
                  prize = prize.to_i
                  $Trainer.money+=prize
                  pbFadeOutAndHide(@sprites) {pbUpdate}
                  dispose
                end
	Thanks for the fast help! Nice!Oh, that's fun! I think daily events are a nice way to keep minigames like this relevant!
I should rewrite the code to make this simpler, but a cheap fix for now- in the section around line 150, put
under the code for each way the player receives their prize. It should end up looking like this:Ruby:pbFadeOutAndHide(@sprites) {pbUpdate} dispose
Ruby:if GameData::Item.try_get(prize) pbUpdate pbReceiveItem(prize) pbFadeOutAndHide(@sprites) {pbUpdate} dispose elsif GameData::Species.try_get(prize) pbUpdate pbAddPokemon(prize,20) pbFadeOutAndHide(@sprites) {pbUpdate} dispose else if @prizecoins == true pbMessage("You won #{prize} coins!") prize = prize.to_i $Trainer.coins+=prize pbFadeOutAndHide(@sprites) {pbUpdate} dispose else pbMessage("You won $#{prize}!") prize = prize.to_i $Trainer.money+=prize pbFadeOutAndHide(@sprites) {pbUpdate} dispose end
Not sure why this is working this way, but it was defaulting to shiny menu sprites for Pokemon if the game had any, should be fixed now! It's just a one-line change- if you're using an older version, under
Ruby:@sprites["prize#{i}"]=PokemonSpeciesIconSprite.new(@prizes[i],@viewport)
Add:
Ruby:@sprites["prize#{i}"].shiny = false
Thanks to ImZero for reporting!
Remove this part of the script:Hey I was wondering if there was a way to remove the "Spin the wheel? Yes or No" so the wheel just spins when a player interacts with it.
        if @cost>0
          if @costcoins == true
            confirmtext="Spin the wheel for #{@cost} coins?"
          else
            confirmtext="Spin the wheel for $#{@cost}?"
          end
        else
          confirmtext="Spin the wheel?"
        end
          if pbConfirmMessage("#{confirmtext}")
	            break
            end
          end
        end
      end
	v20 update comes with some great overhauls!
- Data is now set up in a module with named values that can be set in any order, rather than an array. (Thanks to ThatWelshOne_ for this, I based it on his Modern Quest System!
 - As a result of this, default values for wheels can be set as well!
 - Cost and currency are now properties of the wheel itself rather than done in the event. All you do in the event is just call the wheel data!
 - Currencies are now set as integers, not strings...
 
Not yet possible, sorry! I’ll be adding it in the future!Nice wheel :D
How can i put as a prize 5 Pokeball instead of only 1?
Nice :D thanks!Not yet possible, sorry! I’ll be adding it in the future!