• How would I get a NPC to print a sentance to chat?
    6 replies, posted
I have the LUA capablities of a Brick wall, But I want to try and improve. But how would I get an SNPC/entity to say something in chat, If its possible?
Have a look at [url="http://wiki.garrysmod.com/page/Global/PrintMessage"]HUD_PRINTTALK[/url], bear in mind that it's used like [code] ply:PrintMessage(HUD_PRINTTALK, "Hello You!") [/code] so to print for all players you could use something like, [code] for k,v in pairs(player.getAll()) do v:PrintMessage(HUD_PRINTTALK, "Hello guys!") end [/code] Not sure if that code works, but have a go, do you know how to create NPC's using NextBot?
Im just basing it off the npc_tf2_ghost and changing/adding things to it. Im trying to learn Java, as ive heard there near the same.
They're not really. Don't stretch yourself over two languages at the same time or you'll get confused. LUA is pretty good to start with, but so is java. Just start with whatever is the most applicable to you.
They're not really the same, I would compare lua to python, but it's not like that much either. You don't have typed variables in Lua, so to speak, you can assign a variable that was recently an integer a string value, or even turn it into a table. I think this makes a big difference when programming. I've seen places that have compared Lua to C, but I don't really see that comparison.
Well er, Any good places to learn LUA then?
[url]http://facepunch.com/showthread.php?t=1271252[/url] Full NPC with dialogs here. It might be a flippin maze trying to read as a non-lua person. But perhaps you could rip it apart and use whatever modules you need?
Sorry, you need to Log In to post a reply to this thread.