EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Healing Bot Issue (https://www.eqemulator.org/forums/showthread.php?t=26411)

Neiv 10-02-2008 09:34 PM

Healing Bot Issue
 
Here is the code for my healer. I'm trying to get her to whisper to anyone who enters her proximity AND is <= 70% health AND has Realm faction. If someone is ally, he is called "citizen." If someone is less than ally buut greater than amiable, he is called "friend." The script works in part; she whispers, but she does so to anyone whose health is <= 70%, no matter what faction. Any suggestions?

Code:

sub EVENT_ENTER
        {
        my $player = $entity_list->GetClientByID($userid);
        my $get_player = $player->CastToClient();
        my $player_hps = $get_player->GetHPRatio();
        if ($player_hps <= 70)       
                {
                    $npc->SetAppearance(1);
                $factioncheck = $client->GetCharacterFactionLevel(484);
                        {
                        if ($factioncheck >= 1101)
                                {
                                $client->Message(257,"A mysterious voice calls to you, 'Come quickly, $name, citizen of the Realm, and let me have a look at those wounds. I am inside the city, near the causeway to the Wall.' ");
                                }
                        if ($factioncheck >= 101)
                                {
                                $client->Message(257,"A mysterious voice calls to you, 'Come quickly, $name, friend of the realm, and let me have a look at those wounds. I am inside the city, near the causeway to the Wall.' ");
                                }
                          }
                }
        }


Neiv 10-04-2008 09:25 AM

I think I've fixed this. I added a my $factioncheck = undef; statement just above the SetAppearance function, and it seems to be working now:

Code:

sub EVENT_ENTER
        {
        my $player = $entity_list->GetClientByID($userid);
        my $get_player = $player->CastToClient();
        my $player_hps = $get_player->GetHPRatio();
        if ($player_hps <= 70)       
                {
              my $factioncheck = undef;
                    $npc->SetAppearance(1);
                $factioncheck = $client->GetCharacterFactionLevel(484);
                        {
                        if ($factioncheck >= 1101)
                                {
                                $client->Message(257,"A mysterious voice calls to you, 'Come quickly, $name, citizen of the Realm, and let me have a look at those wounds. I am inside the city, near the causeway to the Wall.' ");
                                }
                        if ($factioncheck >= 101)
                                {
                                $client->Message(257,"A mysterious voice calls to you, 'Come quickly, $name, friend of the realm, and let me have a look at those wounds. I am inside the city, near the causeway to the Wall.' ");
                                }
                          }
                }
        }


Neiv 10-04-2008 10:13 AM

Okay, one more time. The subsequent "if" statements were wrong. Here is the full corrected code for anyone who wants it:

Code:

#Heal bot

sub EVENT_SAY
        {
        if($text=~/hail/i)
                {
                $npc->SetAppearance(0); #healer stands#
                quest::say("Hail, $name. You have done well to come to me. I am a daughter of the Realm, but have within me the bloodline of the Healers. Alas, this craft has passed out of all memory of men in this age. But I know it well; and if you wish, I will use it to heal your wounds. The ingredients I need are not easily obtained. I have spent all I possess to gain the meager amount you see before you. I ask only for enough money to secure more so that I may continue to help the people of the Realm. One platinum piece is all I ask. In return, your wounds will be fully healed.");
                }
        }       

sub EVENT_SPAWN
        {
        $x = $npc->GetX();
        $y = $npc->GetY();
        quest::set_proximity($x - 90, $x + 90, $y - 90, $y + 90);
        }

sub EVENT_ENTER
        {
        my $player = $entity_list->GetClientByID($userid);
        my $get_player = $player->CastToClient();
        my $player_hps = $get_player->GetHPRatio();
        if ($player_hps <= 70)       
                {
                my $factioncheck = undef;
                    $npc->SetAppearance(1); # healer sits#
                $factioncheck = $client->GetCharacterFactionLevel(484); #faction ID of the Realm#
                        {
                        if ($factioncheck >= 1101)  #ally status#
                                {
                                $client->Message(257,"A mysterious voice calls to you, 'Come quickly, $name, citizen of the Realm, and let me have a look at those wounds. I am inside the city, near the causeway to the Wall.' ");
                                }
                        elsif ($factioncheck >= 101) # amiably, kindly, warmly #
                                {
                                $client->Message(257,"A mysterious voice calls to you, 'Come quickly, $name, friend of the Realm, and let me have a look at those wounds. I am inside the city, near the causeway to the Wall.' ");
                                }
                        else
                                {#do nothing
                                }
                          }
                }
        }

sub EVENT_ITEM
        {
        if (($platinum>=1))
                {
                  $npc->SetAppearance(0); #healer stands#
                    quest::selfcast(13);
                    quest::say("Many thanks to you, $name. You have aided the armies of the realm more than you know. Be well, and may the blessings of the free peoples go with you.");
                $npc->SetAppearance(1); #healer sits#
                }
        else
                {
                plugin::return_items(\%itemcount);
                    quest::say("I'm very sorry, $name, but that isn't enough. I require one platinum piece.");
                $npc->SetAppearance(1); #healer sits#
                }
        }


Skizoke 10-05-2008 02:06 PM

Thanks, I'm going to try this out.

ChaosSlayer 10-05-2008 02:12 PM

note: return items DOES NOT work with money =)
if you give npc wrong ammount, it will simply eat it

Neiv 10-05-2008 06:22 PM

Quote:

note: return items DOES NOT work with money =)
if you give npc wrong ammount, it will simply eat it
Ahh, that was one thing I did not check, so thanks!


All times are GMT -4. The time now is 12:48 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.