Need help on programming npc dialogue.

Post and discuss creative ideas

Need help on programming npc dialogue.

Postby lazydez » Tue Jul 17, 2012 10:36 pm

Hello all, I'm LazyDez!!! I'm a fur artists at furaffinity.net so feel free to drop by there to see my art. Anyway I'm on here asking a few questions about some programming. I've been working on my own game and want to know basically three things that i could not find help on anywhere. This game will be like a few sim date rpgs or things like that. However there are no stats. You just wander around, talk to the right people and find the items they request or things of that very simple nature. Of course unlocking sex scenes along the way. As an example, it is very similar to high tail hall if you've heard of it.

There are only two things i need help on since i'm not a programmer.

1 - Scripting it so that when you talk to a npc, it will know if you've talked to others and react accordingly.
2 - Scripting it so that if you have an item in your inventory, a npc will react accordingly.

I can figure out the rest most likely. Like i said this will be a very simple game. Search and find and talk type deal. I just need some basic help on the scripting. Once this game's beta is finish you will be properly credited in it as well. If I need more help or just need to pick up a programmer for the game then I will let people know.

If you'd like to help me with this game please notify me through email - [email protected]

If you want compensation of some kind for the help just email me and we'll see what we can do but I'm not well on money enough to pay for a programmer lol.
lazydez
Newly Registered
 
Joined: Tue Jul 17, 2012 10:23 pm

Re: Need help on programming npc dialogue.

Postby OwnerOfSuccuby » Wed Jul 18, 2012 9:35 pm

Hello, i can tell you a little how to make it - it is not hard to learn it. Sorry for my bad English.

First - if you want to make it fast it is much more comfortable to use AS2 (Action Script 2) - if you want to make it on flash.

For game like this you will need 4 things:
1)Loader - that loads your game and say that it is loaded. You can take it for example from LoK game or if you want i can post code and example of it on this week ends (have some work now so can not post more on monday-friday :roll: :( )

2)You have to know hot to use buttons, goto and stop (play) some fraim.

a)Buttons - are the same code each time ib buttons: on (click) {there must be some action - for example gotoAndStop(2);}

b)gotoAndStop('FramesName');/gotoAndPlay('FramesName'); Let you to go to some frame in your flash. Like in tv recorder - it go to some record and play it or stop and wait your comand.

3)If you need to know did some body talk to NPC and make your desidion based on it - there are this code:

First you need to make variables. For Example:

var Blond1Talk:Boolean=false; It means that you do not speak with blond.

When you do you make this:

Blond1Talk=true;

Than you check - if you do than do some thing like:

write in some button:
on (click){
//You must write == not = in if - it check do not make some body = to some thing
if (Blond1Talk==true) {gotoAndPlay('BlondSayYes');}
if (Blond1Talk==false) {gotoAndPlay('BlondSayNo');}

}

As an example.

4)You have to know how to work with MovieClip objects. And how to make them.

You can read a little about it and more here there are some examples about it:
viewtopic.php?f=29&t=2370

If you will have some questions you can ask me i will try to answer them.

Sorry for my bad English again :roll: :mrgreen:
OwnerOfSuccuby
 
Joined: Fri Jun 11, 2010 9:33 pm

Re: Need help on programming npc dialogue.

Postby KaTsuO_O » Thu Jul 19, 2012 1:17 am

If you're wondering, I'm the same person who commented on the screenshot, just with a slightly different name. I also want to say that it is great that there is a new furry artist on board, that's something we don't see every day. Anyhow, as you should be aware of, I'm also working on a similar project so I think I can provide you with some information. I assume that you're going to use Adobe Flash to create the game. Can't help with ActionScript 3.0 but if you can/are going to use ActionScript 2.0 then I think I can help. I'll also throw in some other goodies that will help you create a more complex interaction system.

