Page 1 of 1

usecode question on healers

Posted: Wed May 30, 2012 11:05 pm
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.

Re: usecode question on healers

Posted: Thu May 31, 2012 12:23 am
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.

Re: usecode question on healers

Posted: Thu May 31, 2012 12:58 am
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

Re: usecode question on healers

Posted: Thu May 31, 2012 1:07 am
by Malignant Manor
"tfl\patch\src\misc\services.uc" has serviceHeal function.

Re: usecode question on healers

Posted: Thu May 31, 2012 8:54 am
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!

Re: usecode question on healers

Posted: Thu May 31, 2012 3:19 pm
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

Re: usecode question on healers

Posted: Fri Jun 01, 2012 1:42 pm
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?

Re: usecode question on healers

Posted: Fri Jun 01, 2012 2:34 pm
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