usecode question on healers
Posted: Wed May 30, 2012 11:05 pm
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:
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.
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.@");
}