[XP] Complete Climate and Time System (CCTS)

Started by ForeverZer0, May 12, 2010, 06:08:20 pm

Previous topic - Next topic

LiTTleDRAgo

October 27, 2010, 04:54:59 am #100 Last Edit: October 27, 2010, 07:41:59 am by Blizzard
Bug on the Demo

Spoiler: ShowHide


and

Spoiler: ShowHide

at this line
    if @day > CCTS::MONTH_LENGTH[@month - 1]

ForeverZer0

Thanks, I shall check it out. It seems that there is always one bug left to fix with this script...
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

RoseSkye

October 30, 2010, 07:49:26 pm #102 Last Edit: October 30, 2010, 08:02:58 pm by RoseSkye
The toggle buttons are a bit annoying.

ForeverZer0

That can be easily disabled if you don't like it, though it will remove the ability for the player to be able to turn the clock on/off, unless you add it to a menu, etc. Scan the script, towards the bottom you will find Scene_Map, delete the section in the update method that checks for the Input.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Ryex

your rate generation for the tone is flawed in that if one or more of the rates is positive the rate is either not signed properly the reall difference isn't calculated or both

for example the previous rate is [0, 0, 0, 0]
and the new rate is [20, 20, 10, 10]

old.abs - new.abs yields [-20, -20, -10, -10] when the real difference is [20, 20, 10, 10]

or the previous rate is [-10, -10, -10, 10]
and the new rate is [20, 20, 10, 10]
old.abs - new.abs yields [-10, -10, 0, 0] when the real difference is [30, 30, 20, 0]

this can be fixed like so

if old[i] < 0 && new[i] < 0
  rate[i] = old[i].abs - new[i].abs
else
  rate[i] = new[i] - old[i]
end
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

lonely_cubone

I have no idea if this syntax would work, but if you're just trying to find the difference between two arrays, wouldn't it be this?
rate[i] = (old[i] - new[i]).abs


I'm guessing that's not correct RGSS syntax, but even if it takes 2 lines (subtract first then get absolute value) it seems like it'd be a little bit easier.

:P

Ryex

the thing is that you need the correctly signed difference
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

ForeverZer0

November 22, 2010, 07:59:33 am #107 Last Edit: November 22, 2010, 12:04:09 pm by ForeverZer0
I can look into it, but if memory serves me right, whatever I did, the final tone is correct. What is configured is what it will be. If that is right, not sure, it is not flawed.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

The Niche

Level me down, I'm trying to become the anti-blizz!
Quote from: winkio on June 15, 2011, 07:30:23 pm
Ah, excellent.  You liked my amusing sideshow, yes?  I'm just a simple fool, my wit entertains the wise, and my wisdom fools the fools.



I'm like the bible, widely hated and beautifully quotable.

Dropbox is this way, not any other way!

The Niche

Mimispelling? Sounds worryingly like memespelling...

Anyway, Zero I've got a problem. Just updated to the latest version, haven't touched the settings, so it may be that I need to reconfigure it. Getting to the point, whenever I try to test the game, it comes up with a syntax error in line 306 of the...main script, I believe. To give you a bit more situation detail, I'm using: Your advanced title script. CCOA's UMS. Kread-ex's ais. Maws 1.2. BABS. The active action information script by Little Drago. BABS auto targeting. Visual equipment for BABS. BABS rapid fire. Continuous maps. Blizzard's stat growing. Midge's secondary weapons script. Your resolution script. Zeriab's disc changer script.

I know that's a lot of information, which is probably unnecessary, but this problem is confusing me. THe newest scripts are the advanced title and the resolution.
Level me down, I'm trying to become the anti-blizz!
Quote from: winkio on June 15, 2011, 07:30:23 pm
Ah, excellent.  You liked my amusing sideshow, yes?  I'm just a simple fool, my wit entertains the wise, and my wisdom fools the fools.



I'm like the bible, widely hated and beautifully quotable.

Dropbox is this way, not any other way!

ForeverZer0

Are you sure you have the newest version? I only ask because you say it is in the "main" script, but as of version 2.0 the scripts have all been combined into one. I just checked the script and it appears line 306 is only a comment.

