Page 1 of 1

Events for specific names

Posted: Sat Oct 08, 2016 8:18 pm
by Karunakku
So, I found how to make special things happen when you choose sepcial names. This can be used when the player chooses the name of someone special to the MC(They could talk to you like they would to this person, considering you are them!), for easter eggs(Ex:. You write Poop and the game tells you you're immature and you go back to the name menu) or it could be used so the player can't use the name of an existing character.

I don't even know how to explain it, so I put some basic explanation in the code itself:

Code: Select all

p "Hey, my name is Potato!"

    $ player_name = renpy.input("And you, what's your name?") #Name insert is here

    $ player_name = player_name.strip() 

    if player_name == "":
        $ player_name= "Mashed boi" #This is the name you will have if you enter nothing
        $ name="other"
    if player_name == "Fries": 
        $ name="secret"  #The access to the secret dialogue because of your name
    if player_name == "fries": 
        $ name="secret" #Also avaible without the caplocks
    else: 
        $ name="other" #When you enter anything else
        
    if name == "secret": #You enter this anytime you want a secret dialogue
        p "Oh, h-hey Fries senpai!" 
    if name == "other": #And this for the average ones
        p "I didn't even know other things than potatoes were a thing!"
After some bug checking, I discovered that the blank space name only stays unbothered when you put it first. Or else your secret names won't work!

Re: Events for specific names

Posted: Sat Oct 08, 2016 8:33 pm
by Katy133
I've made a tutorial for that here too, if the screenshots help. :)

Re: Events for specific names

Posted: Sat Oct 08, 2016 11:51 pm
by Divona
Karunakku wrote:You write Poop and the game tells you you're immature and you go back to the name menu
Push it to the next level. Set:

Code: Select all

define persistent.worthless = False
......
if player.name == "Poop" or player.name == "poop":
    p "You're immature. I don't want to talk to you anymore!"
    $ persistent.worthless = True
    $ renpy.quit()
and then...

Code: Select all

label start:
    if persistent.worthless == True:
        p "You're immature. Go away!"
        $ renpy.quit()
......
Oh, I'm so evil. Don't try this at home. :twisted:

You can also do:

Code: Select all

if player.name[:4].lower() == "poop":
So it doesn't matter if player name their character "Poopalicious" or "Poopmaster", it will always trigger. :lol:

Re: Events for specific names

Posted: Mon Dec 05, 2016 1:13 am
by Katherine
Divona wrote:
Karunakku wrote:You write Poop and the game tells you you're immature and you go back to the name menu
Push it to the next level. Set:

Code: Select all

define persistent.worthless = False
......
if player.name == "Poop" or player.name == "poop":
    p "You're immature. I don't want to talk to you anymore!"
    $ persistent.worthless = True
    $ renpy.quit()
and then...

Code: Select all

label start:
    if persistent.worthless == True:
        p "You're immature. Go away!"
        $ renpy.quit()
......
Oh, I'm so evil. Don't try this at home. :twisted:

You can also do:

Code: Select all

if player.name[:4].lower() == "poop":
So it doesn't matter if player name their character "Poopalicious" or "Poopmaster", it will always trigger. :lol:
would this also work if they tried a set of combinations of capital and lower case? (example would "PoOp, POOP, poop, etc." be treated the exact same? or would I have to code for all of those?)

Re: Events for specific names

Posted: Mon Dec 05, 2016 10:53 am
by Katherine
okay I tried this using my own names and got the following error:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 89, in script
    if name == "other":
  File "game/script.rpy", line 89, in <module>
    if name == "other":
NameError: name 'name' is not defined

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 89, in script
    if name == "other":
  File "C:\Users\Katherine\Downloads\renpy-6.99.11-sdk\renpy\ast.py", line 1647, in execute
    if renpy.python.py_eval(condition):
  File "C:\Users\Katherine\Downloads\renpy-6.99.11-sdk\renpy\python.py", line 1670, in py_eval
    return py_eval_bytecode(code, globals, locals)
  File "C:\Users\Katherine\Downloads\renpy-6.99.11-sdk\renpy\python.py", line 1665, in py_eval_bytecode
    return eval(bytecode, globals, locals)
  File "game/script.rpy", line 89, in <module>
    if name == "other":
NameError: name 'name' is not defined

Windows-8-6.2.9200
Ren'Py 6.99.11.1749
Blood of Betrayal 1.0
here is my script for the section. maybe I typed something in wrong?

Code: Select all

label start:
   
    $ Damien_Points = 0
    $ Matthew_Points = 0
    $ Sam_Points = 0
    $ Erik_Points = 0
    $ James_Points = 0
    $ Energy_Points = 75
    $ Sanity_Points = 90
    $ Family_Points = 0
    $ Transform_Points = 0
    $ player_name = renpy.input("What is your name?")
    $ player_name = player_name.strip()
    if player_name == "":
        $ player_name= "Katherine"
        $ name="other"
    if player_name [:4].lower == "mika":
        $ name="secret"
    if name == "other":
        jump story
    if name == "secret":
      if persistent.mika1== false:
          P "Huh . . ?"
          P "Who are you?"
          P "It doesn't matter."
          P "Just go away."
          P "I don't want to relive what that monster did to me."
          $ persistent.mika1 = true
          return
      elif persistent.mika2== false:
          P "Wha-?"
          P "Why are you back?"
          P "Don't you understand that I don't want to talk?"
          P "Just leave me alone."
          $ persistent.mika2 = true          
          return
      elif persistent.mika3 == false:
          P ". . ."
          return