Page 1 of 1
How to use a non-map Entity with a Chat dialog?
Posted: Wed Apr 11, 2018 4:21 am
by Zizzo
So, in my T2 module I occasionally have need of an NPC entity for a chat dialog that doesn't correspond to anything on the map — Liron from the Invasion of Gondolin quest, for instance. So far I've just been cobbling together Entities on the fly, like so:
Code: Select all
local npc = Actor.new {
name = [[Liron, rider of Tolan]],
display = 'B',
color = colors.C_U,
image = 'npc/bronze_thunderlord.png',
}
but the results are aesthetically unsatisfying:

- liron.png (55.57 KiB) Viewed 8829 times
Is there some magic I can do to this
ad hoc Entity to give it a proper display like the player's? I'm eyeing Entity:makeMapObject() or something related thereto, but the comments on that method are adamant that I don't want to touch it, so I'm hesitant.

Re: How to use a non-map Entity with a Chat dialog?
Posted: Wed Apr 11, 2018 9:05 am
by darkgod
And the comments are right, Entity:makeMapObject() should really be considered offlimits if you dont want stuff to explode in your face
As for your problem you mean to say the problem is that Liron is too small a letter ?
You can fix that by superloading dialogs.Chat:init and changing the ActorFrame initializations to pass in addition to their parameters:
That's because your level tiles is configured rather differently from the rest.
Ther superloading is not that great and at an addon level i'd scream bloody murder but at a mod level it's only jsut super fugly

I'll tyr to think of a way to let you do that more easily in the future
Re: How to use a non-map Entity with a Chat dialog?
Posted: Thu Apr 12, 2018 12:15 am
by Zizzo
darkgod wrote:As for your problem you mean to say the problem is that Liron is too small a letter ?
You can fix that by superloading dialogs.Chat:init and changing the ActorFrame initializations to pass in addition to their parameters:
[sound F/X: source diving] Ah, okay, yeah, I think I know how to get that wedged in there. Thanks.
darkgod wrote:That's because your level tiles is configured rather differently from the rest.
…? Am I doing it wrong?
darkgod wrote:Ther superloading is not that great and at an addon level i'd scream bloody murder but at a mod level it's only jsut super fugly

(shrug) No worries; I already had to
do surgery on the chat dialog to get it to work with ActorTalents:talentDialog(). And you probably don't want to know what I've done to the Map…

Re: How to use a non-map Entity with a Chat dialog?
Posted: Thu Apr 12, 2018 1:08 am
by darkgod
…? Am I doing it wrong?
Na
As for chat and talents, why ? It already works fine. Example in the rogue's artifices code:
Code: Select all
action = function(self, t)
local chat = Chat.new("artifice", self, self, {player=self, slot=3, chat_tid=t.id, tool_ids=artifice_tool_tids})
local d = chat:invoke()
d.key:addBinds{ EXIT = function()
game:unregisterDialog(d)
end}
local tool_id, m_id = self:talentDialog(d)
artifice_tools_setup(self, t)
self:updateModdableTile()
return tool_id ~= nil -- only use energy/cooldown if a tool was prepared
end,
Re: How to use a non-map Entity with a Chat dialog?
Posted: Thu Apr 12, 2018 3:12 am
by Zizzo
darkgod wrote:As for chat and talents, why ? It already works fine.
[sound F/X: source diving] Well, yeah, for a single-stage chat, I don't doubt it. When you get into chats with multiple jumps, though, like
my "do-you-really-want-to-wear-the-One-Ring?" chat, the special unload() method gets lost unless you propagate it manually across Chat:regen().
Re: How to use a non-map Entity with a Chat dialog?
Posted: Thu Apr 12, 2018 7:51 am
by darkgod
Ahhh yeah
