Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Hue script

Ok, this script works except for doing its job. How might I go about changing the hue of the character using this script? It should work, but the variable is probably the issue.

Code:
#Hue Changer On Demand!
#Made by Shiroun
#I guess... here goes?#
#Alright, heres the jist of it below. First off, this is a script that you do, so
#to speak. Just copy any paste this with the number you want in the []
class Game_Actor
  attr_reader   :character_hue 
 if $script_character_hue = [123]
  then @character_hue  = $script_character_hue
 elsif $script_character_hue = [256 => 9999999999999999999999999999999999999]
  print("Unable to comply, hue is to high!")
  $scene = nil
  end
end

Anyone?
 

khmp

Sponsor

First you should encapsulate this code within a method. You don't need to add that attr_reader :character_hue because it is already defined in Game_Actor as such.

Code:
class Game_Actor < Game_Battler
  def change_hue
    if $script_character_hue = [123]
      then @character_hue  = $script_character_hue
    elsif $script_character_hue = [256 => 9999999999999999999999999999999999999]
      print("Unable to comply, hue is to high!")
      $scene = nil
    end
  end
end

You're using an array in the conditional statements and yet again you are using single equals instead of double equals.

= equality
== comparison

The array on the other hand can just be substituted with a number. The number for a character hue can't be higher than 255 I believe. So in that elsif part you want to check if a number is between 0-255. Giving the final result of what you are trying to accomplish.

hue - 0..360 Thanks arevulopapo!

Code:
class Game_Actor < Game_Battler
  def change_hue
    @character_hue  = $script_character_hue
  end
end

[edit update]
If it rolls over like arevulopapo suggests like an angle then there isn't even a reason to check the variable.

Good luck with it shiroun! :thumb:
 

arev

Sponsor

Ok, first of all, the hue is never to high - it cycles by 360 degrees. So when it's, let's say, 1000 it's decreased by as many 360's as possible, and equals really 280.
Now, I'm not sure what is this: $script_character_hue = [123]
This array isn't declared anywhere, so it's that odd it doesn't work. Try comparing it with an ordinary variable.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top