[XP] Achievements Script

Started by G_G, April 20, 2009, 01:18:40 am

Previous topic - Next topic

G_G

Its not needed. The points is kept in a variable. So what you do is this.

Store gold in Gold Variable 0001.
Remove Gold: 99999999
Add Gold: Variable 0002: Award Points
Open Shop
Store gold in Awards Points Variable 0002
Remove Gold: 9999999
Add Gold: Variable 0001: Gold


Damn I'm good. <3

bigace

Okay cool straight :^_^': Thank you for the snippet.


Use Dropbox to upload your files. Much simpler than other upload sites, you can simply place a folder on your desktop that will sync with your DropBox account.

theneonheart

Hey, I just put this in my game, and before I input any awards or anything, when I playtest the game I get this error:

Script 'Achievements' line 253: NoMethodError occurred.
undefined method 'queue' for nil:NilClass

Do I have to input something before it will even work? Because I was planning on taking a good long time to figure out how to script properly while I keep adding stuff to my game...

line 253 is:
    if $game_system.queue.size > 0 && @frame < 1

I really like how this script looks in the demo and would love to use it in my game if you can help. Thanks.
My Games: ExXception Draft - A Cyberpunk Detective Story with a Twist of the Paranormal

G_G

March 05, 2012, 06:47:24 pm #103 Last Edit: March 05, 2012, 06:48:27 pm by game_guy
The only reason I can think of you getting that error is either
A) You loaded an old game save.
B) You copied the script from the demo. Which is bugged.

Helskyth

Hello. I've been using the Achievements script and am loving what it has to offer.

However, I've encountered one little problem that I just can't wrap my head around, and the strange thing is, it only occurs after I undertake one of the events I've set up to progress the game; which doesn't even have anything in it that relates to the Achievement Script.  :^_^':

Anyway, here's the pesky little error.
-----
NameError occurred while running script.

uninitialised constant Interpreter::Award
-----

Please and thank you for helping the newb peasant?  :P

