Yan ken, anyone?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
vaanknight
Regular
Posts: 118
Joined: Sun Mar 28, 2010 6:01 pm
Completed: Happy Weird-Day! How a freckled fairy can save your world (Or get more freckles in the process...)"
Projects: Nameless 2D Fighting Game
Contact:

Yan ken, anyone?

#1 Post by vaanknight »

I came to a point in my current project where my main character needs to get out from a Hellgate, and needs the Succubus leader of the place to lend her a pass to show to the guard at the entrance... at first I just wrote it so the Succubus just did it for the sake of it, but that's just pretty bland... I need then, a challenge to the player, I thought maybe a card game (too long and winded for sucha lil game) or a riddle (too boring and still bland maybe)... but then I thought about playing Yan Ken... xD so anyone has an idea of how to program that? or at least an idea for a small minigame that doesn't take more than a couple of minutes to either win or lose? I'd really love to put a yan ken po feature in my VN.
Image

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: Yan ken, anyone?

#2 Post by Aleema »

Is that rock, paper, scissors? ^^;

If so, here's a way to do it:

Code: Select all

label yanken:
    $ weapon = None
    menu:
        "choose one"
        "Rock":
            $ weapon = "rock"
        "Paper":
            $ weapon = "paper"
        "Scissors":
            $ weapon = "scissors"
            
    $ num = renpy.random.randint(1,3)
    
    # she chooses rock
    if num == 1:
        if weapon == "rock":
            "tie"
            jump yanken
        elif weapon == "paper":
            "you win"
            jump won_game
        elif weapon == "scissors":
            "you lose"
            jump lost_game
    # she chooses paper
    elif num == 2:
        if weapon == "rock":
            "you lose"
            jump lost_game
        elif weapon == "paper":
            "tie"
            jump yanken
        elif weapon == "scissors":
           "you win"
           jump won_game
   # she chooses scissors
   elif num == 3:
        if weapon == "rock":
           "you win"
           jump won_game
        elif weapon == "paper":
            "you lose"
            jump lost_game
        elif weapon == "scissors":
            "tie"
            jump yanken
I didn't test it, so ...

vaanknight
Regular
Posts: 118
Joined: Sun Mar 28, 2010 6:01 pm
Completed: Happy Weird-Day! How a freckled fairy can save your world (Or get more freckles in the process...)"
Projects: Nameless 2D Fighting Game
Contact:

Re: Yan ken, anyone?

#3 Post by vaanknight »

Ah, exactly what I was looking for, what would I do without Aleema? Thank you very much, I'll try it out and post if it works.
Image

LVUER
King of Lolies
Posts: 4538
Joined: Mon Nov 26, 2007 9:57 pm
Completed: R.S.P
Location: Bandung, West Java, Indonesia
Contact:

Re: Yan ken, anyone?

#4 Post by LVUER »

Jan Ken Po (Rock Scissors Paper)? What a coincidence, I've made a game like that titled R.S.P. (Rock Scissors Paper). You could find it in here (LSF, completed hentai game section) or from my DA account, but since the game is 18+, you couldn't play it if you're a minor (well, you can, but don't blame me on anything). It's not a hentai though, only ... ah, you could play it yourself.

If you could play it, perhaps it could become a good source of reference for you. And I don't mind sharing a tip or two for you, as a fellow of game maker ^_^
"Double the princesses, quadruple the fun!" - Haken Browning (SRW-OG Endless Frontier)

DeviantArt Account
MoeToMecha Blog (under construction)
Lolicondria Blog (under construction) <- NSFW

vaanknight
Regular
Posts: 118
Joined: Sun Mar 28, 2010 6:01 pm
Completed: Happy Weird-Day! How a freckled fairy can save your world (Or get more freckles in the process...)"
Projects: Nameless 2D Fighting Game
Contact:

Re: Yan ken, anyone?

#5 Post by vaanknight »

OOOH, I downloaded it, it was amazing... exactly what I was aiming at *is perplexed*, and what an... interesting approach into the hentai canon xD, much more innocent than I imagined with your warning. I enjoyed it a lot, and I'm guessing you wouldn't want to share the code? *asks for much*, or only post a little piece of it so I get to work the point system, I need each player (VN player and the comp.) to have a certain number of chances before the game is won, just like your RSP.
Image

LVUER
King of Lolies
Posts: 4538
Joined: Mon Nov 26, 2007 9:57 pm
Completed: R.S.P
Location: Bandung, West Java, Indonesia
Contact:

Re: Yan ken, anyone?

#6 Post by LVUER »

I don't mind sharing the code, perhaps I will PM you or email you (in that case, I need your email address). But not now since the PC I used to make RSP and PC that I used to surf on internet is different, so I must copy the files first. You could use them all or just a part of those codes. Just don't forget to credit me though, hehehe... ^_^

There's nothing special with codes. It's just a heap of conditions (IF) and renpy.random functions. The code is more or less like what Aleema posted earlier, but more complex since I have to insert "thinking logic" for about 8 people.

To give more chance/life to enemies (and your player), you could make two variables. Each for player HP and enemy HP. If you lose, deduct your HP (and if enemy lose, deduct enemy HP). Check the HP to see if there's one of those two variables reached zero. If not, jump to beginning. If yes, then the gameplay session is over.
"Double the princesses, quadruple the fun!" - Haken Browning (SRW-OG Endless Frontier)

DeviantArt Account
MoeToMecha Blog (under construction)
Lolicondria Blog (under construction) <- NSFW

vaanknight
Regular
Posts: 118
Joined: Sun Mar 28, 2010 6:01 pm
Completed: Happy Weird-Day! How a freckled fairy can save your world (Or get more freckles in the process...)"
Projects: Nameless 2D Fighting Game
Contact:

Re: Yan ken, anyone?

#7 Post by vaanknight »

Ah, very well, thank you very much! I will PM you my e-mail address and you can send me what you think it can help me, and of course I will credit you. ;]

by the way, Aleema's code works like a charm once you edit it to fit your needs, I just need something a bit more complex.
Image

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], Ocelot