There is many different ways to program but I work mostly variables. A variable works like a container that you can put a value, statement or a string (piece of text) in. Before I explain things, you can name a variable whatever you want, as long as you know what each is used for, they're also case sensitive so keep that in mind. Let me give you an example how you can use a variable.

If you want a game where you got money. You create a variable that is called "money" and give it a value of 0 which looks like this, "money = 0;". When you earn money you add a piece of code that says "money += 10;", when you spend money you want it to be "-=" (minus=) instead. If you want to earn the same amount of money each a set amount of money each time you can create a variable that is called "earning" and give it the value. That way you can change things easily without going through a bunch of different codes. Now to statement.

You can use a variable to tell if something is true or false (true;/false;). Let's say you want to add so that you need a key to open a door. You create a variable that is called "gotkey" and give it the statement of false; (gotkey = false;). When you get the key you add a piece of code that says "gotkey = true;". When you click on the door it will check if "gotkey" is true and if that's the case you'll progress, if not something else will happen.

To explain string I'll use the door and key example again. If you want a text to appear when you click on it that says, "You need a key to unlock this door". You could do that simple by adding "text = "You need..."" but you could also add that string in a variable by creating a variable that is called "needkey". You then do the same thing as the other examples "needkeydoor = "You need..."". Now when you got that you can just add "text = needkeydoor;". That way you can speed up the process but you also got better access to your string if you want to change something.

Now you need to know how to add a variable, I assume you know about layers and such. What you want to start with is an empty layer that you call "Actions". If you click on the first frame and then F9 you'll see the Actions panel which is where you want to store code. All you have to do to create a variable is just to write the name, "=", value, statement or string and end it with ";". So, it could look like this "variable = something;"

Now I'll explain how to program the things you need using variables.

You need a code that looks something like this

if (talkedtocarl) {
*Something happen*
} else {
*Something happen*
}

"talkedtocarl" is a variable and it is set to true if you have talked to carl. "if (talkedtocarl)" means that if "talkedtocarl" is true, the following will happen. "else" means that if that's not the case, the following will happen instead. "{" is used to open and "}" is used to close. So as you can see there is one that opens after "if" and one that closes after the first "*Something...*". That means that the "if" only apply to that piece of code, not the rest. if you get errors, make sure that you got an equal amount of both.

Now you can just expand on that, let's say that we want the npc to react differently depending on what she thinks about you. To do that you can create a variable that you call "hannahsmood" and give it the value of 0. "+" would be positive and "-" would be negative.

Let's also say that it is a bad thing that you have talked to carl and that is negative for hannah. What you do is that when you make "talkedtocarl" true you also reduce "hannahsmood". So when you talk with her it can check if she will forgive you or not. It would look something like this

if (talkedtocarl && hannahsmood <= 5) {
*Something happen*
} else if {
if (talkedtocarl && hannahsmood <= 3) {
*Something happen*
} else {
*Something happen*
}

"&&" means "and", it is used to add more than one thing in a "if". There is also "||" which means "or". "<= 5" means that if a variables value is 5 or more. So, it means that if you have talked to carl and she likes you a lot she will forgive you and something more will happen.

"else if" works like a combination of "if" and "else". So, if she only like you a bit then she will only forgive you.


I think that's all I got to give for now. Any questions, please ask.
Don't create a porn game if you're only interested in porn.
Wise words regarding criticism http://www.youtube.com/watch?v=-98ZFl1sKt4
User avatar
KaTsuO_O
 
Joined: Tue Nov 02, 2010 6:03 pm

Re: Need help on programming npc dialogue.

Postby lazydez » Thu Jul 19, 2012 2:58 am

Wow these were just the replies I needed. Thankyou to both of you. katsuoo i sent you a note on fa. Thanks again guys! I have alot fo the moving and whatnot and talking stuff done. Just really couldnt' figure out the variables thing and all that so thankyou all very much!!!
lazydez
Newly Registered
 
Joined: Tue Jul 17, 2012 10:23 pm


Return to Discussion



Who is online

Users browsing this forum: No registered users