[RESOLVED][XP] A few script problems - seeking for help.

Started by exile360, January 16, 2013, 04:52:21 pm

Previous topic - Next topic

exile360

Hey guys. I've recently started a project with RMX-OS, and everything has been going great this far. I was surprised that I was able to use most of the scripts from my old project, without any incompatibilities. However, some have started to pop up now after further testing. I'm not a scripter, but I do use my own head and try to search and test things out before asking, but these issues have left me pulling my hair out... I simply can't seem to be able to find what's causing them, or how to fix it. Thus, I've decided to ask here. There's quite a few so bear with me. If anyone could help me with even one of them, I'd be very grateful.

1) RMX-OS & RTAB - Error upon using an item. Fixed
I was so happy when I saw that RTAB worked with RMX-OS. It's simply my favorite battle system, and I really wanted to keep it for my new project. However, today I discovered that when using an item, an error pops up. I've tried re-arranging my scripts etc but nothing seems to help... I don't even know which script is causing this, whether its RMX-OS itself, or something else. This is the error I'm getting:
Spoiler: ShowHide

Which leaves me at line 1915 in RTAB. The line is: target.item_effect(@item, battler)
I'm not sure how the error system in RMX-OS works, because the lines shown in the error seem to have nothing to do with the problem. I'm not even using those options in TONS. :/ Just in case it's relevant, here are the addons I have enabled in TONS:
Shaded text
Ultimate Font override
Multi-drop
Heal at lvl-up
Enemy Status

2) Shaded Text issue in RTAB. Fixed
Uhh this is pretty low-priority, as it's merely a small cosmetic annoyance, and I could just disable Shaded Text in TONS to make it go away (I like it, though), but if there's a solution, it'd be better. Basically, the text (like HP & SP, or menu selections) becomes shaded and non-shaded randomly during battle within RTAB. Sometimes the shades are on, sometimes they're off. I think this happens whenever something is affected, for example if I use a skill and lose SP, it becomes non-shaded. I'm not sure about this though.

3) CMS + Item Rarity issue. Fixed
I'm using an older Custom Menu System by LegACy and the Item Rarity script by game_guy, but the item colors don't display in the CMS. It actually partially worked at some point, displaying the colors in the equipment window (nowhere else, though) but now it doesn't at all. They completely disappeared after I implemented either TONS or the Multiple Message Windows by Wachunga/ForeverZer0, not sure which is causing it. This probably requires some sort of editing to the CMS. Here's the script, in case it's needed.
Spoiler: ShowHide
It didn't let me post this because it exceeded the max character amount, lol, so I put the script in a txt and uploaded it.
http://www.upload.ee/files/2991540/CMS_by_LegACy.txt.html


4) Lighting System rough edges. Fixed
Since my old Lighting system doesn't work (requires SDK, sadly) I resorted to using the Dynamic Lighting System by kellesdee. It has some sweet options like flicker which I've found useful, so it's pretty nice. However, if the lights have remained on-screen for a while, they get these ugly edges. Sometimes even square shaped... At first I thought it was the light image, so I made my own with very soft edges and made sure nothing is clipping off it. Still the same, though. I guess it's in the script then, but I don't know. The creator of the script doesn't seem to be active on it anymore.
Here's a screenshot to explain what I mean:
Spoiler: ShowHide

And here is the script itself:
Spoiler: ShowHide
#==============================================================================
# ** Dynamic Lights
#------------------------------------------------------------------------------
# by kellessdee
# Version: 1.00
# Date: 23/05/2011
#------------------------------------------------------------------------------
# Version History:
#
#   1.00 - First release
#------------------------------------------------------------------------------
# Description:
#
#   Allows the user to set up dynamic lights on the game map
#------------------------------------------------------------------------------
# Compatibility:
#
#------------------------------------------------------------------------------
# Instructions:
#
#   To create an event as a light source, create an event and set the first
#   command as a comment. The syntax is as follows:
#       render_light filename
#       radius
#       tone_red tone_green tone_blue
#       flicker
#       glow
#       brightness
#------------------------------------------------------------------------------
# Parameters:
#
#   filename      :the light picture file
#   radius        :radius in pixels
#   tone_red      :tone red value to be mixed (0 - 255)
#   tone_green    :tone green value to be mixed (0 - 255)
#   tone_blue     :tone blue value to be mixed (0 - 255)
#   flicker       :type true if you want the lights to flicker
#   glow          :type true if you want the lights to glow
#   brightness    :the brightness of the light source (0 - 255)
#------------------------------------------------------------------------------
# Notes:
#
#   Any questions, comments or issues you may reach me at:
#
#     kellessdee@gmail.com
#     http://www.rmxpunlimited.com/forums (look for kellessdee)
#     http://wakingdreams.weebly.com/
#
#==============================================================================

