usecode question on healers

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

usecode question on healers

Post by agentorangeguy »

I've been doing some work on healers in the U6 mod. I tried going the route with the services.uc but it didn't seem to function properly for me, so I am ready to do something different.

I made a healer who can heal, cure, and resurrect. The problem is, the code is very 'clunky' and I'm basically having to do seperate code stuff for each potential companion. For example, to heal Iolo, my code checks to see if Iolo is there in the party, checks his health, if needing healed you pay the gold and heal him. here is an example of what I'm talking about:

Code: Select all

iolohealth = UI_get_npc_prop(IOLO, HEALTH);
iolostr = UI_get_npc_prop(IOLO, STRENGTH);
iolofullhealth = (iolostr - iolohealth);

var healoptions = ["yourself", "no one"];

if (isNearby(IOLO)) healoptions = healoptions & "Iolo";

				converse(healoptions)
				{
				case "Iolo"(remove):
					if  (iolohealth <  iolostr)
						{
						say("@I see thy injury, Iolo. It will cost you 30 gold, interested?@");
							if (askYesNo())
								{
								if (hasGold(30))
									{
									say("Dezana approaches Iolo and binds the wounds.");
									chargeGold(30);
									UI_set_npc_prop(IOLO, HEALTH, iolofullhealth);
									}
									else say ("@You must pay before I can heal you.@");
	
								}
								else say("@Very well.@");
						}
						else say("@You look fine to me.@");

} 
This functions fine from what I remember, but I want to avoid having to do this for each and every potential party member. Is there an easier way to do this: talk to the healer and if (random party member) is in your party, his/her name is automatically populated in the list of party members to heal/cure.? Let me know if I need to clarify anything... I'd just like to avoid having to do unneccessary code if there is an easier way to make healers, and hopefully this will be helpful when I make trainers too.
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
VisElEchNon
Posts: 59
Joined: Thu May 14, 2020 1:34 pm

Re: usecode question on healers

Post by VisElEchNon »

There's this: UI_get_party_list () at http://web.archive.org/web/200509141119 ... efehle.htm

That might make things a bit easier... but I'm not sure. I just did a quick 15 minute scan of the documentation I could easily find.
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: usecode question on healers

Post by Wizardry Dragon »

Go through the UI_get_party_list() and output the names. There's several examples in the TFL usecode if you need help with it but I can't remember offhand where.

Cheers,
Wizardry Dragon
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Malignant Manor
Site Admin
Posts: 985
Joined: Thu May 14, 2020 1:34 pm

Re: usecode question on healers

Post by Malignant Manor »

"tfl\patch\src\misc\services.uc" has serviceHeal function.
agentorangeguy
Posts: 565
Joined: Thu May 14, 2020 1:34 pm

Re: usecode question on healers

Post by agentorangeguy »

Thanks guys. I looked at the UI_get_party_list but wasn't sure how to go about using it. Do you remember any specific examples I should look at Wizardry?

i initially used the services.uc.... but I had to comment out several lines dealing with magic because it wasn't compiling right. i just want the standard healing, curing, and resurrecting. I changed the dialogue a little to match my healers, but it seemed to mess things up where they'd say the 2nd and 3rd lines at the same time: "this costs whatever amount." "you don't have the money" or something like that.

If someone knows how to carve services.uc down to the bare minimum as far as healing, curing, and resurrecting scripts go, let me know. I just need basic services, no spells or magic stuff that was added to the other mods. Thanks!
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: usecode question on healers

Post by Wizardry Dragon »

The services.uc module only contains the code for the conversations, you also need the spell circle uc modules, as they contain the actual spell code.

Cheers,
Wizardry Dragon
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
agentorangeguy
Posts: 565
Joined: Thu May 14, 2020 1:34 pm

Re: usecode question on healers

Post by agentorangeguy »

when i try to compile, I get all sorts of error messages. Most of which say thigns like 'getSpellCircle, getIndexForSpell, NECROMANCER, MAGE_CLASS, BARD_CLASS and so on aren't declared. What files are these located so I can add them in?
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: usecode question on healers

Post by Wizardry Dragon »

The entire /tfl/src/spells tree is neccesary for the spells to work. It would not be difficult to section out the healing specific stuff, but this would be redundant for TFL since we have redone all of the spells.

Specifically,

http://u7feudallands.cvs.sourceforge.ne ... rc/spells/

Cheers
Peter M Dodge
aka Wizardry Dragon
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Locked