StartDialogConversation enhancements

EQ2Emulator Development forum.

Moderator: Team Members

Post Reply
User avatar
thefoof
Retired
Posts: 630
Joined: Wed Nov 07, 2012 7:36 pm
Location: Florida

StartDialogConversation enhancements

Post by thefoof » Sun Aug 11, 2013 10:03 pm

Okay, just posting to let yall know I finished up the cragged spine quests in frostfang today (Sometimes you feel like a knut was the most pain in the ass quest to script. ever.) Also I figured out why single item rewards were't showing - the queries in WorldDatabase.cpp were checking for subtype "Items", when we've always used it looks like (since milestone 1), "Item", so I fixed that.

EDIT: Looks like we don't support players having conversations with themselves so until that happens this quest won't work right.
Last edited by John Adams on Tue Aug 13, 2013 4:17 pm, edited 1 time in total.
Reason: Moved from private design forum

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: DB Milestone 2 - Planning

Post by Jabantiz » Sun Aug 11, 2013 11:38 pm

thefoof wrote:EDIT: Looks like we don't support players having conversations with themselves so until that happens this quest won't work right.
Have a fix for this just need to do a quick test to make sure nothing unexpected pops up.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: DB Milestone 2 - Planning

Post by Jabantiz » Mon Aug 12, 2013 12:39 am

I can start a conversation through an item or NPC with the player talking to themselves, however that is as far as the current system will allow us to go as the server will look for the call back function in the players spawn script...

A simple solution could be to hardcode players to have a spawn script, something like player.lua, then in that script we can have the call back functions.

Another solution could be to attempt to expand StartDialogConversation() lua function to take a third type for conversations like this and have the call back functions in the item/spawn script that starts this type of conversation.

Let me know which you all prefer or if you have another idea how to get past this limitation

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: DB Milestone 2 - Planning

Post by John Adams » Mon Aug 12, 2013 8:05 am

Jabantiz wrote:Another solution could be to attempt to expand StartDialogConversation() lua function to take a third type for conversations like this and have the call back functions in the item/spawn script that starts this type of conversation.
I'm liking this option. "hard coding" never leaves me feeling happy.

User avatar
thefoof
Retired
Posts: 630
Joined: Wed Nov 07, 2012 7:36 pm
Location: Florida

Re: DB Milestone 2 - Planning

Post by thefoof » Mon Aug 12, 2013 1:35 pm

Jabantiz wrote:Another solution could be to attempt to expand StartDialogConversation() lua function to take a third type for conversations like this and have the call back functions in the item/spawn script that starts this type of conversation
Yep that sounds good to me too.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: DB Milestone 2 - Planning

Post by Jabantiz » Mon Aug 12, 2013 2:56 pm

Ok implemented the second option and it all seems to work, added a type = 3 and 4, 3 = spawn starts the self convo, 4 = item starts the self convo. Also want to remind you this is StartDialogConversation and not StartConversation. (StartDialogConversation is typically used for the blue box dialogs you get from item examines)

Code: Select all

-- Self convo started through a spawn
StartDialogConversation(conversation, 3, NPC, Player, "Test Dialog")
-- Self convo started through an item
StartDialogConversation(conversation, 4, Item, Player, "Test Dialog")
EDIT: Code committed

User avatar
thefoof
Retired
Posts: 630
Joined: Wed Nov 07, 2012 7:36 pm
Location: Florida

Re: DB Milestone 2 - Planning

Post by thefoof » Mon Aug 12, 2013 6:23 pm

Jabantiz wrote:Ok implemented the second option and it all seems to work, added a type = 3 and 4, 3 = spawn starts the self convo, 4 = item starts the self convo. Also want to remind you this is StartDialogConversation and not StartConversation. (StartDialogConversation is typically used for the blue box dialogs you get from item examines)

Code: Select all

-- Self convo started through a spawn
StartDialogConversation(conversation, 3, NPC, Player, "Test Dialog")
-- Self convo started through an item
StartDialogConversation(conversation, 4, Item, Player, "Test Dialog")
EDIT: Code committed
Okay I played around with this today, I can get the bubble for the first conversation to appear, but when selecting an option it doesn't pass you on to the next function for some reason.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: DB Milestone 2 - Planning

Post by Jabantiz » Mon Aug 12, 2013 7:34 pm