#==============================================================================
# ** Sprite_Light_Source
#------------------------------------------------------------------------------
#   Displays the light on the screen
#==============================================================================
class Light_Source < Sprite
 #----------------------------------------------------------------------------
 # * Constants
 #----------------------------------------------------------------------------
 DEFAULT = 'light_render'
 #----------------------------------------------------------------------------
 # * Public Instance Variables
 #----------------------------------------------------------------------------
 attr_accessor :event
 #----------------------------------------------------------------------------
 # * Object Initialization
 #----------------------------------------------------------------------------
 def initialize(event, radius, tone, flicker, glow, brightness, filename)
   super()
   self.z = 1000
   self.tone = tone
   self.opacity = brightness
   self.x = (event.real_x - radius * 2 - $game_map.display_x) / 4 + 12
   self.y = (event.real_y - radius * 2 - $game_map.display_y) / 4 + 6
   bmp = filename == nil ? RPG::Cache.picture(DEFAULT) : RPG::Cache.picture(filename)
   self.bitmap = Bitmap.new(radius, radius)
   self.bitmap.stretch_blt(Rect.new(0, 0, radius, radius), bmp, bmp.rect)
   @radius = radius
   @brightness = brightness
   @event = event
   @flicker = flicker
   @glow = glow
   @step = 0.001
   @flicker_count = -1
   @count = 0
 end
 #----------------------------------------------------------------------------
 # * Update Frame
 #----------------------------------------------------------------------------
 def update
   # Update flicker effect
   if @flicker
     self.opacity += rand(5) * @flicker_count
     @flicker_count = -@flicker_count if self.opacity >= @brightness || self.opacity <= 0
   end
   # Update Glow effect
   if @glow
     self.zoom_x += @step
     self.zoom_y += @step
     @count += 1
     if @count == 220
       @step = -@step
       @count = 0
     end
   end
   self.x = (@event.real_x - (@radius * 2).to_f * self.zoom_x - $game_map.display_x) / 4 + 12
   self.y = (@event.real_y - (@radius * 2).to_f * self.zoom_y - $game_map.display_y) / 4 + 6
 end
end
#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
#   Redefine initialization to create light array
#   Redefine update to update light array
#   Redefine dispose to destroy light array
#   Added render light method to set up light array
#==============================================================================
class Spriteset_Map
 #----------------------------------------------------------------------------
 # * Method Aliases
 #----------------------------------------------------------------------------
 unless self.method_defined?(:new_light_render_init)
   alias :new_light_render_init :initialize
 end
 unless self.method_defined?(:new_light_render_updt)
   alias :new_light_render_updt :update
 end
 unless self.method_defined?(:new_light_render_disp)
   alias :new_light_render_disp :dispose
 end
 #----------------------------------------------------------------------------
 # * Object Initialization
 #----------------------------------------------------------------------------
 def initialize
   @light_source = []
   render_light_source
   new_light_render_init
 end
 #----------------------------------------------------------------------------
 # * Update Frame
 #----------------------------------------------------------------------------
 def update
   @light_source.each {|light| light.update } unless @light_source == []
   new_light_render_updt
 end
 #----------------------------------------------------------------------------
 # * Dispose Object
 #----------------------------------------------------------------------------
 def dispose
   new_light_render_disp
   @light_source.each {|light| light.dispose }
   @light_source = []
 end
 #----------------------------------------------------------------------------
 # * Render Light Source
 #----------------------------------------------------------------------------
 def render_light_source
   $game_map.events.values.each {|event|
     next if event.list == nil
     if event.list[0].code == 108 && event.list[0].parameters[0].split[0] == 'render_light'
       # Get file name
       filename = event.list[0].parameters[0].split[1]
       parms = []
       (1..5).each {|i|
         if event.list[i].code == 108
           parms << event.list[i].parameters
         end
       }
       5.times {|i| parms[i] = [0] if parms[i] == [nil] }
       # Get Radius
       rad = parms[0][0].to_i
       t = parms[1][0].split
       ton = Tone.new(-t[0].to_i, -t[1].to_i, -t[2].to_i)
       fli = (parms[2] == ['true'])
       glo = (parms[3] == ['true'])
       bri = parms[4][0].to_i
       @light_source << Light_Source.new(event, rad, ton, fli, glo, bri, filename)
       @light_source << Light_Source.new(event, rad + 50, ton, fli, glo, bri - 25, filename)
       @light_source << Light_Source.new(event, rad + 100, ton, fli, glo, bri - 50, filename)
     end
   }
 end
