• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Script for checking if player if male or female?

  • 24
    Posts
    10
    Years
    • Seen Mar 29, 2015
    I've started developing my own pokemon game and while I am not completely new to programming, I am rather new to both essentials and RPGM XP.

    Right now I am currently working on the first town and i've run into a bit of an obstacle.

    I can't really figure out how the script for RPG maker works. I tried to run a code to check the players gender and it immediately crashed.

    I used the $Trainer.gender type to check if the value = 0 and that alone does not seem to work. Could somebody help me with the syntax?

    Edit: Here is the code
    Spoiler:
     
    I've started developing my own pokemon game and while I am not completely new to programming, I am rather new to both essentials and RPGM XP.

    Right now I am currently working on the first town and i've run into a bit of an obstacle.

    I can't really figure out how the script for RPG maker works. I tried to run a code to check the players gender and it immediately crashed.

    I used the $Trainer.gender type to check if the value = 0 and that alone does not seem to work. Could somebody help me with the syntax?

    Edit: Here is the code
    Spoiler:

    "=" sets a value, "==" tests a value
    However, if you're using the newest version,
    Code:
    $Trainer.isMale?
    will return the same result.
     
    "=" sets a value, "==" tests a value
    However, if you're using the newest version,
    Code:
    $Trainer.isMale?
    will return the same result.

    Well, shoot, I should have known that. I underestimated just how similar the script is to a real programming language. Thank you for the help!
     
    Well, shoot, I should have known that. I underestimated just how similar the script is to a real programming language. Thank you for the help!

    NP. Eventing isn't quite the same, but RGSS is based on Ruby, which is a real programming language.
     
    Even in events, if you're typing something in rather than selecting radio buttons or check boxes, it's scripting and it's proper code. Given the option you were using is called "Conditional Branch Script", I thought it would have been obvious.
     
    Even in events, if you're typing something in rather than selecting radio buttons or check boxes, it's scripting and it's proper code. Given the option you were using is called "Conditional Branch Script", I thought it would have been obvious.

    That's a pretty condescending way to talk to me. Given that you seem to be a big part of the game development community (having written some of the tutorials i'm using), i'm a bit shocked and hurt. The fact is that people, no matter their experience, make mistakes. Then again, I guess I probably shouldn't have suggested scripting code is not real code and I apologize for that.
     
    Hi I know I'm quite a bit late to this discussion but I'm just wanting to ask which line in my script editor code do I implement that code $Trainer.isMale? and also is there anymore code I would need to implement to the script editor with that code to force the default name for the male player to be James and the female player choice to be called Diana if neither one has a name picked by the player? @mej71
     
    Hi I know I'm quite a bit late to this discussion but I'm just wanting to ask which line in my script editor code do I implement that code $Trainer.isMale? and also is there anymore code I would need to implement to the script editor with that code to force the default name for the male player to be James and the female player choice to be called Diana if neither one has a name picked by the player? @mej71
    Buddy you really should have made a new thread instead of necroing one that's 9 years old.
    What version of Essentials are you on? $Trainer doesn't exist in newer versions, it's $player now. And you'd use $player.male? in a conditional.
    As for gender specific names, you'll want to adjust def pbSuggestTrainerName(gender)
    Ruby:
    def pbSuggestTrainerName(gender)
      return "James" if gender==0 # male
      return "Diana" # all other genders (1 = Female and 2)
    end
     
    Buddy you really should have made a new thread instead of necroing one that's 9 years old.
    What version of Essentials are you on? $Trainer doesn't exist in newer versions, it's $player now. And you'd use $player.male? in a conditional.
    As for gender specific names, you'll want to adjust def pbSuggestTrainerName(gender)
    Ruby:
    def pbSuggestTrainerName(gender)
      return "James" if gender==0 # male
      return "Diana" # all other genders (1 = Female and 2)
    end
    yeah sorry, wont lie but never thought of doing a new thread. Basically what im trying to do is have it so if the player chooses no name when picking a boy it defaults to James and then do the same thing if they choose female with Diana and this is what i have so far, what lines in this do i need to remove and which ones do i need to change with your code? Never mind I figured out how to input your code and got it working now, thank you so much
     

    Attachments

    • [PokeCommunity.com] Script for checking if player if male or female?
      Screenshot (2).png
      1.2 MB · Views: 5
    • [PokeCommunity.com] Script for checking if player if male or female?
      Screenshot (3).png
      836.5 KB · Views: 5
    Last edited:
    Buddy you really should have made a new thread instead of necroing one that's 9 years old.
    What version of Essentials are you on? $Trainer doesn't exist in newer versions, it's $player now. And you'd use $player.male? in a conditional.
    As for gender specific names, you'll want to adjust def pbSuggestTrainerName(gender)
    Ruby:
    def pbSuggestTrainerName(gender)
      return "James" if gender==0 # male
      return "Diana" # all other genders (1 = Female and 2)
    end
    Ive ran into another issue, if you wouldnt mind helping me. I have everything for fire reds original opening in pallet town done like oak stopping you in grass, taking you into lab and walking up to disappear and replace with a different professor oak but when he takes me into the lab he just stops moving inside and i cant move my player either for some reason? I have been trying all sorts of different thing but not matter what i try he and i cant move once in the lab, any idea on if i missing something for it?
     

    Attachments

    • [PokeCommunity.com] Script for checking if player if male or female?
      Screenshot (4).png
      156.7 KB · Views: 3
    Ive ran into another issue, if you wouldnt mind helping me. I have everything for fire reds original opening in pallet town done like oak stopping you in grass, taking you into lab and walking up to disappear and replace with a different professor oak but when he takes me into the lab he just stops moving inside and i cant move my player either for some reason? I have been trying all sorts of different thing but not matter what i try he and i cant move once in the lab, any idea on if i missing something for it?
    Make a new thread for a new question.
    Post the event pages too.
     
    Back
    Top