The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: Heretic86 on November 20, 2011, 11:27:54 AM

Title: [XP] Conditional Branch Script for checking if Always On Top or Through Enabled?
Post by: Heretic86 on November 20, 2011, 11:27:54 AM
Hoping you guys can help me.  I have need for a Conditional Branch that needs to check whether or not some of the resources not available in the Conditional Branch options are enabled or not.  Basically, "if Event.Through == True" or "if Event.Always_On_Top == 1" or something like that.

Can you help me out?
Title: Re: [XP] Conditional Branch Script for checking if Always On Top or Through Enabled?
Post by: modern algebra on November 20, 2011, 01:02:00 PM
Well, I suspect that there is a better way to do whatever it is you are trying to do by checking those values.

However, you can check if an event is through by placing the following code into the script field of the conditional branch:


$game_map.events[event_id].through


where event_id is an integer corresponding to the ID assigned to the event you are checking.

always_on_top is not, by default, publically accessible, so you will need to first insert a new slot in your scripts, and in that, paste the following:


class Game_Character
  attr_reader   :always_on_top
end


Then, in the script field of the conditional branch, check the following:


$game_map.events[event_id].always_on_top


where again, you replace event_id with the integer ID for the event you are checking.

If you want to check either of those values for the player, then the code is:


$game_player.through
$game_player.always_on_top
Title: Re: [XP] Conditional Branch Script for checking if Always On Top or Through Enabled?
Post by: Heretic86 on November 20, 2011, 10:51:25 PM
I never would have figured that out!  I tried reading through the pages of the engine I thought were relevant, but apparently got totally stuck on through and always on top not being public.

I am so glad there are people like you that both understand the engine to this degree and are willing to help!  Thanks a ton!