end


Here is a list of scripts I'm using, and the order of them. I know that the order is different from Blizzard's recommended script order, but I tried that, and it resulted in a ton of errors... I just can't put TONS and certain other scripts above RMX-OS scripts, or it gives me errors. :/ Not sure why.
RMX-OS Options
RMX-OS Script
RTAB
MOG - Battler L Effects
Critical Hit Screen Shake (I believe this was custom written for me by someone in the past, just a short and simple script)
CMS 1.17b by LegACy
Item Quality 1.4 by game_guy
Dynamic Lights by kellesdee
MOG C HUD
MOG - Location Name
TONS 1
TONS 2
TONS 3
Multiple Message Windows by Wachunga & De-SDKed by ForeverZer0
Global Switched & Variables
ATES
Global Day-and-Night System for RMX-OS by Blizzard
Daily Messages
Achievement System by game_guy
Achievement RMX-OS patch
RMX-OS Player Report


I also have a question about RMX-OS itself. I've found a possible exploit, and I'm wondering if its just me doing something wrong, or its an actual issue. Basically, when you have an event on auto-run, for a cutscene for example, and it gives you some items and continues dialogue after, the user can close the game window (red X) and once they log back in, the NPC starts talking again and gives you the items again, but the old ones also remained, resulting in double items. People can exploit this rather easily. Is there any fix to this?

Thanks a lot in advance! Have a nice day everyone.

exile360

Bumpy.

Could anyone at least tell me whether or not it's complicated to fix the first issue? It's kind of game-breaking... Then I'd know if I should have my eye out for a new battle system or whatever is causing it, in the scenario that I won't get a fix for it. :/ Right now my project is just on hold, don't know what to do.

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

exile360

January 20, 2013, 04:14:32 pm #3 Last Edit: January 20, 2013, 04:16:42 pm by exile360
Well, I feel like a massive idiot now. Indeed it worked, thank you, Blizzard.
As I noted in the post, I had previously tried to set my scripts to the order in your topic, but it just left me with a ton of errors. I tried it again now but tried to narrow down what's causing the error in the battle system, and it was TONS. Then I tried different script orders with only TONS, RTAB and RMX-OS stuff and finally found a working one. Haven't run into any issues so far so I hope it's fixed. In case anyone else needs it, here's the order:

TONS
RMX-OS Options
RMX-OS Script
RTAB

The shading issue seems gone as well, haven't noticed it anymore. I also experimented with other systems to fix the item colors issue but no luck. I think I've found an alternative to it though so I'll check that out, and if it doesn't work I'll try to edit my CMS myself.
I won't update the name to resolved yet as I still have the question about the lighting system and RMX-OS unanswered. :)

Blizzard

I am not exactly sure how that script is supposed to work, but it's possible that it's using the wrong blending. Try changing the self.blend_mode to 1 in Light_Source#initialize.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

exile360

January 20, 2013, 05:43:28 pm #5 Last Edit: January 20, 2013, 07:37:43 pm by exile360
It doesn't appear to be using any blending mode at all, I cannot find any lines related to blending.

EDIT: Oh wow... getting this now when a battle ends:
Spoiler: ShowHide

Which is this line in TONS 1:
    @death_sprites.each {|sprite| sprite.dispose}