This is the spawn script I used to test this out and it all worked properly, can you try this on your side and see if it works?

Code: Select all

function hailed(NPC, Player)
	FaceTarget(NPC, Player)
	conversation = CreateConversation()

	AddConversationOption(conversation, "Test 1", "Choice1")
	AddConversationOption(conversation, "Exit")
	StartDialogConversation(conversation, 3, NPC, Player, "Test Dialog")
end

function Choice1(NPC, Player)
	con = CreateConversation()
	
	StartDialogConversation(con, 3, NPC, Player, "End Test")
end

User avatar
thefoof
Retired
Posts: 630
Joined: Wed Nov 07, 2012 7:36 pm
Location: Florida

Re: DB Milestone 2 - Planning

Post by thefoof » Tue Aug 13, 2013 2:07 pm

That script works, I've done some more testing though and I think I know the jist of what's going wrong.

The first bubble will always get called as long as you're using valid pointers, however when the server tries to call the passed function from the conversation option it won't go through if you are'nt close to the spawn that started the convo (it seems anyway).

The scripts I was trying were using item pointers to start the conversation as well so maybe there's some kind of range check when calling the next conversation function?

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: DB Milestone 2 - Planning

Post by John Adams » Tue Aug 13, 2013 3:48 pm

You guys mind if I split this topic into it's own so it doesn't get lost in here?

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: DB Milestone 2 - Planning

Post by Jabantiz » Tue Aug 13, 2013 4:12 pm

Go ahead, would probably be good for it to end up in a public forum.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: DB Milestone 2 - Planning

Post by Jabantiz » Sun Aug 25, 2013 11:15 pm

thefoof wrote:That script works, I've done some more testing though and I think I know the jist of what's going wrong.

The first bubble will always get called as long as you're using valid pointers, however when the server tries to call the passed function from the conversation option it won't go through if you are'nt close to the spawn that started the convo (it seems anyway).

The scripts I was trying were using item pointers to start the conversation as well so maybe there's some kind of range check when calling the next conversation function?
I was randomly looking at scripts today when I looked in frostfang.lua and saw this

Code: Select all

function GrizChat1(Zone, Spawn)
	if GetQuestStep(Spawn, SometimesKnut) == 1 then
		if HasItemEquipped(Spawn, 157116) then
			conversation = CreateConversation()
			AddConversationOption(conversation, "Ack!  I can hear you?", "GrizChat2")
			StartDialogConversation(conversation, 4, GetEquippedItemByID(Spawn, 157116), Spawn, "Prey's trail cold here.")
		end
	end
end

function GrizChat2(Zone, Spawn)
	conversation = CreateConversation()
	AddConversationOption(conversation, "I will never doubt him again.")
	StartDialogConversation(conversation, 4, GetEquippedItemByID(Spawn, 157116), Spawn, "Yes.  Griz real.  Knut's friend.")
end
While GrizChat1 is correct GrizChat2 should not be in the zone script as it is a callback function, it should be in an item script assigned to the item passed in the StartDialogConversation(). It should also be GrizChat2(Item, Spawn) as it is a call back in an item script.

All callback functions should be in the script assigned to the spawn or item given in StartDialogConversation()

User avatar
thefoof
Retired
Posts: 630
Joined: Wed Nov 07, 2012 7:36 pm
Location: Florida

Re: DB Milestone 2 - Planning

Post by thefoof » Sun Aug 25, 2013 11:49 pm

Jabantiz wrote:While GrizChat1 is correct GrizChat2 should not be in the zone script as it is a callback function, it should be in an item script assigned to the item passed in the StartDialogConversation(). It should also be GrizChat2(Item, Spawn) as it is a call back in an item script.

All callback functions should be in the script assigned to the spawn or item given in StartDialogConversation()
Okay just to be sure I understand that, running a conversation through an NPC or item whatever, when the function is called from a conversation option, it gets sent to the script on the NPC/item that initiated the conversation?

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: StartDialogConversation enhancements

Post by Jabantiz » Mon Aug 26, 2013 1:01 am

That is correct

User avatar
thefoof
Retired
Posts: 630
Joined: Wed Nov 07, 2012 7:36 pm
Location: Florida

Re: StartDialogConversation enhancements

Post by thefoof » Mon Aug 26, 2013 3:54 pm

Thanks for the help Jab, reworked the quest scripts last night and this works great now :D

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests