Code:
Problem description: Well what i was wondering is how could someone(myself)create such a code to where if a player is near a NPC let say right next to them and if the player were to say hello or something then the NPC would say Hello or what ever I want to say. with that being said i mean without them having to rick click or double click or press anything but to have the NPC like read what they say and reply accordingly.
|
Aug 1 2012, 12:40 pm
|
|
A very basic form would be something like this, you can play with it till it suits your needs.
|
In response to GreatFisher
|
|
It didn't work, but maybe i did it wrong here is what i did.
mob npc talker var list/triggers = list("Hi","Hello") response = "Hello." verb NPCTalk(msg as text) for(var/mob/npc/talker/M in oview(2)) if(istype(M, /mob/npc/talker)) if(msg in M.triggers) src << M.response |
First use dm tags when showing code and second I didn't test it I probably should of done.
|
It works perfectly for me. You have to say one of the things in the triggers list exactly correct capitals and all.
|
In response to Joejoe13
|
|
Joejoe13 wrote:
still didn't work How are you testing this? When standing next to the NPC are you saying "hello", or "Hello"? |
I'm Saying Hello
but maybe i have it in my say verb wrong. i have it like this. mob |
mob/verb/say(T as text) |
In response to Liight
|
|
No. Don't try to help.
|
In response to Liight
|
|
Hi Liight,
It is nice to see you are helping other people out, however, when posting a snippet - please do try to use the <DM></DM> tags. In addition, there were some syntax problems in the snippet you provided - such as the "Hello"||"hello" - that's not how you do it. Not to mention that findtext() is NOT case sensitive. When making in interactive talk system, it is best to make a procedure that will parse through the text: User/verb/Say(t as text) You could set it up so a response to a /NPC can hyperlinked which forces the person to Say() that specific message... but you would need to know how to use Topic(). The actual linking is simple:
Talking << {"Why hello there. Do you mind looking for my <a href="?command=talk&msg=BANANA">phone</a>?"
|
I'd like to waylay this conversation a bit for a brief game-design rant.
While yes, it's cool that you can choose what to say to an NPC, it's generally considered a failed gameplay mechanic. It fell out of use in the late 80s and early 90s RPGs. (Notably, the Ultima Avatar saga (4-6). The competing means of communicating with an NPC were the western method of lists of conversation cues. The eastern method was rod-iron communication, in which conversation only has a single topic, which changes according to what part of the game the player is currently engaged in. Obviously, the topic list method and contextual method have won out over the parsed method. This is not to say that you cannot, or should not attempt to use the parsed method, it merely means that players are going to be more familiar with the other two methods of communication with in-game NPCs. Before you implement a feature into a videogame, it is important to ask yourself "Why would I want to?". Novice developers tend to work too hard to bloat their project with unnecessary "You can" features, but neglect to consider "Why would I?". Consider the benefits of this system. The benefits are merely that players are going to be considerably less likely to find secret conversational cues. This can add to the mystery of your world. However, the negatives are quite obvious, and outweigh the benefit. Players are likely to make mistakes. It's going to frustrate your players. It's less accessible to players, and that one negative is enough to really genuinely consider against implementing this feature. Again, I've been around BYOND for going on 11 years now, and watched as developer after developer has bloated their project with unnecessary gameplay mechanics without stopping to consider why those gameplay mechanics are "unique". Being "unique" isn't nearly enough to justify a feature when you are talking about a videogame. One must also consider that "unique" is not always a good thing. Often, something is "unique" in the wrong way, "unique" because no other game developer would implement a feature because it would simply detract from the playability of said game. |