Page 1 of 1

WorldNPC.lua - chat on bumpInto

Posted: Tue Jan 27, 2015 9:52 am
by Dao Zeti
mod/class/WorldNPC.lua: function _M:bumpInto(...) checks for NPCs with the ability to talk (at the moment, there aren't none, as adventurers/patrols/zigur followers can't talk, so this isn't really problematic); however, the environment for Chat (local Chat = require "engine.Chat") is missing.

Code: Select all

function _M:bumpInto(target, x, y)
...
		-- Talk ?
		if target.player and self.can_talk then
			local chat = Chat.new(self.can_talk, self, target)
			chat:invoke()
			if self.can_talk_only_once then self.can_talk = nil end
...

Re: WorldNPC.lua - chat on bumpInto

Posted: Tue Jan 27, 2015 10:13 am
by HousePet
Well it somehow works for the hermit alchemist?

Re: WorldNPC.lua - chat on bumpInto

Posted: Tue Jan 27, 2015 10:19 am
by Dao Zeti
Well, the hermit doesn't bumpInto you - instead you activate the chat, I believe? At least I encountered an error when creating caravans (WorldNPCs like neutral patrols that offer you a trade) for the bazaar mod and had to superload the chat part of the function.

Re: WorldNPC.lua - chat on bumpInto

Posted: Tue Jan 27, 2015 10:43 am
by darkgod
fixed