Support Healing Mercenary when hp low than what %

Wrote new code? Fixed a bug? Want to discuss technical stuff? Feel free to post it here.

Moderator: Moderators

Message
Author
toro88
Noob
Noob
Posts: 15
Joined: 12 Jul 2008, 05:19
Noob?: No

Support Healing Mercenary when hp low than what %

#1 Post by toro88 »

Version 2.1

in config

Code: Select all

mercenary_healAuto 1
mercenary_hp 70
src\AI\CoreLogic.pm



copy

Code: Select all

proccessslaveHealing(); 
and paste in under processAutoShopOpen();

Code: Select all

	processAutoEquip();
	processAutoAttack();
	processItemsTake();
	processItemsAutoGather();
	processItemsGather();
	processAutoTeleport();
	processAllowedMaps();
	processAutoResponse();
	processAvoid();
	processSendEmotion();
	processAutoShopOpen();

goto CoreLogic.pm lastline before 1;
paste this

Code: Select all

sub proccessslaveHealing {
			if ($config{mercenary_healAuto} && $char->{skills}{AL_HEAL}{lv} > 0) {
			if ($char->{mercenary}->{hpPercent} < $config{mercenary_hp}) {			
			my $target = $slavesList->get($char->{mercenary}->{'binID'});
	my $actorList = $slavesList;
	my $skill = new Skill(auto => 28, level => 10);

	require Task::UseSkill;
	my $skillTask = new Task::UseSkill(
		target => $target,
		actorList => $actorList,
		skill => $skill,
		priority => Task::USER_PRIORITY
	);
	my $task = new Task::ErrorReport(task => $skillTask);
	$taskManager->add($task);	
					}
				}		
}
	

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: Support Healing Mercenary when hp low than what %

#2 Post by kLabMouse »

Nice! But Some AutoVivifications may happen. And that's no good.

For Example here:

Code: Select all

$char->{skills}{AL_HEAL}{lv} > 0)
and Here:

Code: Select all

$slavesList->get($char->{mercenary}->{'binID'});
There is no validation whatever thus hash mambers exist.

Technology
Super Moderators
Super Moderators
Posts: 801
Joined: 06 May 2008, 12:47
Noob?: No

Re: Support Healing Mercenary when hp low than what %

#3 Post by Technology »

Isn't healing a merc already supported by partySkill? :?
One ST0 to rule them all? One PE viewer to find them!
One ST_kRO to bring them all and in the darkness bind them...

Mount Doom awaits us, fellowship of OpenKore!

Technology
Super Moderators
Super Moderators
Posts: 801
Joined: 06 May 2008, 12:47
Noob?: No

Re: Support Healing Mercenary when hp low than what %

#4 Post by Technology »

Can someone confirm if this is already supported trough partySkill?
One ST0 to rule them all? One PE viewer to find them!
One ST_kRO to bring them all and in the darkness bind them...

Mount Doom awaits us, fellowship of OpenKore!

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: Support Healing Mercenary when hp low than what %

#5 Post by kLabMouse »

Well it has to be supported suing PartySkill.
But, the auto Healing is Better. Shell we add support for this "Auto" feature?

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: Support Healing Mercenary when hp low than what %

#6 Post by EternalHarvest »

kLabMouse wrote:Well it has to be supported suing PartySkill.
But, the auto Healing is Better. Shell we add support for this "Auto" feature?
Then add self_healAuto, party_healAuto, etc... But why, if partySkill works?

(Also, somebody can heal mercs not via heal skill, but via merc potions.)

Post Reply