Chaos Project

RPG Maker => General Discussion => Troubleshooting / Help => Topic started by: danesopeezy89 on December 26, 2008, 01:49:04 pm

Title: NPC say you name
Post by: danesopeezy89 on December 26, 2008, 01:49:04 pm
I want to make a game when you can put in your own name so the NPC's can say it but I just want to know how do I  make the NPC's say the name that you put?
Title: Re: NPC say you name
Post by: Starrodkirby86 on December 26, 2008, 02:06:06 pm
In a message box, write in \n[ID of actor]. So if you want the NPC to say Actor 1's name, you put:

Hello \n[1], how are you doing?

If Actor 1's name is...Johnathan, then it'll change to:

Hello Johnathan, how are you doing?


To see if it works, do a message preview. For further help, use the RMXP Help file and view Messages.
Title: Re: NPC say you name
Post by: danesopeezy89 on December 26, 2008, 03:05:04 pm
alright. thanks  :)
I got another question. Can a NPC say how much EXP you need? just curious  :uhm:

No double-posting within 24 hours. :d ~Love, Starrodkirby86
Title: Re: NPC say you name
Post by: Starrodkirby86 on December 26, 2008, 03:52:30 pm
For that you would need to do some Variable Work.

Make a command like this, preferably before the Message Box with the Variable:
Control Variables: [0000: Name] = [Actor]'s EXP

Then make a Message Box like this:

Hello, \n[1]. You have \v[0] EXP.

Pretend \v[0] = ^^^.

So if \n[1], named Johnathan, has 40 EXP, then it'll look like this:

Hello, Johnathan. You have 40 EXP.

Hope that helps.
Title: Re: NPC say you name
Post by: Hellfire Dragon on December 27, 2008, 07:11:31 am
QuoteCan a NPC say how much EXP you need?

So you mean how much exp you need until you get to next level?
Title: Re: NPC say you name
Post by: Starrodkirby86 on December 27, 2008, 12:45:14 pm
Ahh, didn't notice that. :P Thanks HD...

There's probably a more simple to do this, but this is a way I thought of.

If the hero has only one experience curve (Which he should unless you're using multiple actors that can possibly be the hero), then you'll have set values that'll be the maximum amount of experience needed to get to the next level.

You can either do some variable work by having this "EXP at level up" value subtract by the "EXP hero has" value, or you can just have a message box saying:

You have \v[00] experience out of 30000.

Here's where I'm doing a probably obsolete not optimal method, so bear with me here. -_-;
Now to set different levels you need to do a lot of Conditional Branches and you need to record the level of the hero. Recording the level of the hero is just a simple variable operation. Let's say that variable is \v[05].

So it'll be...
Control Variables: [0005: Level] = [Actor]'s Level
Conditional Branch: Variable [0005] == 1
Message Box: \n[01], you have \v[0] experience out of a total 16 experience.
Else
Conditional Branch: Variable [0005] == 2
  Message Box: \n[01], you have \v[0] experience out of a total 50 experience.
Else
etc.

etc.

etc.

So yeah...But there must be an optimal way.  :^_^':
Title: Re: NPC say you name
Post by: Aqua on December 27, 2008, 01:08:05 pm
Orrrr... you could do this :P

Script code:
$game_variables[NUM] = ACTOR.next_rest_exp_s


Of course, you'd have to define which actor you wish to show by using
$game_actors[ID]     or
$game_party[ID]

So if you want the 1st actor in the DB, it'd be.
$game_variables[NUM] = $game_actors[1].next_rest_exp_s



Then just use the \v[NUM] to call the number.
Title: Re: NPC say you name
Post by: Blizzard on December 27, 2008, 03:41:47 pm
Just keep in mind that you should assign a number to the variable after you are done with it using Aqua's code.