ID:167624
 
Hello, how can I make it that I can right-click on an NPC and clikc talk and then an alert comes up and it says what it wants. I tried a couple different ways but there were some kind of errors that I couldn't fix. Thanks.
Well, if you have your NPC's as objects, then it's like this:
/obj/NPC
name = "NPC"
verb
Talk()
usr << alert("Hello, I'm an NPC!")

Whenever you have 'verb' under another thing, like '/obj/NPC', the verb will belong to the other thing, so it appears when you right click the NPC or something.
In response to Seraphrevan
Seraphrevan wrote:
Well, if you have your NPC's as objects, then it's like this:
> /obj/NPC
> name = "NPC"
> verb
> Talk()
set src in oview(1)//when 1 tile away from, the verb shows up..
> usr << alert("Hello, I'm an NPC!")
>

Whenever you have 'verb' under another thing, like '/obj/NPC', the verb will belong to the other thing, so it appears when you right click the NPC or something.

You will also want the verb to show up when within view of any amout on tiles.
In response to Mecha Destroyer JD
Oh yeah, you don't want people talking from across the screen. Sorry, I'm used to text based games.

[edit] oops, wrong key, I forgot I was logged in as this [/edit]