That add-on isn't even turned on... I don't get it. I tried to re-arrange the scripts further but no effect. Help? :(

Blizzard

That's because you put RTAB below Tons.

Then simply add this in Light_Source#initialize after "super()":

self.blend_mode = 1
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

exile360

January 21, 2013, 04:36:59 am #7 Last Edit: January 21, 2013, 04:38:05 am by exile360
If I put it above TONS, I get the item error and I'm back to square 1.

Tried to add the piece of code to the lighting system and it gives me this error (when starting the game) which points to the same line I added:
Spoiler: ShowHide

Tried to put it above tons, below tons, nothing changed.

Meh... I'm sorry I'm wasting your time Blizz. :(

Blizzard

January 21, 2013, 06:14:32 am #8 Last Edit: January 21, 2013, 06:15:34 am by Blizzard
Have you made sure that you're not using anything in RTAB that isn't supported by Tons and are you sure that you are using the latest version of Tons? Tons works with RTAB, I made sure of that, but there are add-ons for RTAB that simply don't work. RTAB should go above Tons and there may be a configuration setting somewhere in Tons that turns on RTAB compatibility (at least I do remember adding something like that in one of my scripts).

If it's not blend_mode, then it may by blendmode or blending. I can't remember, I haven't really worked with RMXP scripts for almost 3 years.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

exile360

January 21, 2013, 06:51:51 am #9 Last Edit: January 21, 2013, 07:29:41 am by exile360
If the version in the TONS topic is the latest, then yes I'm using the latest version. It's 7.62b. RTAB should also be the correct version, as it's Ver 1.16 and it's written in TONS that it supports 1.16.
I'm not using any of the add-ons in TONS that are listed incompatible. The multi-item drop within TONS does require you to enable RTAB support manually, which I've done, and it works fine so that can't be causing it. Nothing else I could find that I could edit. I'm also only using 1 RTAB addition script, which is the MOG Battler Effects. I deleted it to see if there's a change, but no, it still errors on me.
I really don't know...

Edit: Just tried turning every single add-on in TONS off, and still nothing. Removing TONS from the project completely fixes it, so it must be something there. :/ I just can't find what. I also tried using a fresh new RTAB script (in case I had edited anything in the old one, plus it was the japanese version and this one's the English translation by DerWulfMan) and it's still the same damn error...

Also, neither blending on blendmode work for the lighting system. Not sure why really, seems logical to me as well even though I'm not a scripter.

Edit: Ah, figured it out. It's blend_type. :P Doesn't fix the issue, though. xD Just makes the lights a lot brighter. I suppose the problem is just in the way the script is written and draws the lights. It's quite laggy anyway, I don't know, might resort to using eventing instead even tho it's not a great choice, but I can't find any other working lighting systems. The old one I had requires SDK which I don't want to use for this project.

Blizzard

Right, it was blend_type.

Yeah, I guess that the script isn't so good. Even though it's probably something with the script, it's kinda weird that it's acting like that because it shouldn't.

Make a demo with all the necessary scripts and I will take a look at that RTAB problem. Maybe it's one of the newer add-ons that's causing the problem somehow.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

exile360


ThallionDarkshine

January 21, 2013, 11:01:26 am #12 Last Edit: January 21, 2013, 11:21:46 am by ThallionDarkshine
Can you post the image you're using for the light sources? I just want to try it out and see how it works, and try to fix the problem.

exile360

Well that is extremely weird... I went to the folder to upload it for you and noticed something strange - it was still the old default one which came with the script, not the soft edged one that I made myself. Back when I made it I even double checked whether it's there and still the same after saving, and it was. I honestly can't explain how it reverted back to the default. Anyway, I made a new soft one again and the problem seems to be fixed. Haven't noticed any rough edges anymore. Glad it was such an easy fix, though!

Well, thank you for making me check, haha. I never did because I KNEW it was there. Apparently not...

Blizzard

Alright, I fixed it. Turns out that G_G and Fantasist didn't include a fix for RTAB in their scripts. >_> I have updated Tons of Add-ons to v7.63. Get the newest version and you should be fine.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

exile360

Yep, everything seems to be working indeed! Thank you very much Blizz. :)
I've also edited my CMS and it works with item quality now. The only window where the colors don't appear is the small window where your available equipment is displayed when you're changing equips, but I can't find how to fix that, and it's a minor issue I can live with anyway. I'll change the post to resolved.

My exploit question still remains, but I think I can make a work-around for it with eventing. When an NPC gives you items in a cutscene, I'll add the item gains as the very last commands, and instantly activate a switch to the next autorun page of the event, so the cutscene doesn't stop.

Thanks again!