(and unrelated, but also thanks for your Quest Log script, it's worked wonders!)
It's not me that's addicted to coffee. It's the coffee that's addicted to me!




My Deviant Art
My Youtube

G_G

The error is coming from one of your events. I can tell because of the "NameError occurred while running a script." So somewhere in your events, in a script call, you have "Award::" instead of "Awards::"

Helskyth

March 15, 2012, 08:52:14 pm #106 Last Edit: March 15, 2012, 09:07:49 pm by Helskyth
That's what I was hoping it'd be when it originally popped up. Only problem is, it occurs even after I remove those events that did have a script call, and I can assure you that all of those ones were composed correctly to begin with. I wouldn't have reported the problem if it were so easy. ;)
What's puzzling me the most, is it occurs during an event that doesn't actually have a script call in it at all. It's just a  "talk to this NPC, they say some things, give you a couple of items" and then some switches turn on so you can move on to the next area.
For the moment, I'm re-making the event from scratch, changing its graphics, removing parts of it, etc, to see if I I can deduce why it's causing it. But so far, it's only this event that's causing it, so if I can't prevent the error from occurring then I'll just need to figure something else out.


-edit-
( :facepalm:^200 )
It's time for a holiday. A script call involving the awards made its way into a common event some-where else. Not sure how I heck I managed to put that in there, but I found it.  :facepalm:
It's not me that's addicted to coffee. It's the coffee that's addicted to me!




My Deviant Art
My Youtube

Moranon

Hey.

I'd like to use this awesome script but i seem to have a little problem here.

The Achievement Icons won't be shown completely at some point. In the last row they are gone completely although they're still selectable.
Maybe someone can help me with this.

That's what it looks like right now
http://www.freeimagehosting.net/6z1gv

Thanks in Advance
Wizard Gandalf Style!

G_G

I'll look at it after school. I believe this has something to do with allowing custom icon size. Can't say for sure. I can't even remember if I allowed custom icon size.

Moranon

This is the only part i slightly changed
Spoiler: ShowHide
#===============================================================================
# Window_QuickAwards
#===============================================================================
class Window_QuickAwards < Window_Selectable
 def initialize
   super(64, 128 + 64, 512, 320 - 64)
   @column_max = Awards::Icon_QColumn
   self.z = 10000
   refresh
   self.index = 0
 end
 def item
   return @data[self.index]
 end
 def refresh
   if self.contents != nil
     self.contents.dispose
     self.contents = nil
   end
   @data = []
   $game_system.awards.each {|i|
     @data.push([Awards::Award[i], i])}
   if Awards::Show_All
     @data = []
     @locked = []
     @unlocked = []
     Awards::Award.each_index {|i|
       if Awards::Award[i] != nil
         if $game_system.awards.include?(i)
           @unlocked.push([Awards::Award[i], i])
         else
           @locked.push([Awards::Award[i], i])
         end
       end}
     @unlocked.each {|i| @data.push(i)}
     @locked.each {|i| @data.push(i)}
   end
   @item_max = @data.size
   if @item_max > 0
     self.contents = Bitmap.new(width - 32, row_max * Awards::Icon_Size[1])
     for i in 0...@item_max
       draw_item(i)
     end
   end
 end
 def draw_item(index)
   item = @data[index]
   width = Awards::Icon_Size[0] < 32 ? 32 : Awards::Icon_Size[0]
   height = Awards::Icon_Size[1] < 32 ? 32 : Awards::Icon_Size[1]
   x = 4 + index % @column_max * (width + 32)
   y = index / @column_max * (height + 4)
   rect = Rect.new(x, y, self.width / @column_max - 4, height)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   if $game_system.awards.include?(item[1])
     bitmap = RPG::Cache.icon(item[0][2])
   else
     bitmap = RPG::Cache.icon(Awards::Locked_Icon)
   end
   self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, Awards::Icon_Size[0],
       Awards::Icon_Size[1]))
 end
 def update_help
   @help_window.set_award(self.item)
 end
 def update_cursor_rect
   if @index < 0
     self.cursor_rect.empty
     return
   end
   row = @index / @column_max
   if row < self.top_row
     self.top_row = row
   end
   if row > self.top_row + (self.page_row_max - 1)
     self.top_row = row - (self.page_row_max - 1)
   end
   cursor_width = Awards::Icon_Size[0] < 32 ? 32 : Awards::Icon_Size[0]
   cursor_height = Awards::Icon_Size[1] < 28 ? 28 : Awards::Icon_Size[1]
   x = @index % @column_max * (cursor_width + 32)
   y = @index / @column_max * (Awards::Icon_Size[1] + 12) - self.oy
   self.cursor_rect.set(x, y, cursor_width, cursor_height + 4)
 end
end

i only changed some of the sizes and coordinates because the cursor wasn't directly behind the achievement icons.
maybe i f*cked something up here. i cant really tell.

maybe it helps you to find the error
Wizard Gandalf Style!

KK20

I believe this line is the problem:
self.contents = Bitmap.new(width - 32, row_max * Awards::Icon_Size[1])
I noticed that in your picture, the sprites on the 3rd line are slightly cut off, so instantly I knew it had to be a bitmap size problem. You want to change that Awards::Icon_Size to something else. Originally it was height, so I don't know what you were trying to accomplish in changing that.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Moranon

i cant remember changing that. but when i change width to height it looks like this
http://www.freeimagehosting.net/dhe3h
Wizard Gandalf Style!

KK20

"Changed width to height"? Why in the world would you want to do that? Unless you worded that wrong and you did this:
self.contents = Bitmap.new(width - 32, row_max * height)

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Moranon

September 22, 2012, 02:47:21 pm #113 Last Edit: September 22, 2012, 02:48:48 pm by Moranon
i changed this
self.contents = Bitmap.new(width - 32, row_max * Awards::Icon_Size[1])


to
self.contents = Bitmap.new(height - 32, row_max * Awards::Icon_Size[1])


