Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Default Script Glitch for RMXP

Star

Sponsor

Yo guys, I know I haven't been around much but hey I've been working full time on this project I've been on, but I've run into an issue with the default scripts. Whenever you ask $game_party.actors.id == 4 in a conditional branch, when there are no party members in slot it always returns true no matter what. I've been pulling my hair out looking through my events for the problem only to find it's Enterbrains fault.

http://www.mediafire.com/?a2lhup6iuvm76vi

Any help is appreciated :) Be well folks, Thank ya!
 
For some reason its returning the object id, which is normally accessed with __id__, not just id. I was messing around and tried a few different things, and found that "nil.id" and "nil.__id__" both return a value of 4. More than likely Enterbrain changed this in the Ruby source when they compiled it for some reason, because as far as I know, there is no "id" method defined in the Object class, only "__id__".
 

Atoa

Member

@ForeverZer0
Yes, RM Object class includes it's own "def id" method.

@Star
you can simply make two checks:
$game_party.actors != nil and $game_party.actors.id == 4

Most cheks that verify arrays that contain complex objects, cheks first if the object is different from nil, to avoid no method error
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top