I need some help from the Exult gurus...
I need to make a few trainer npcs for my mod but I havent quite mastered how to make conversation code where you talk to the npc and when you click the 'train' option, it will populate the answers with names of party members, then train that party member with the attributes needed.
I can do this individually, but it would require way too much code for every prospective party member in my mod. I need it to function as mentioned above, where all I have to do is click on 'train' and it populates the party member names. anyone know how?
creating a trainer npc
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
-
- Posts: 565
- Joined: Thu May 14, 2020 1:34 pm
creating a trainer npc
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Re: creating a trainer npc
Here is the cleaned up version of the relevant sections in Rayburt's usecode, using constants defined in Keyring headers:
Code: Select all
// Somewhere before the function
extern var askYesNo 0x90A();
extern RayburtTrain 0x8D0 (var statArray, var goldCost);
void Rayburt object#(0x44C) ()
{
// Some code
var sched = item->get_schedule_type();
// More code
if (sched == SPAR)
{
say("@I charge 60 gold for a session, but thou wilt benefit greatly. Is this agreeable?@");
if (askYesNo())
RayburtTrain([DEXTERITY, INTELLIGENCE, COMBAT], 60);
else
say("@It is not the first time I have been accused of being too expensive.@");
}
else
{
say("@Please come to my studio during business hours if thou wishest to train.@");
UI_remove_answer("train");
}
// More code
} // End of Rayburt
extern var getAvatarName 0x0908();
extern var getNPCName 0x90F (var npc);
extern var getNPCStat 0x910 (var npc, var stat);
extern void trainStrength 0x914 (var npc, var delta);
extern void trainDexterity 0x915 (var npc, var delta);
extern void trainIntelligence 0x916 (var npc, var delta);
extern void trainCombat 0x917 (var npc, var delta);
extern void trainMagic 0x918 (var npc, var delta);
extern var selectWhoTrains 0x920 ();
extern var checkCanTrain 0x922 (var statArray, var goldCost, var npc, var numTraining);
RayburtTrain 0x8D0 (var statArray, var goldCost)
{
var pronoun;
var npc = selectWhoTrains();
var name = getNPCName(npc);
var verb = "feels";
var avname = getAvatarName();
if (name == avname)
{
name = "you";
pronoun = "you";
verb = "feel";
}
else
{
if (npc == JULIA || npc == JAANA|| npc == KATRINA)
pronoun = "her";
else
pronoun = "him";
}
if (npc)
{
var ret = checkCanTrain(statArray, goldCost, npc, 3);
if (ret == 0)
say("@I am sorry, but thou dost not have enough experience to train at this time. Return at a later date and I would be most happy to lead a session.@");
else if (ret == 1)
{
var partyGold = UI_count_objects(PARTY, SHAPE_GOLD, QUALITY_ANY, FRAME_ANY);
if (partyGold < goldCost)
say("@It seems that thou hast not enough gold. Do return when thou art a bit wealthier.@");
}
else if (ret == 2)
say("@I am amazed! Thou art already as experienced as I! Thou cannot be trained further by me.@");
else
{
UI_remove_party_items(goldCost, SHAPE_GOLD, QUALITY_ANY, FRAME_ANY, true);
say("Rayburt takes your money. @The session shall begin.@");
say("Rayburt first instructs ", name, " to lie on the floor and relax. He teaches ", pronoun,
" breathing exercises and techniques with which to cleanse the mind of all thoughts.");
say("After a while, he asks ", pronoun, " to stand up and illustrates balance and control, relating it to meditation and concentration.");
say("Finally, he demonstrates several good moves involving hand-to-hand combat, and combat using a sword. By the end of the hour, ",
name, " ", verb, " much more knowledgeable and proficient in this unusual form of fighting.*");
if (getNPCStat(npc, DEXTERITY) < 30)
trainDexterity(npc, 1);
if (getNPCStat(npc, INTELLIGENCE) < 30)
trainIntelligence(npc, 1);
if (getNPCStat(npc, COMBAT) < 30)
trainCombat(npc, 1);
}
}
}
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
-
- Posts: 565
- Joined: Thu May 14, 2020 1:34 pm
Re: creating a trainer npc
Thanks Marzo!
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/