Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: RoseSkye on February 23, 2018, 04:03:06 pm

Title: $game_player.through = true isnt working.
Post by: RoseSkye on February 23, 2018, 04:03:06 pm
I'd like to make it so I can call another event's/ player passable with  any event's move route. The Game_Character section itself says it's $game_player.through = true, but it isn't. Can someone help out?
Title: Re: $game_player.through = true isnt working.
Post by: Blizzard on February 23, 2018, 04:30:55 pm
It's a bug in RMXP's default scripts. Here's a fix: http://forum.chaos-project.com/index.php/topic,938.0.html
Title: Re: $game_player.through = true isnt working.
Post by: RoseSkye on February 23, 2018, 05:12:50 pm
It isn't working.

(https://i.imgur.com/lrSwfJJ.png)
Title: Re: $game_player.through = true isnt working.
Post by: KK20 on February 23, 2018, 10:17:55 pm
@Blizz: That only applies to script calls where you are assigning a variable to false

The real problem at hand here is that Game_Character's through attribute is only set as a reader.
attr_reader   :through

"Reader" meaning you can only "read" what the value is; you cannot change, or "write", it outside of the class.

If you change that to
attr_accessor   :through

I think you'll be fine. An "accessor" allows you to read and write the attribute.
Title: Re: $game_player.through = true isnt working.
Post by: RoseSkye on February 24, 2018, 12:46:36 am
This is twice you've saved me, KK20... also, I've learned something new.
Title: Re: $game_player.through = true isnt working.
Post by: Heretic86 on February 26, 2018, 09:54:05 pm
Another way to do it, if youre not interested in using the Interpreter command_355 fix, is to actually write out a method for it.

class Game_Character
  def through=(arg)
    @through = arg
    return true
  end
end

Trouble is this only corrects $game_player.through = false or $game_map.event[id].through = false

The problem will still exist if other properties are changed to false by a script call.