Avatar's name in conversations

NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Locked
agentorangeguy
Posts: 565
Joined: Thu May 14, 2020 1:34 pm

Avatar's name in conversations

Post by agentorangeguy »

I'm kind of curious as to how you can actually tell npcs what your avatar name is, like how in the original it would be like :

What is your name?

"your name here", The Avatar

where you could tell them your actual name, or just a generic name. I can get the "name" to populate in the conversation option, but you can't click on it... how do I do this?
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: Avatar's name in conversations

Post by Knight Captain »

At the top of the function, define the variable:

var name;

After listing the variables, define this variable:

name = getAvatarName();

In a say line, you need to escape the string of text to use the variable:

say("@Forgive my rudeness, ", name, ". I fear I am not yet accustomed to the title of SubCommander.@");

If you want to offer the choice, like in Draxinar's conversation:

avatar_or_name = chooseFromMenu(["I am the Avatar", ("I am " + name)]);
if (avatar_or_name == "I am the Avatar")
say("@How interesting.@");
else if (avatar_or_name == ("I am " + name))
say("@I see.@");
agentorangeguy
Posts: 565
Joined: Thu May 14, 2020 1:34 pm

Re: Avatar's name in conversations

Post by agentorangeguy »

I need it in the initial conversation before the npc is officially met. Here's the lines in question:

Code: Select all

	if (!UI_get_item_flag(item, MET))
		{
		item.say("@I am Nomaan. What is thy name, " + polite_title + "?@");
		var avatar_or_name = chooseFromMenu2(["I am the Avatar", ("I am " + player_name)]);
			if (avatar_or_name == "I am the Avatar") 
			item.say("He bows stiffly. @Well met, " + polite_title + ".@");
			
			else if (avatar_or_name == ("I am " + player_name))
			item.say("He bows stiffly. @Well met, " + player_name + ".@");

		UI_set_item_flag(item, MET);	
		}	
The choices will populate and you can click on them, however nothing happens, it just stays on the first line "I am Nomaan.." The regular conversation options (name, job, bye) show up then.
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: Avatar's name in conversations

Post by Knight Captain »

It works if you use chooseFromMenu instead of chooseFromMenu2.

Code: Select all

		if (!UI_get_item_flag(NOMAAN, MET))
		{
			say("@I am Nomaan. What is thy name, ", polite_title, "?@");
			avatar_or_name = chooseFromMenu(["I am the Avatar", ("I am " + player_name)]);

			if (avatar_or_name == "I am the Avatar")
				say("He bows stiffly. @Well met, ", polite_title,".@");
			
			else if (avatar_or_name == ("I am " + player_name))
				say("He bows stiffly. @Well met, ", player_name, ".@");

			UI_set_item_flag(NOMAAN, MET);
		}
agentorangeguy
Posts: 565
Joined: Thu May 14, 2020 1:34 pm

Re: Avatar's name in conversations

Post by agentorangeguy »

I coudln't get it to work, i guess the function wasn't defined anywhere
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: Avatar's name in conversations

Post by Knight Captain »

It may be that everything I do is based off SI, and everything you do is based off BG. This should help:

Code: Select all


var chooseFromMenu 0x956 (var choices)
{
	var selection;

	UI_push_answers();
	add(choices);
	selection = UI_select_from_menu();
	UI_pop_answers();
	return selection;
}

var chooseFromMenu2 0x957 (var choices)
{
	var selection;

	UI_push_answers();
	add(choices);
	selection = UI_select_from_menu2();
	UI_pop_answers();
	return selection;
}
agentorangeguy
Posts: 565
Joined: Thu May 14, 2020 1:34 pm

Re: Avatar's name in conversations

Post by agentorangeguy »

Ah thanks, I'll check it out!
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Locked