$game_player.through = true isnt working.

Started by RoseSkye, February 23, 2018, 04:03:06 pm

Previous topic - Next topic

RoseSkye

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?

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

RoseSkye


KK20

@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.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

RoseSkye

This is twice you've saved me, KK20... also, I've learned something new.

Heretic86

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.
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)