Charas-Project

  • Home
  • Help
  • Search
  • Calendar
  • Login
  • Register
*
Please login or register.

Login with username, password and session length
 

News:

New forum theme up and running!



  • Charas-Project »
  • Game Creation »
  • Requests »
  • RPG Maker Programming »
  • Input Keys Question
« previous next »
  • Print
Pages: [1] 2 3

Author Topic: Input Keys Question  (Read 16563 times)

Offline evmaster

  • Member
  • Associate
  • *
  • Posts: 231
Input Keys Question
« on: July 10, 2012, 02:27:28 AM »
Wow. Haven't been here in years. :hi: I stopped coming here one day because a virus would pop up every time I came to the site. Anyone know about that? Anyways, I am back for the time being as I got RPG maker 2003 again as my last computer crashed a few years back. Don't think anyone remembers me, but say hi if you do.  ;D

Okay, now for my question. I want to be able to give gifts to NPCS by pressing a key other than the space bar. Space bar to talk and maybe shift key to bring up another message that says "Give Gift" or something. Is that even possible?
Logged

Offline A Forgotten Legend

  • Your neighborhood box of colors
  • Royal
  • *
  • Posts: 4,428
    • Website
Re: Input Keys Question
« Reply #1 on: July 10, 2012, 02:45:13 AM »
I vaguely remember that happening to someone, and I remember your name.

As for your question, yep! Totes possible.  I'll edit in a few your solution.

EDIT:

Alright, so I tested it out and it works.

First make your event, and set it to Collision with Hero, NOT Touched by Hero.  If you do the latter it won't end the event after everything is said and done with without some switch and multiple page bull.

Before you do anything, use the Label event command and create Label 1.

Next, Choose Key Input Process as the first event command. Make sure 1-5 and 7 are checked. At the top, you need to select a variable that the key input will go into.  So make one and call it gift or something.  Make sure that Wait Until Key is Pressed is checked.

