hello everyone. first, i would like to thank all of your for your responses. this is a huge undertaking for me, and every bit of help i get is GREATLY appreciated! now, id like to talk about some of the things you guys suggested. before we (hopefully) talk more about it, id like for you guys to understand how the NPC interaction will work.
first, when a user clicks "T" by an NPC, he will talk to this NPC. this is what happends
The game screen disapears, and a chat GUI pops up. the user is presented with dialogue choices. heres what it will look like (from the game Shadowrun on the Genesis)
(when the player walks up to an NPC, and presses the chat button, this is the initial screen)
now, when i choose "looking for information", this is the next screen that popped up
do you see how it works? basically, it keeps going on like this. conversations could get deep. also, like Radup did in his RPG (and what i want to do), is depending on the state of the game, the chat could be different. for example, say you go to an NPC to give you a job. a random job will be picked and given to you. now, you have to go do that job. when you talk to that NPC again, if you completed the job, you will get paid. if you didnt complete the job, he wont pay you and might be a little mad...
even more complex, is there is a non-linear plot that un-ravels when talking to NPC's. depending on what NPC's you talk to, more and more of the plot will un-ravel. so if you talk to NPC A, he might give you no info. if you talk to NPC B, he'll give you some info. when you go back to NPC A, you can now talk about what NPC B told you about. and NPC A will now give you info.
i have no idea how to accomplish such a thing. i can come up with a system where an NPC will have a static dailogue, which is what i posted in the first post. (ie the dialogue tree will be in a .txt file and read in when the user chats with the NPC). but how do i make it dynamic, where the dialogue will branch differently depending on what ive done, who ive talked to, the state of the game, etc?
Quote:
Original post by Raduprv
In Eternal Lands I made all the NPCs to be scriptable. Basically, when you click on an NPC, you get a message from the server with the following info:
1. NPC name
2. NPC portrait
3. NPC welcome text
4. A list of responses (if any)
Any response in that list has an ID.
For example?
Hi = 1
Have any job? = 2
Bye = 3
When the player clicks on a response, the ID of that response is sent back to the server, and the script takes control of the program.
There is a function called respond_npc(player, response_id)
inside that function there is something like (pseudocode):
if(response==1)print(Hi, nice meeting you)
if(response==2)
if(player completed all the quests)print(no, no job now, sorry)
else print(yeah, I have a job...)
And so on.
ok, but, how is this different from what i posted? basically, im doing the same exact thing. the user is presented with choices, and the choices can result in responses / actions...
@visage:
ok, so that tree struct will be how ill manage all the dialogue? basically, an NPC will have a pointer to a tree? why a pointer, though?
then, each tree will contain a string for that dialogue, and a pointer to the next dialogue? also, is this just a linked list? your example is in C, but im using C++. i could see doing this with a simple std::list Tree, i think. also, like i mentioned earlier, im going to be using Python for scripting. so maybe i would manage all the dialogue in Python? (ie the tree struct would be a Python class instead...)
@etnu:
in my first post, i said i was using text files. i know there are C++ and Python libs which can use XML. im dont really want to use XML (yet) though, because im already trying to learn Python, how to bind it to C++, AND how to manage this huge system. adding XML will just make my brain explode =)
thanks a lot guys for anymore help!!!