How to use a non-map Entity with a Chat dialog?

Moderator: Moderator

Post Reply
Message
Author
Zizzo
Sher'Tul Godslayer
Posts: 2517
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

How to use a non-map Entity with a Chat dialog?

#1 Post 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
liron.png (55.57 KiB) Viewed 8802 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. :wink:
"Blessed are the yeeks, for they shall inherit Arda..."

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: How to use a non-map Entity with a Chat dialog?

#2 Post 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:

Code: Select all

tiles=game.level.map.tiles
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
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Zizzo
Sher'Tul Godslayer
Posts: 2517
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: How to use a non-map Entity with a Chat dialog?

#3 Post 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… :twisted:
"Blessed are the yeeks, for they shall inherit Arda..."

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: How to use a non-map Entity with a Chat dialog?

#4 Post 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,
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Zizzo
Sher'Tul Godslayer
Posts: 2517
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: How to use a non-map Entity with a Chat dialog?

#5 Post 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().
"Blessed are the yeeks, for they shall inherit Arda..."

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: How to use a non-map Entity with a Chat dialog?

#6 Post by darkgod »

Ahhh yeah ;)
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Post Reply