Main Menu

[XP] Conditional Branch Script for checking if Always On Top or Through Enabled?

Started by Heretic86, November 20, 2011, 11:27:54 AM

0 Members and 1 Guest are viewing this topic.

Heretic86

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?
Heretic's Vehicles XP (Boat and Magic Carpet)

Heretic's Collection XP Ver 2.3 - Updated to include Dynamic Lighting, Moving Platforms, Vehicles, and much much more!

modern algebra

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

Heretic86

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!
Heretic's Vehicles XP (Boat and Magic Carpet)

Heretic's Collection XP Ver 2.3 - Updated to include Dynamic Lighting, Moving Platforms, Vehicles, and much much more!