2DWorlds Forums
Chat. - Printable Version

+- 2DWorlds Forums (http://2dworlds.buildism.net/forum)
+-- Forum: 2DWorlds (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=4)
+--- Forum: Scripting (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=13)
+--- Thread: Chat. (/showthread.php?tid=2293)



Chat. - Bramwell - 04-05-2011

I was wondering how I would go about making a script where if a player says a certain phrase the game would respond. Some help would be appreciated.


RE: Chat. - Scripter - 04-05-2011

(04-05-2011, 10:00 PM)Bramwell Wrote: I was wondering how I would go about making a script where if a player says a certain phrase the game would respond. Some help would be appreciated.

I never tried to make it, but I would guess something like this...

[lua]
link(game.Players.PlayerAdded, function(player)
link(player.Chatted, function(speaker, msg)
if msg == "reset" then
speaker.Character.Health = 0
end
end)
end)
[/lua]

Or something similiar to that. With some testing I could probably get it to work (should the above script not).


RE: Chat. - Bramwell - 04-05-2011

Thank you very much, as I was also looking for one of those scripts, however, what I had in mind was the game replying with a chat message.


RE: Chat. - Scripter - 04-05-2011

If you're thinking about making a talking AI, I would give up. Otherwise, try using the message function.


RE: Chat. - Jacob__mybb_import1 - 04-06-2011

game:chat(color, message)