Main Menu
  • Welcome to The RPG Maker Resource Kit.

A question about VXA opacity... [Resolved]

Started by Zylos, March 28, 2012, 03:11:58 AM

0 Members and 1 Guest are viewing this topic.

Zylos

One of the things I want to try to do with VXA is set up a strange feature that makes a ghost enemy become more opaque the closer event gets to the player, thus making it somewhat invisible from a distance. The math behind it is simple, just good old geometry's distance formula, so it's very easy to determine the distance between the player and the enemy in question. What is NOT easy is figuring out how to manually write in the enemy's new opacity via scripting. It can be done via eventing, but it would take a LOT of conditional branches to make the process look smooth, when a single "$game_map.events[n].opacity = " would work a whole lot simpler and smoother if such a thing existed.

So what I want to ask is simple: What's the bloody coding for an event's opacity? x_x




pacdiggity

I would help you if I wasn't against you in GIAW :mad:
[spoiler]:V
Truth is, in Game_CharacterBase @opacity is set to an attr_reader, which means that it can't be overwritten from outside classes. A simple fix for this would be sticking this in the script editor:class Game_CharacterBase
  attr_accessor :opacity
end
Then you could use $game_map.events[n].opacity = x
I think.[/spoiler]
it's like a metaphor or something i don't know

Zylos

A nice idea, but the variable already exists in $game_characterbase when I checked. Just can't seem to access it for some reason, even when I tried $game_player.opacity to mess with the player's transparency.




modern algebra

Yeah, that's what he's saying. The @opacity instance variable exists, but there is no opacity= method which would permit you to change it from outside the class. If you do:


class Game_CharacterBase
  attr_writer :opacity
end


then what you will do is create the opacity= method, permitting you to do that which you desire to do.

Zylos

There we go, that works perfectly! Allowed me to put in a formula easily for growing more opaque the closer the event in question is to the player.




pacdiggity

Did you even read my post? It's pretty much exactly the same thing. .-.
it's like a metaphor or something i don't know