- Pokémon Essentials Version
- v20.1 ➖
This script lets you create Prize Wheels that players can spin to win one of ten prizes! Your prize pool can be Pokemon, items, money, or a mix of the three!
(Yes I got this idea from Webkinz/Neopets what are you a cop)
(Yes I got this idea from Webkinz/Neopets what are you a cop)
Code
Paste in a new section above Main, or download as a plugin for v20 here.
Ruby:
module WheelData
DEFAULT_BACKGROUND = "hatchbg"
DEFAULT_WHEEL = "prizewheel"
DEFAULT_RADIUS = 110
DEFAULT_MINSPINS = 3
DEFAULT_RESPIN = true
DEFAULT_COST = 0
DEFAULT_COSTCOINS = false
DEFAULT_PRIZECOINS = false
DEFAULT_SPINSFX = ["battle ball shake",80,150]
DEFUALT_WINSFX = ["mining reveal full",100,100]
DEFAULT_LEVEL = 20
Wheel = {
:background => "hatchbg",
:wheel => "prizewheel",
:radius => 110,
:minspins => 3,
:respin => false,
:cost => 10,
:costcoins => false,
:prizecoins => false,
:spinsfx => ["battle ball shake",80,150],
:winsfx => ["mining reveal full",100,100],
:level => 20,
:prizes => [:GREATBALL,
:NETBALL,
:FRIENDBALL,
:NESTBALL,
:ULTRABALL,
:LEVELBALL,
:FASTBALL,
:POKEBALL,
:HEALBALL,
:MASTERBALL]
}
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
def pbWheel(wheeldata)
PrizeWheelScene.new(wheeldata)
end
class PrizeWheelScene
def pbUpdate
pbUpdateSpriteHash(@sprites)
end
def initialize(wheeldata)
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
wheeldata = WheelData.const_get(wheeldata)
@respin = (wheeldata[:respin]) ? wheeldata[:respin] : WheelData::DEFAULT_RESPIN
@cost=(wheeldata[:cost]) ? wheeldata[:cost] : 0
@costcoins = (wheeldata[:costcoins]) ? wheeldata[:costcoins] : WheelData::DEFAULT_COSTCOINS
@prizecoins = (wheeldata[:prizecoins]) ? wheeldata[:prizecoins] : WheelData::DEFAULT_PRIZECOINS
@prizes=wheeldata[:prizes]
@sprites = {}
@bg = (wheeldata[:bg]) ? wheeldata[:bg] : WheelData::DEFAULT_BACKGROUND
@wheel = (wheeldata[:wheel]) ? wheeldata[:wheel] : WheelData::DEFAULT_WHEEL
@radius = (wheeldata[:radius]) ? wheeldata[:radius] : WheelData::DEFAULT_RADIUS
@minspins = (wheeldata[:minspins]) ? wheeldata[:minspins] : WheelData::DEFAULT_MINSPINS
@spinsfx = (wheeldata[:spinsfx]) ? wheeldata[:spinsfx] : WheelData::DEFAULT_SPINSFX
@winsfx = (wheeldata[:winsfx]) ? wheeldata[:winsfx] : WheelData::DEFUALT_WINSFX
@level = (wheeldata[:level]) ? wheeldata[:level] : WheelData::DEFAULT_LEVEL
raise _INTL("Invalid level. (exceeds maximum level)") if @level > Settings::MAXIMUM_LEVEL
@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
raise _INTL("Not enough prizes.") if !@prizes[i]
display = @prizes[i]
display = @prizes[i][0] if @prizes[i].is_a?(Array)
if display.is_a?(Symbol) && !GameData::Item.try_get(display) &&
!GameData::Species.try_get(display)
raise _INTL("#{display} is not an item or species.")
end
if display.is_a?(Integer)
@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
elsif display.is_a?(String)
@sprites["prize#{i}"] = Sprite.new(@viewport)
@sprites["prize#{i}"].bitmap = Bitmap.new("Graphics/#{display}")
@sprites["prize#{i}"].center_origins
elsif GameData::Item.try_get(display)
@sprites["prize#{i}"]=ItemIconSprite.new(0,0,nil,@viewport)
@sprites["prize#{i}"].item = display
@sprites["prize#{i}"].ox=24
@sprites["prize#{i}"].oy=24
elsif GameData::Species.try_get(display)
@sprites["prize#{i}"]=PokemonSpeciesIconSprite.new(display,@viewport)
@sprites["prize#{i}"].shiny = false
@sprites["prize#{i}"].ox=32
@sprites["prize#{i}"].oy=32
end
@sprites["prize#{i}"].angle = @angle[i]
@sprites["prize#{i}"].x=(Graphics.width/2) + Math.cos(@xyangle[i].degrees)*@radius
@sprites["prize#{i}"].y=(Graphics.height/2) + Math.sin(@xyangle[i].degrees)*@radius
end
main
end
def main
loop do
Graphics.update
Input.update
pbUpdate
if Input.trigger?(Input::C)
confirmtext="Spin the wheel?"
confirmtext="Spin the wheel for $#{@cost}?" if @cost > 0
confirmtext="Spin the wheel for #{@cost} coins?" if @costcoins == true
if pbConfirmMessage("#{confirmtext}")
if @costcoins == true && $player.coins<=@cost
pbMessage(_INTL("You don't have enough coins..."))
break
elsif @costcoins == false && $player.money<=@cost
pbMessage(_INTL("You don't have enough money..."))
break
end
$player.coins-=@cost if @costcoins == true
$player.money-=@cost if @costcoins == false
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)*@radius
@sprites["prize#{i}"].y= (Graphics.height/2) + Math.sin((@xyangle[i]+@prizespin).degrees)*@radius
end
spun+=5
Graphics.update
if click==true
pbSEPlay(@spinsfx[0],@spinsfx[1],@spinsfx[2])
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(@winsfx[0],@winsfx[1],@winsfx[2])
if prize.is_a?(Integer)
if @prizecoins == true
pbMessage("You won #{prize} coins!")
$player.coins+=prize
else
pbMessage("You won $#{prize}!")
$player.money+=prize
end
elsif prize.is_a?(Array)
prize.delete_at(0)
prize = prize.sample
end
pbUpdate
pbReceiveItem(prize) if GameData::Item.try_get(prize)
pbAddPokemon(prize,@level) if GameData::Species.try_get(prize)
@spun = true if @respin == false
break
end
end
end
end
if Input.trigger?(Input::B) || @spun == true
break
end
end
pbFadeOutAndHide(@sprites) {pbUpdate}
dispose
end
def dispose
pbDisposeSpriteHash(@sprites)
@viewport.dispose
end
end
Ruby:
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 GameData::Item.try_get(@prizes[i])
@sprites["prize#{i}"]=ItemIconSprite.new(0,0,0,@viewport)
@sprites["prize#{i}"].item = @prizes[i]
@sprites["prize#{i}"].ox=24
@sprites["prize#{i}"].oy=24
elsif GameData::Species.try_get(@prizes[i])
@sprites["prize#{i}"]=PokemonSpeciesIconSprite.new(@prizes[i],@viewport)
@sprites["prize#{i}"].shiny = false
@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 GameData::Item.try_get(prize)
pbUpdate
pbReceiveItem(prize)
elsif GameData::Species.try_get(prize)
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
If you're using this in a version before v19, there's a couple last steps you need to do.
Find this section:
Replace it with:
Near the bottom, find this section:
Replace it with:
Ruby:
if GameData::Item.try_get(@prizes[i])
@sprites["prize#{i}"]=ItemIconSprite.new(0,0,0,@viewport)
@sprites["prize#{i}"].item = @prizes[i]
elsif GameData::Species.try_get(@prizes[i])
@sprites["prize#{i}"]=PokemonSpeciesIconSprite.new(@prizes[i],@viewport)
@sprites["prize#{i}"].ox=32
@sprites["prize#{i}"].oy=32
Replace it with:
Ruby:
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
Near the bottom, find this section:
Ruby:
if GameData::Item.try_get(prize)
pbUpdate
pbReceiveItem(prize)
elsif GameData::Species.try_get(prize)
pbUpdate
pbAddPokemon(prize,20)
Ruby:
if getID(PBItems,prize)>0
pbUpdate
pbReceiveItem(prize)
elsif
getID(PBSpecies,prize)>0
pbUpdate
pbAddPokemon(prize,20)
Graphics
- Put "money.png" and "prizewheel.png" in Graphics/Pictures
- prizewheel2.png is an edit of the original wheel (also made by AiurJordan) to display some coin values on it! The prize array for the coins is
[100,2500,100,7500,100,10000,100,5000,100,15000]
(v20, earlier versions have it included as the fourth array in the script)
- prizewheel2.png is an edit of the original wheel (also made by AiurJordan) to display some coin values on it! The prize array for the coins is
- If you're using the vanilla Game Corner tileset, put Game Corner interior.png in Graphics/Tilesets, overwriting the file already there. Otherwise, use an image editing program to put the wheeltile image into whatever tileset you're using.
- Alternatively, you could make this into a charactersheet, and use it as the event graphic.
- Old wheel is just there if anyone has any reason to need it. (The colors are just slightly different) I really recommend you use AiurJordan's, though!
- "wheeltile2" is Bluesxc's tile, an adaptation of AiurJordan's to suit Gen 4's style!
Using the script
Data
If you're familiar with ThatWelshOne_'s Modern Quest System, you'll be setting up the data for your wheels in the same way!In 001_WheelData.rb (top of the script if you added it directly), you'll see a section like this:
Ruby:
module WheelData
DEFAULT_BACKGROUND = "hatchbg"
DEFAULT_WHEEL = "prizewheel"
DEFAULT_RADIUS = 110
DEFAULT_MINSPINS = 3
DEFAULT_RESPIN = true
DEFAULT_COST = 0
DEFAULT_COSTCOINS = false
DEFAULT_PRIZECOINS = false
DEFAULT_SPINSFX = ["battle ball shake",80,150]
DEFUALT_WINSFX = ["mining reveal full",100,100]
DEFAULT_LEVEL = 20
Wheel = {
:background => "hatchbg",
:wheel => "prizewheel",
:radius => 110,
:minspins => 3,
:respin => false,
:cost => 10,
:costcoins => false,
:prizecoins => false,
:spinsfx => ["battle ball shake",80,150],
:winsfx => ["mining reveal full",100,100],
:level => 20,
:prizes => [:GREATBALL,
:NETBALL,
:FRIENDBALL,
:NESTBALL,
:ULTRABALL,
:LEVELBALL,
:FASTBALL,
:POKEBALL,
:HEALBALL,
:MASTERBALL]
background
- the name of a file in Graphics/Pictures to be displayed as the background. Must be a string. (Put in quotes)- Ideally, whatever image you use as the background should be the same size of the screen itself. If you want to do something smaller, remember that the top-left corner of the image will be displayed in the top-left corner of the screen. (You may need to just do the same size canvas and erase the edged)
wheel
- the name of a file in Graphics/Pictures to be displayed as the wheel. Must be a string. (Put in quotes)- Currently, this script does not support different prize pool sizes, so your wheel will have to have ten slots on it.
radius
- the distance from the center of the wheel graphic to the center of the prize graphics. Must be an integer. (Can actually be negative, it'll make the icons face outward instead, and display the prizes on the opposite side of the wheel. Still functions fine.)spinsfx
- An array of a string and two integers between 50 and 150. This is the sound effect that plays as the wheel spins - the name of the file, the volume, and the pitch. (You can play around with the Play SFX command in the event editor and use that to determine the values)winsfx
- Same thing - an array of a string and two integers between 50 and 150. This is the sound effect that plays when the wheel lands on a prize.minspins
- the number of times the wheel will spin before landing a prize. Must be a positive integer. (You can do 0, but it won't complete a full spin, so it doesn't look good.)respin
- Either true or false. If true, the player can spin again immediately after landing on a space. If false, the game will exit the wheel immediately after it's been spun. (Useful for if you want a one-time wheel, or a wheel where the player has to wait a period of time before using it again)cost
- The price to use the wheel. Must be an integer. (Technically that does include negative numbers, so I guess you could pay players to spin the wheel, but it hasn't really be configured for that.)costcoins
- Either true or false. If this is true, the cost will be using coins rather than money.prizecoins
- Either true or false. If this is true, the prizes will be using coins rather than money.level
- the level of Pokémon given out by the wheel. Must be an integer between 1 and the max level of Pokémon in your game.
Prizes
prize
is an array of ten values. Prizes begin at that Great Ball, and go clockwise from there.Prizes can be:
- An integer. (
1
) This will display either the PokéDollar sign or the Coin Case sprite, depending on the prizecoins value, and will pay out that amount in the given currency. - A symbol. (
:POTION
) Can be the internal name of an item or a Pokémon species. This will display either the bag sprite of an item or the menu sprite of a Pokémon, and will award the item/Pokémon displayed. - An array.
- The first value in the array is used to determine what sprite is displayed. Like regular prizes, it can be an integer or a symbol of an item or Pokémon species - however, it can also be a string for a specific graphic. It starts in the Graphics folder, so you'd do "Pictures/image" for an image in the Pictures folder, for example.
- This first value is NOT included in the prizepool itself. This is to allow for displays that don't actually connect to any specific item - for example, you might have a graphic that displays multiple potions.
- Each value after this is the actual prizepool of the slot. Unlike the wheel, this prizepool can be whatever size you'd like. This array will be sampled, so if you want to include different odds, you can just add duplicate values. For example, the array
["Pictures/RandomPotion",:POTION,:POTION,:POTION,:SUPERPOTION]
has a 75% chance of giving a Potion and a 25% chance of giving a Super Potion. (and will display the image "RandomPotion" from Graphics/Pictures on the wheel)
- The first value in the array is used to determine what sprite is displayed. Like regular prizes, it can be an integer or a symbol of an item or Pokémon species - however, it can also be a string for a specific graphic. It starts in the Graphics folder, so you'd do "Pictures/image" for an image in the Pictures folder, for example.
Event
pbWheel(:Wheel)
, with :Wheel
being the name of the module you set up earlier! (Remember to keep the : in front!)There's a few things to do before putting your wheels in place!
We've got two arrays-of-arrays defined at the top of our script: Prizes and Wheel Styles.
The arrays in Prizes are your prize pool! Items and Pokemon should be put in as :NAME, while money amounts should just be "X" (quotes included). It has to be exactly ten prizes- any less and it'll crash, any above ten won't display.
You probably won't use the WheelStyles array as much, but it's there to allow to easily save multiple graphic/audio changes!
Now that that's all set up, all you have to is call it in an event, with
We've got two arrays-of-arrays defined at the top of our script: Prizes and Wheel Styles.
Ruby:
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,],
]
The arrays in Prizes are your prize pool! Items and Pokemon should be put in as :NAME, while money amounts should just be "X" (quotes included). It has to be exactly ten prizes- any less and it'll crash, any above ten won't display.
You probably won't use the WheelStyles array as much, but it's there to allow to easily save multiple graphic/audio changes!
Ruby:
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]
]
- bg graphic- filename of the background image in Graphics/Images, in quotes
- wheel graphic- filename of the background image in Graphics/Images, in quotes
- radius- the radius of the icons on the wheel. (Not necessarily the radius of the wheel itself, unless you want the icons to be on the edges)
- Minimum spins- the minimum number of times the wheel will make a full loop before landing. (It can make up to one final loop after that)
- Spin SFX, volume, pitch- The file in Audio/SFX that plays repeatedly as the wheel spins, to create the feel of the wheel clacking. Volume is 0 to 100, pitch is 0 to 150, just like if you called it via event.
- Winning SFX- same thing, except it's what plays when the wheel lands on a prize.
Now that that's all set up, all you have to is call it in an event, with
Wheel(prizepool,cost,style=#)
- prizepool- The array in Prizes that are on the wheel (remember that it starts at 0!)
- cost- The cost to spin the wheel. (Set to 0 for a free wheel)
- style=# - The settings set up in WheelStyles (with # being the array it pulls from), if you want something different from the default.
- If you want to make the player spend coins instead of money, add costcoins=true into the command. (It'd look like
Wheel(prizepoolcost,style=#,costcoins=true)
- If you want to make the player win coins instead of money, do the same thing, but with prizecoins=true. (I believe you still need to define costcoins in this, so be sure to do that as well, even if you want it to cost money-
Wheel(prizepoolcost,style=#,costcoins=false,prizecoins=true)
)
Future Goals
- Display the name of the prize on its slot. (Right now, the size of the text and getting rotation to work has been causing issues for me)
- Allow for more customization of prizes- Shiny Pokémon, Pokémon with special moves, unique effects for your Pokémon, different levels, multiple items at once, etc.
- Allow money and coins on the same wheel
- Allow for customization of how many prizes are in a wheel
- Allow devs to set specific probabilities for different slots
- Maybe make a pretty animation for the prize
- I might consider making alternate win SFX for each prize - that way you could introduce a losing slot, a grand prize slot, etc.
- Need to figure out how to keep animated sprites running as the win message plays
- Credits
- Marin, for his scripting utilities
- Krom Stern from stackexchange for the circular movement
- Flylib.com for the conversion from radians into degrees
- AiurJordan for the tile and high-quality prize wheel, as well as the code relating to coin usage
- Bluesxc for the Gen 4-style tile (prizewheel2.png)
- ThatWelshOne_ for the new method of organizing these as modules rather than clunky arrays
- Ganz/Webkinz for the Wheel of Wow graphic this wheel was based on
- And me, TechSkylander1518!