Game Development Your number one stop for anything related to creating games (except ROM hacks). You can even make your own!

TrollandToad.com
Closed Thread
 
Thread Tools
  #1576    
Old April 1st, 2010 (3:10 PM).
Cilerba Cilerba is offline
the hearts of lonely people
  • Silver Tier
 
Join Date: Feb 2010
Location: Massachusetts
Age: 21
Gender: Male
Nature: Quiet
Posts: 1,171
Quote:
Originally Posted by thepsynergist View Post
That achievement system could be real handy in my game. I hope you post the script here.
Are you looking for an achievement system? Because I have one.
__________________

Relevant Advertising!

  #1577    
Old April 1st, 2010 (5:44 PM).
IDKGUY's Avatar
IDKGUY IDKGUY is offline
     
    Join Date: Jul 2009
    Gender: Male
    Nature: Naughty
    Posts: 20
    Quote:
    Originally Posted by Cilerba View Post
    Are you looking for an achievement system? Because I have one.
    We are looking for that script compatible with Poccil's Starter kit , and I also provided one that could only be used on normal RPG games, but couldnt be used on Poccil's kit. BTW I found out how to use the light effects:D
    Spoiler:

    #===============================================================================
    # Achievements Script
    #===============================================================================
    # Created By: Game_guy
    # Date: April 19th, 2009
    #===============================================================================
    =begin
    This is an achievements script. This is pretty much a system like off the
    Xbox360. This is really easy to use its pretty much a simple plug and play!
    You don't need to set anything up in the script at all!

    Q: If I dont need to setup achievemnts in the script, where do I set them up?
    A: Simple! Its all in teh database. With this script the achievements are
    items. You make an Item in the database with an Achievement Name and
    Description.

    Q: That sounds easy! But how do I turn on/give achievemnts?
    A: Easy! use this in a script call and enter this in
    $achieve.gain_item(item_id)

    Q: So how do I view achievements?
    A: $scene = Scene_Achievements.new

    Q: How do we setup the achievements score?
    A: Set the price in the item. That is the score.
    =end
    module GameGuy
    Print = true # Message box comes up and says the achievement you unlocked
    ScoreName = "GamerScore: " # The word you want the score to be called.
    ScoreVariable = 1 # The variable that the score stays in.
    ItemStorageUsed = false # set it true if you use my item storage script
    end
    class Window_Score < Window_Base

    def initialize
    super(0, 0, 320, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
    end

    def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120, 32, GameGuy:coreName.to_s)
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 32, 120, 32, $game_variables[GameGuy:coreVariable].to_s)
    end
    end

    class Achievements
    def initialize
    @items = {}
    @weapons = {}
    @armors = {}
    end

    def item_number(item_id)
    return @items.include?(item_id) ? @items[item_id] : 0
    end

    def weapon_number(weapon_id)
    return @weapons.include?(weapon_id) ? @weapons[weapon_id] : 0
    end

    def armor_number(armor_id)
    return @armors.include?(armor_id) ? @armors[armor_id] : 0
    end

    def gain_item(item_id)
    if item_id > 0
    @items[item_id] = [[item_number(item_id) + 1, 0].max, 99].min
    print $data_items[item_id].name + " Unlocked" if GameGuy:rint == true
    $game_variables[GameGuy:coreVariable] += $data_items[item_id].price
    end
    end

    def gain_weapon(weapon_id)
    if weapon_id > 0
    @weapons[weapon_id] = [[weapon_number(weapon_id) + 1, 0].max, 99].min
    end
    end

    def gain_armor(armor_id)
    if armor_id > 0
    @armors[armor_id] = [[armor_number(armor_id) + 1, 0].max, 99].min
    end
    end

    def lose_item(item_id, n)
    gain_item(item_id, -n)
    end

    def lose_weapon(weapon_id, n)
    gain_weapon(weapon_id, -n)
    end

    def lose_armor(armor_id, n)
    gain_armor(armor_id, -n)
    end

    def item_can_use?(item_id)
    # If item quantity is 0
    if item_number(item_id) == 0
    # Unusable
    return false
    end
    # Get usable time
    occasion = $data_items[item_id].occasion
    # If in battle
    if $game_temp.in_battle
    # If useable time is 0 (normal) or 1 (only battle) it's usable
    return (occasion == 0 or occasion == 1)
    end
    # If useable time is 0 (normal) or 2 (only menu) it's usable
    return (occasion == 0 or occasion == 2)
    end
    end

    class Scene_Title
    alias re_new_game command_new_game
    def command_new_game
    $achieve = Achievements.new
    re_new_game
    end
    end


    class Window_Achievements < Window_Selectable

    def initialize
    super(0, 64, 320, 416)
    @column_max = 1
    refresh
    self.index = 0
    # If in battle, move window to center of screen
    # and make it semi-transparent
    if $game_temp.in_battle
    self.y = 64
    self.height = 256
    self.back_opacity = 160
    end
    end

    def item
    return @data[self.index]
    end

    def refresh
    if self.contents != nil
    self.contents.dispose
    self.contents = nil
    end
    @data = []
    # Add item
    for i in 1...$data_items.size
    if $achieve.item_number(i) > 0
    @data.push($data_items[i])
    end
    end
    # Also add weapons and items if outside of battle
    unless $game_temp.in_battle
    for i in 1...$data_weapons.size
    if $achieve.weapon_number(i) > 0
    @data.push($data_weapons[i])
    end
    end
    for i in 1...$data_armors.size
    if $achieve.armor_number(i) > 0
    @data.push($data_armors[i])
    end
    end
    end
    # If item count is not 0, make a bit map and draw all items
    @item_max = @data.size
    if @item_max > 0
    self.contents = Bitmap.new(width - 32, row_max * 32)
    for i in [email protected]_max
    draw_item(i)
    end
    end
    end

    def draw_item(index)
    item = @data[index]
    case item
    when RPG::Item
    number = $achieve.item_number(item.id)
    when RPG::Weapon
    number = $achieve.weapon_number(item.id)
    when RPG::Armor
    number = $achieve.armor_number(item.id)
    end
    if item.is_a?(RPG::Item)
    self.contents.font.color = normal_color
    end
    x = 4 + index % @column_max * (288 + 32)
    y = index / @column_max * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    end

    def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
    end
    end
    class Scene_Achievements
    def main
    @help_window = Window_Help.new
    @achieve_window = Window_Achievements.new
    @achieve_window.help_window = @help_window
    @score_window = Window_Score.new
    @score_window.x = 320
    @score_window.y = 384
    Graphics.transition
    loop do
    Graphics.update
    Input.update
    update
    if $scene != self
    break
    end
    end
    Graphics.freeze
    @help_window.dispose
    @achieve_window.dispose
    @score_window.dispose
    end
    def update
    @help_window.update
    @achieve_window.update
    if Input.trigger?(Input::B)
    $game_system.se_play($data_system.cancel_se)
    $scene = Scene_Menu.new(0)
    return
    end
    end
    end

    class Scene_Save < Scene_File
    def write_save_data(file)
    # Make character data for drawing save file
    characters = []
    for i in 0...$game_party.actors.size
    actor = $game_party.actors[i]
    characters.push([actor.character_name, actor.character_hue])
    end
    # Write character data for drawing save file
    Marshal.dump(characters, file)
    # Wrire frame count for measuring play time
    Marshal.dump(Graphics.frame_count, file)
    # Increase save count by 1
    $game_system.save_count += 1
    # Save magic number
    # (A random value will be written each time saving with editor)
    $game_system.magic_number = $data_system.magic_number
    # Write each type of game object
    Marshal.dump($game_system, file)
    Marshal.dump($game_switches, file)
    Marshal.dump($game_variables, file)
    Marshal.dump($game_self_switches, file)
    Marshal.dump($game_screen, file)
    Marshal.dump($game_actors, file)
    Marshal.dump($game_party, file)
    Marshal.dump($game_troop, file)
    Marshal.dump($game_map, file)
    Marshal.dump($game_player, file)
    Marshal.dump($achievements, file)
    Marshal.dump($game_chest, file) if GameGuy::ItemStorageUsed
    end
    end
    class Scene_Load < Scene_File
    def read_save_data(file)
    # Read character data for drawing save file
    characters = Marshal.load(file)
    # Read frame count for measuring play time
    Graphics.frame_count = Marshal.load(file)
    # Read each type of game object
    $game_system = Marshal.load(file)
    $game_switches = Marshal.load(file)
    $game_variables = Marshal.load(file)
    $game_self_switches = Marshal.load(file)
    $game_screen = Marshal.load(file)
    $game_actors = Marshal.load(file)
    $game_party = Marshal.load(file)
    $game_troop = Marshal.load(file)
    $game_map = Marshal.load(file)
    $game_player = Marshal.load(file)
    $achievements = Marshal.load(file)
    $game_chest = Marshal.load(file) if GameGuy::ItemStorageUsed
    # If magic number is different from when saving
    # (if editing was added with editor)
    if $game_system.magic_number != $data_system.magic_number
    # Load map
    $game_map.setup($game_map.map_id)
    $game_player.center($game_player.x, $game_player.y)
    end
    # Refresh party members
    $game_party.refresh
    end
    end


      #1578    
    Old April 1st, 2010 (7:31 PM).
    Maruno's Avatar
    Maruno Maruno is offline
    Lead Dev of Pokémon Essentials
       
      Join Date: Jan 2008
      Location: England
      Posts: 5,185
      Quote:
      Originally Posted by IDKGUY View Post
      We are looking for that script compatible with Poccil's Starter kit , and I also provided one that could only be used on normal RPG games, but couldnt be used on Poccil's kit. BTW I found out how to use the light effects:D
      It depends entirely on what you want your achievement system to do. You can either go down the route your script suggests (giving bonus items, presumably after a difficult side quest), go for the typical system used by the consoles (i.e. get an achievement notification but nothing else out of it, e.g. catch 10 Pokémon, beat Elite Four, capture legendary X, etc.), or do something else entirely.

      The first option (bonus items) is easy. Create an array (say, $Trainer.achievements) of length X, and set all entries to false at the beginning of the game. This array corresponds to a list of bonus items (e.g. Master Ball, Amulet Coin, etc.). When you gain a particular item, set that item's entry to true. You can then create a new screen somewhere (PokéGear?) that displays a list of all possible bonus items, using that array as a reference for what has already been done.

      For the console-like achievements system, do the same thing. The difference is you'll need to put lots of checks in lots of places to decide whether you've done something, rather than just have the Master Ball-giving event also change the array element. For example, make a check at the end of each battle that will set the "100 Pokémon seen"/"Caught Mewtwo" achievement to true if you have done. Put a line of code in the Rock Smash script to add 1 to a game variable, and then set the "50 smashed rocks" achievement to true if so. That kind of thing.

      As I said, it depends entirely on what you want your achievements to be. As I've pointed out, though, there's no real need to have a huge section of code for this, when a single array would do just as well (plus a few lines dotted around elsewhere in the scripts, if you want).

      You could even make a thread asking for suggestions for achievements. That'd be fun.
      __________________
      Go to the Pokémon Essentials Wiki

      | Downloads | Tutorials | Fangames |
      | All Animations Project |

      Follow me on Twitter: @maruno42


        #1579    
      Old April 1st, 2010 (8:00 PM).
      IDKGUY's Avatar
      IDKGUY IDKGUY is offline
         
        Join Date: Jul 2009
        Gender: Male
        Nature: Naughty
        Posts: 20
        Maruno, to be sincere, i have no idea of how to do that :\. I want it to be just like the console like system, as you said, but I have no idea of how to do it. I just thought it would be a good idea to have achievements in our games, but now it seems a little bit complicated.
          #1580    
        Old April 1st, 2010 (10:05 PM).
        thepsynergist's Avatar
        thepsynergist thepsynergist is online now
        A Gym Leader, Kyushu Region
           
          Join Date: Mar 2009
          Location: California, USA
          Age: 27
          Gender: Male
          Nature: Adamant
          Posts: 756
          I don't see how you can't just try to convert the one you have into the Pokemon Essentials SDK.
          __________________




          Pokemon Pyrite is now complete, check out the trailer/download link here: https://www.youtube.com/watch?v=X6g5pXPXyV4
            #1581    
          Old April 2nd, 2010 (4:30 AM).
          Cilerba Cilerba is offline
          the hearts of lonely people
          • Silver Tier
           
          Join Date: Feb 2010
          Location: Massachusetts
          Age: 21
          Gender: Male
          Nature: Quiet
          Posts: 1,171
          What's wrong with that script, (it's the same one I have by the way), is the "class Window_Score < Window_Base" For some reason, that causes errors when trying to be used in Essentials.
          __________________
            #1582    
          Old April 2nd, 2010 (4:41 AM).
          venom12's Avatar
          venom12 venom12 is offline
          Pokemon Crystal Rain Relased
             
            Join Date: Sep 2006
            Age: 26
            Gender: Male
            Nature: Adamant
            Posts: 529
            Change Window_Base to SpriteWindow_Base.
            Closed Thread

            Quick Reply

            Join the conversation!

            Create an account to post a reply in this thread, participate in other discussions, and more!

            Create a PokéCommunity Account

            Sponsored Links
            Thread Tools

            Posting Rules
            You may not post new threads
            You may not post replies
            You may not post attachments
            You may not edit your posts

            BB code is On
            Smilies are On
            [IMG] code is On
            HTML code is Off

            Forum Jump


            All times are GMT -8. The time now is 8:35 PM.