Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0
Sign in to follow this  
Heretic86

Script for Checking if Through is Enabled or not...

Question

Hopefully a one liner, not as in bad joke, just script. Conditional Branch Script. Im trying to make something happen depending on the condition of a specific sprite having Through enabled...

 

Suggestions?

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

This might help:

Custom Event Trigger: http://forum.chaos-p...hp?topic=6893.0

Event Range Conditions: http://forum.chaos-p...hp?topic=9516.0

 

I don't know as I was little confused on what you were saying.

Share this post


Link to post
Share on other sites
  • 0

I think you might be over thinking the solution. In order for a sprite to have through enabled, you have to enable it no?

So why not, wherever in your events you enable "through", turn on a switch. If that switch is on, through is enabled.

Share this post


Link to post
Share on other sites
  • 0

I meant the little checkbox for an event. I was looking for a Conditional Branch Event using the Script section to check for those types of options are enabled or not...

 

I got a reply on a different forum (no offense) and they explained it very very well.

 

 

 

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

 

 

 

I wouldn't have been able to access the property anyway as it was not public, so extra code was required.

Share this post


Link to post
Share on other sites
  • 0

Also remember that the eval() method for script calls is processed in the event class, so you can use instance variables from it normally without them being public. If you are using the code within the event that is corresponds to and don't want to keep track of the ID, or need to copy-paste the event around, you can do this (after adding the attr_reader mentioned above):

 

Conditional Branch:

Script : $game_map.events[@event_id].through

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...