i'm kind of an idiot that way. unless someone tells me exactly what to change i'm screwed xD

edit:
with your
self.contents = Bitmap.new(width - 32, row_max * height)

it works just fine. thank you very much ^^
Wizard Gandalf Style!

exile360

January 10, 2013, 10:28:26 am #114 Last Edit: January 10, 2013, 11:38:24 am by exile360
Hi!

First of all, sorry if this is considered a necro-post or something, since it's been a while from the last reply. I'm not even sure I'll get a reply here but doesn't hurt to try, I guess. :)
Thank you for this awesome script! I've just recently returned to RMXP after a few years, and found RMX-OS which is slowly making all I ever wanted come true, haha. So many awesome additional scripts here as well, like this one. Sorry for my noobishness though, don't have the hang of everything yet as I've just returned.

Basically, I just have a few questions and suggestions/requests.
1) I have a problem with placing the achievement pop-up on my screen. I wanted to place it on the upper middle side of the screen and worked out some math. Everything should be in place, but the picture is the only thing that appears. No text or icon. Both worked fine in the default placing. I added a screenshot in the spoiler. How do I fix this?
Spoiler: ShowHide

2) How to create and trigger achievements that require a certain amount of gold or damage dealt, like in your examples? I'm probably stupid and missing something, but meh lol. I'd play the demo (outdated or not) and find out myself, but it's down.

And the suggestions/requests:
1) Would it be possible to make the achievement gain picture fade in and out smoothly instead of appearing and disappearing instantly? It looks a bit unprofessional.
2) Would it be possible to create tabs to sort the achievements, such as Story related, Combat related, Secrets and whatnot. The little window to select tabs could be either between the 2 main windows, or on the left side. I made a screenshot and marked the areas to show what I mean, below in the spoiler. You could then just specify which tab they go to with another number in the configuration part of the script.
Spoiler: ShowHide


I know at this point it's very unlikely you'll even want to work on the script again, specially for one request, but I would be very thankful as it'd be perfect for my game. ^_^

Cheers! :)

G_G

Hey, glad you like the script! For your first question, it's probably a glitch on my part. I'll look into it within the next couple of days. As for your 2nd question, I have a script add-on I posted beneath the actual script that deals with Damage Dealt Achievements. And for the gold, just have a common event run in the background checking for gold.

As for your requests, it's possible to do this, but it'd require editing the script and I've retired from RMXP for the most part. I don't really have the time or will to add those suggestions in, but they are great suggestions. You might be lucky if you posted in the Script Requests asking for those features.

exile360

I see, thank you very much for the reply. :) I completely forgot you can check for gold with a conditional branch. I kept looking for a way to store it in a variable or something, and then check for that.
I'll be looking forward to your post about the Achievement placing issue. I'm really sorry to bother you with this by the way, as you've retired. :( I know I'm kinda late to the party here, lol.
I will try the request forum for the suggestions. :)

ThallionDarkshine

Alright, ill work on this. Can you post your configuration b/c i don't see any problems in the script itself. And for the first request, ill do that very soon: i actually already have written most of the code for that in another script. There will be several different entry and exit methods for the sprite.

exile360

January 11, 2013, 07:48:31 pm #118 Last Edit: January 11, 2013, 07:49:56 pm by exile360
Hey. After reading your post I was going to post my configuration, but then I had an idea and tested it out. It appears that it was my mistake after all, I apologize. :facepalm:
I had assumed that the icon and text coordinates also correspond to the screen, but they actually count from the placement of the award picture. All I had to do was reduce the coordinates and align them with the image again, and voila, all fixed and working fine now, thanks! Looking forward to the suggestion edit though. :)

ThallionDarkshine

Alright, i was guessing that that was what you had done. I finished the first part of the my edit, right now you can set up an array of possible animations for the notification appearing. I also found a number of bugs that would only appear if show_all is false. All i have to do now is add in disappear animations and properly document the config. Ill try to finish it tomorrow.