Now make a condition branch.  If Variable "Gift" is 7 (That's the number that was beside the Shift key) and then check the else handler box.

Inside the conditional branch yes case, put everything you want to happen when you are giving the gift.  In the else case make another conditional branch.  This time make it If Variable "Gift" is 5 (The number beside the decision key).  Give this one an else case as well.  Inside here, put whatever the NPC is supposed to do when not giving a gift.

Inside the Gift is 5 else case make a "Jump to Label 2" command.  At the end of the event, put a Variable Operation: "Gift" Set equal to zero.  Then put a "Jump to Label 1" command.  This will make it so then the hero can choose to talk to the event again.  After the "Jump to Label 1" put a "Label 2" command in.  This will make it so the event will end.  What is happening is that the else case with a Jump to Label 2 command in it is only used when the hero uses a directional key.  So when the hero walks away, the event will end.  Finally, add an End Event Processing command and you should be good!
-------------

Wait minute--- fixing a few errors I made.
... And fixed them!  It should work perfectly now!

This is what it should look like in the editor.
Code: [Select]
<>Label: 1
<>Key Input Proc: [0001: Gift]
<>Branch if Var [0001: Gift] is 7
  <>GIFT CODE GOES HERE
  <>
: Else Handler
  <>Branch if Var [0001: Gift] is 5
    <> REGULAR NPC CHAT GOES HERE
    <>
   : Else Handler
     <>Jump to Label: 2
     <>
   : End
  <>
 : End
<>Variable Oper: [0001: Gift] Set, 0
<>Jump to Label: 1
<>Label: 2
<>End Event Processing
« Last Edit: July 10, 2012, 03:29:07 AM by A Forgotten Legend »
Logged

Offline evmaster

  • Member
  • Associate
  • *
  • Posts: 231
Re: Input Keys Question
« Reply #2 on: July 10, 2012, 03:55:14 AM »
I did not expect such a detailed reply so soon! Thank you!  ;D

As when I press Space Bar to talk, nothing happens and when I press Shift during that time it triggers the Gift event. I think I am doing something wrong.

Forgive me, but it has been quite a long time since I played Rpg maker. I think I am missing something


Logged

Offline A Forgotten Legend

  • Your neighborhood box of colors
  • Royal
  • *
  • Posts: 4,428
    • Website
Re: Input Keys Question
« Reply #3 on: July 10, 2012, 05:06:50 AM »
Do you have all the boxes that I said to have checked off checked in the Key Input Process command?  You should have the first 5 and then number 7.  It's working for me.

I did notice that because of the Collision with hero, the character will face you if you collide with them and then turn back to the original direction if you choose not to do anything and walk away.
Logged

Offline evmaster

  • Member
  • Associate
  • *
  • Posts: 231
Re: Input Keys Question
« Reply #4 on: July 10, 2012, 11:53:34 AM »
Thank you so much for helping me! I really appreciate it.  :happy:

Another question, how would I make the same character say more than one message with this option? Is that possible?
« Last Edit: July 10, 2012, 11:57:20 AM by evmaster »
Logged

Offline A Forgotten Legend

  • Your neighborhood box of colors
  • Royal
  • *
  • Posts: 4,428
    • Website
Re: Input Keys Question
« Reply #5 on: July 10, 2012, 04:16:25 PM »
Well, depends on how you want to do it.  If you are talking about doing a different regular talking message it just involves randomizing a variable and then making a few conditional branches withing the REGULAR talk part of the event.
Logged

Offline Prpl_Mage

  • Administrator
  • Sage
  • *
  • Posts: 7,645
  • The Administrator Mage
    • Check out our itch website
Re: Input Keys Question
« Reply #6 on: July 10, 2012, 04:40:21 PM »
Yes we got rid of the virus when we updated the website, it was a bit unsettling but now charas looks bland instead.

Where did you find that neat scrolly thing AFL?

More than one message? As in more than one " message" command(1) or rather a "speaking again triggers a new response"(2) or are we really talking about "random dialogue"(3)?

1. Add another "Message" command with more text.

2. Add a conditional branch that checks the value a variable. Either a temprary variable that doesn't really matter or a variable set for this exact person. I would suggest against the later since that would mean a variable for every npc if you want all of them to do this.
Say you want the person to say "hello my good sire and madam" on the first click and then on the second he goes all "what delightful weather we are having, no?" where the third response is "I would kindly request you to stop interrupting my harping". For this we'll need 3 conditional branches.
First one is easily enough "VAR equal to 0" where you show the first message. Next up is a conditional branch that checks for the value 1 and a message. And not to surprisingly you add a third one that checks for the value 2(or greater) and the message.
Lastly we add a variable operations in the END. Make it add 1 to the variable.

This will make the first message pop up if you haven't talked to the person before, after that message is played and the other conditional checks fail - the add 1 to VAR will go off and increase that variable by 1 which in turn will make the second message appear next time you talk to him.

So in lines of code.(Kinda)

C Branch: VAR is 0
  Show message :
 C Branch: Var is 1
   Show Message:
  C Branch: Var is 2
    Show message:
END
Variable operations: VAR + 1



3. If you want a random message out of like 3 possible being: "I like swords", "Welcome to corneria" or "two by two hands of blue" you also gotta use a variable and conditional branches.
First we go with variable operations. Set the value of a chosen temprary variable and set it to a random value between 1 and 3.
Next throw in 3 conditional branches with messages in them just like the one before. Only difference is that we have no "variable +1" in the end. Since everytime you speak to the npcs the randomizing of the variable will occur once more.

Logged
Cool RPGM Project!
Sprite till you die

Oh my god, this was ...10 years ago...

Offline evmaster

  • Member
  • Associate
  • *
  • Posts: 231
Re: Input Keys Question
« Reply #7 on: July 10, 2012, 05:42:34 PM »
Now I am trying to make the same NPC event with the Key input have random messages and then more messages the more the NPC likes you. I think it can be done with Variables Operation Add?

Also, I want to show how much a NPC likes you after you give them gifts? I use to be able to know how to use the Variables where you do something like Add Variable Plus one and then I made a book where you could look at how much they like you and made heart symbols along with the the number variables it corresponded with. Anyone know what I am talking about?

You guys have been great!  :bend:
« Last Edit: July 10, 2012, 06:44:14 PM by evmaster »
Logged

Offline A Forgotten Legend

  • Your neighborhood box of colors
  • Royal
  • *
  • Posts: 4,428
    • Website
Re: Input Keys Question
« Reply #8 on: July 10, 2012, 06:58:53 PM »
@Prpl, [ code ]
Logged

Offline Prpl_Mage

  • Administrator
  • Sage
  • *
  • Posts: 7,645
  • The Administrator Mage
    • Check out our itch website
Re: Input Keys Question
« Reply #9 on: July 10, 2012, 08:59:12 PM »
Well, basically you need a conditional branch before your conditional branch.
Made no sense? I know.

Right now the event checks if you talked or gifted them.
On the talk "tab" a random message is picked just randomly.
BUT if we want it so that some of those random messages can't get randomly chosen until later we gotta make sure that those can't be picked.
Imagine that before any reputation you can get 3 messages. Simple, pretty much what I explained. Now say that this person will love you dearly after 3 gifts.
So before the randomizer (variable operations set random 1-3) we add a conditional branch that checks the value of the affection. Let's call this "npc love".
So the branch checks if love is greater than or equal to 3 (which is max) and if so the randomizer is 1-6.
Next up in the else case is a check that sees if it's equal to 2. If it is, set random 1-5.
Another one that checks if it's equal to 1. 1-4.
And then the very last else case is what is normal now: 1-3.

Add your messages with random preconditions between 1 and 6 and it should be done.
If no affection is raised only 3 messages can be picked. Then each point in NPC love grants one extra message.

And then to raise this mystical NPC love you need to add one of those "variable operations: NPC love +1" at the end of the gift-giving "tab".
That way the value will increase by one each time you give a gift and after 3 all messages are available.

Note: Of course you could make each gift give 1 point but the "stages" of affection being something such as: 10, 20, 30. Or something.

__________________________________-
Next question about showing the value of a variable.

The code is:
 
Quote
/v[n]   Displays the value held in variable n, n being any numerical value.

So instead of "n" you add the numeric value the variable NPC love have in the index-list-thingy. Put that in a message and it will display the value of the variable.
If it's 256, it will be 256 when used in a message.
Logged
Cool RPGM Project!
Sprite till you die

Oh my god, this was ...10 years ago...

Offline evmaster

  • Member
  • Associate
  • *
  • Posts: 231
Re: Input Keys Question
« Reply #10 on: July 10, 2012, 09:42:59 PM »
Wow. You are really good at this. Too bad I am kinda lost. lol Would it be too much to ask for a Prnt screen of this part? The part where the NPC likes you more and says different things?

Maybe even with the Key Input process as I am having trouble... :(

I tried putting it before the random messages 1 to 3 and now the Key Input Process doesn't seem to work. I wonder if this whole thing is even possible. lol

 :happy:
Logged

Offline Prpl_Mage

  • Administrator
  • Sage
  • *
  • Posts: 7,645
  • The Administrator Mage
    • Check out our itch website
Re: Input Keys Question
« Reply #11 on: July 11, 2012, 05:54:56 PM »
Will get around actually coding it in a day or two. Just spoke out of theory. As in. How it would be done. Very much doable. Keep trying or wait till then.
Logged
Cool RPGM Project!
Sprite till you die

Oh my god, this was ...10 years ago...

Offline evmaster

  • Member
  • Associate
  • *
  • Posts: 231
Re: Input Keys Question
« Reply #12 on: July 11, 2012, 07:54:39 PM »
Okay thanks. You guys have been great. :D
Logged

Offline Prpl_Mage

  • Administrator
  • Sage
  • *
  • Posts: 7,645
  • The Administrator Mage
    • Check out our itch website
Re: Input Keys Question
« Reply #13 on: July 13, 2012, 10:53:17 PM »
Well this should do it. Note that I didn't use shift, I used the 1 button instead for gift-giving.
(Couldn't find where to activate shift, where do you do that anyway? There's like 1-4 for movement keys, 5 for decision key and 6 for cancel. Then there's 10-19 for numberkeys and 20-24 for the weird buttons.)


So first it checks what button is pressed, then it checks your affection in the talk part. If the affection is higher than 10 it might give 2 additional messages, with 5 or more just 1 additional. Then in the end stuff is turned off.
Logged
Cool RPGM Project!
Sprite till you die

Oh my god, this was ...10 years ago...

Offline A Forgotten Legend

  • Your neighborhood box of colors
  • Royal
  • *
  • Posts: 4,428
    • Website
Re: Input Keys Question
« Reply #14 on: July 14, 2012, 04:04:30 AM »
@ prpl its 7
Logged

  • Print
Pages: [1] 2 3
« previous next »
  • Charas-Project »
  • Game Creation »
  • Requests »
  • RPG Maker Programming »
  • Input Keys Question
 

  • SMF 2.0.10 | SMF © 2015, Simple Machines
  • XHTML
  • 2O11
  • RSS
  • WAP2
  • Simple Machines Forum