Either way, I did find a blatant error (I thought I had already fixed this...), but it is around line 870 or so in the "refresh_switched" method. I had forgot to add the instance variable that the game variables are supposed to be set to. I will re-upload the script here today, but in the meantime if you feel like fixing it yourself, you can simply remove the old "refresh_switches" method and replace it with this:


  def refresh_switches
    # Set Day/Night switches if time is in configured ranges.
    if @hour.between?(CCTS::DAY_START_HOUR, CCTS::NIGHT_START_HOUR - 1)
      $game_switches[CCTS::DAY_SWITCH] = true
      $game_switches[CCTS::NIGHT_SWITCH] = false
    else
      $game_switches[CCTS::DAY_SWITCH] = false
      $game_switches[CCTS::NIGHT_SWITCH] = true
    end
    # Set Season Variable
    CCTS::SEASON_MONTHS.each_index {|i|
      if CCTS::SEASON_MONTHS[i].include?(@month)
        $game_variables[CCTS::SEASON_VARIABLE] = i
      end
    }
    # Set variables to the current time if configured to do so.
    $game_variables[MINUTE_VARIABLE] = @minute if MINUTE_VARIABLE != nil
    $game_variables[HOUR_VARIABLE] = @hour if HOUR_VARIABLE != nil
    $game_variables[DAY_VARIABLE] = @day if DAY_VARIABLE != nil
    $game_variables[MONTH_VARIABLE] = @month if MONTH_VARIABLE != nil
    $game_variables[YEAR_VARIABLE] = @year if YEAR_VARIABLE != nil
    # Have $game_map refresh to have events, etc. respond to changed switches.
    $game_map.need_refresh = true
  end
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

The Niche

December 11, 2010, 05:11:31 pm #111 Last Edit: December 12, 2010, 09:29:12 am by The Niche
Yeah, I split it out of personal preference. I redid it as one script and the error's in line 876.

The line is

Game_Climate = Struct.new(:id, :name, :weather, :tinting, :sound, :speed, :maps)

I've tried it in a blank project as well, with no other scripts. This is distinctly odd.
Level me down, I'm trying to become the anti-blizz!
Quote from: winkio on June 15, 2011, 07:30:23 pm
Ah, excellent.  You liked my amusing sideshow, yes?  I'm just a simple fool, my wit entertains the wise, and my wisdom fools the fools.



I'm like the bible, widely hated and beautifully quotable.

Dropbox is this way, not any other way!

ForeverZer0

The Script download is now fixed.

I'm in the middle of some maintanence on my PC at the moment and I have RMXP uninstalled, so I can't fix the demo at the moment, but I will soon as I get all this business taken care of.


Anyways, the actual error is not on that line, that is just where it pops up at. If you used the fix from my previous post it would do it.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

The Niche

I only just noticed that now. I am really not with it today...
Level me down, I'm trying to become the anti-blizz!
Quote from: winkio on June 15, 2011, 07:30:23 pm
Ah, excellent.  You liked my amusing sideshow, yes?  I'm just a simple fool, my wit entertains the wise, and my wisdom fools the fools.



I'm like the bible, widely hated and beautifully quotable.

Dropbox is this way, not any other way!

CountVlad

I know this is going to sound nooby as always, but is there a way to output the current map climate to a variable?
The reason for this is that the player character graphic (and various other things) needs to change based on the climate and it would make it way simpler to just have one PP event with conditional branches running that change these things instead of having an event on every map.

[Luke]

Find the refresh_switches method. Add a line

$game_variables[CLIMATE_VARIABLE_ID] = map_climate($game_map.map_id)

Haven't test, not sure, etc.

CountVlad

Quote from: [Luke] on December 28, 2010, 03:27:30 pm
Find the refresh_switches method. Add a line

$game_variables[CLIMATE_VARIABLE_ID] = map_climate($game_map.map_id)

Haven't test, not sure, etc.

I tried putting it in various places in the script, but it didn't seem to work. The only place I put it where it didn't produce a crashing error it didn't seem to change the variable.

ForeverZer0

If you are using it in a script call or event, you need to access the variable through its instance:

$game_map.map_climate($game_map.map_id)


I could be wrong. I honestly don't remember all the method names I used. I'll be home in about an hour and will double check for you what the exact syntax is.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

CountVlad

Quote from: ForeverZer0 on December 28, 2010, 04:28:27 pm
If you are using it in a script call or event, you need to access the variable through its instance:

$game_map.map_climate($game_map.map_id)


I could be wrong. I honestly don't remember all the method names I used. I'll be home in about an hour and will double check for you what the exact syntax is.

Hmm... I'm not sure I quite understand what you mean.
Ideally what I'd like to do is put it in a script call inside an event so I can then set an event variable to whatever the climate script variable is then use that event variable in a conditional branch.
Or if it's easier to explain, I could get a conditional branch to check if an expression is true or not.

ForeverZer0

Try this as a condition:

$game_map.climate.id == INSERT_ID_HERE


It will return true if the climate ID is equal to what you defined.
You can also check if the ID is NOT equal the ID you define with:

$game_map.climate.id != INSERT_ID_HERE
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.