Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 11-08-2012, 03:58 PM
javewow's Avatar
javewow
Sarnak
 
Join Date: Aug 2012
Location: work
Posts: 74
Default defaultCombat.pl

I want to let all the fighting to stop NPC

Return to full HP

Don't know what to do

---------------------------------

sub EVENT_SPAWN
{

Plugin::setnexthpevent(1000);
}


sub EVENT_COMBAT
{
if ($combat_state = 1)
{
$npc->SetHP(9990000);
}
}


-------------------------------

copy---> plugins/defaultCombat.pl ????? HELP!!!

and for default.pl ?
__________________
To create the most beautiful server for "!!~[BP] PLARYBOT EQ~!" Welcome to our server
Reply With Quote
  #2  
Old 11-08-2012, 04:17 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

you probably want to edit EVENT_COMBAT in plugins\default-actions.pl

any npc that has EVENT_COMBAT defined in their individual script won't use the default, so you'll have to edit all of them individually.

i don't know what you are trying to do with the call to setnexthpevent(), as it is unrelated to what you mentioned wanting to do.

$event_combat is set to 0 when an npc leaves combat.

using $npc->Heal() should set the npc's health to 100%.
Reply With Quote
  #3  
Old 11-08-2012, 09:13 PM
javewow's Avatar
javewow
Sarnak
 
Join Date: Aug 2012
Location: work
Posts: 74
Default

Quote:
Originally Posted by c0ncrete View Post
you probably want to edit EVENT_COMBAT in plugins\default-actions.pl

any npc that has EVENT_COMBAT defined in their individual script won't use the default, so you'll have to edit all of them individually.

i don't know what you are trying to do with the call to setnexthpevent(), as it is unrelated to what you mentioned wanting to do.

$event_combat is set to 0 when an npc leaves combat.

using $npc->Heal() should set the npc's health to 100%.
Code:
# Default-actions.pl
#
# Default actions to perform if the user performs particular actions on an NPC.
 
sub defaultSay
{
  my $handled = plugin::nullzero(shift);
  my $name = plugin::assocName();
  my $text = plugin::val('$text');
  my $mname = plugin::fixNPCName();
  my $faction = plugin::val('$faction');
  my $zonesn = plugin::val('$zonesn');
  my $npc = plugin::val('$npc');
  my $zoneln = plugin::cityName();
 
  if (!$handled)
  {
    if ($mname=~/^Soulbinder\w/)
    {
      if($text=~/^hail/i)
      {
        quest::say("Greetings, ${name}. When a hero of our world is slain, their soul returns to the place it was last bound and the body is reincarnated. As a member of the Order of Eternity, it is my duty to [bind your soul] to this location if that is your wish.");
        quest::doanim(29);
 
        $handled = 1;
      }
      elsif (($text=~/bind my soul/i) || ($text=~/bind your soul/i))
      {
        quest::say("Binding your soul. You will return here when you die.");
        quest::doanim(42);
        quest::selfcast(2049);
 
        $handled = 1;
      }
    }
    elsif ($mname=~/^Guard\w/)
    {
      if ($faction > 5)
      {
        quest::me("$mname glowers at you dubiously.");
 
        $handled = 1;
      }
      else
      {
        quest::say("Hail, $name! Pardon me. I am on duty, keeping $zoneln safe.");
 
        $handled = 1;
      }
    }
    elsif (($mname=~/^Merchant\w/) || ($mname=~/^Innkeep/) || ($mname=~/^Barkeep/))
    {
      if($text=~/^Hail/i)
      {
        quest::say("Welcome, $name! Why don't you browse through my selection of fine goods and pick out some things you like?");
 
        $handled = 1;
      }
    }
  }
 
  if (($text=~/test money/i) && (plugin::val('$status') > 20))
  {
    quest::givecash(99, 99, 99, 99);
  }
}
 
sub defaultItem
{
  plugin::returnUnusedItems();
}
 
sub defaultDeath
{
  my $handled = plugin::nullzero(shift);
  my $mname = plugin::val('$mname');
  my $zonesn = plugin::val('$zonesn');
 
  if (!$handled)
  {
    if ($mname =~ /^(an\_)?orc(\_.+|)$/i) # Everything from 'orc' to 'an_orc_flibberty_gibbet', but not 'orchard_master', etc.
    {
      # Orc death
 
      quest::say(
        (($zonesn =~ /(g|l)faydark/) || ($zonesn eq 'crushbone')) ? plugin::random('You shall have all the Crushbone Orcs on your tail for my death!!') :
        "DEBUG: $zonesn orc death!");
 
      $handled = 1;
    }
    elsif ($mname =~ /^(a\_)?gnoll(\_.+|)$/i) # Everything from 'gnoll' to 'a_gnoll_flibberty_gibbet', but not 'gnollish', etc.
    {
      # Gnoll death
 
      quest::say(
        ($zonesn =~ /^qey/i) ? plugin::random('DEBUG: Blackburrow gnoll death!!') :
        "DEBUG: $zonesn (Non-Blackburrow) gnoll death!");
      $handled = 1;
    }
    elsif ($mname =~ /^Guard/i)
    {
      # Guard death
 
      my $city = plugin::cityName();
 
      quest::say( ($city eq 'Kelethin') ? 'Kelethin guard death!' :
                  ($city eq 'Felwithe') ? 'Felwithe guard death!' :
                  "DEBUG: $city guard death!" );
 
      $handled = 1;
    }
  }
}
 
sub defaultSlay
{
  my $handled = plugin::nullzero(shift);
  my $mname = plugin::val('$mname');
  my $zonesn = plugin::val('$zonesn');
 
  if (!$handled)
  {
    if ($mname =~ /^Guard/i)
    {
      # Guard kills
 
      # 25% chance for flavor text
      if (int(rand(4)) == 0)
      {
        my $city = plugin::cityName();
 
        quest::say(
          ($city eq 'Kelethin') ? 'For the protection of all Feir\'dal, there shall be no mercy for your kind.' :
          ($city eq 'Felwithe') ? 'Another one bites the dust.' :
          "$city is a little bit safer now." );
      }
 
      $handled = 1;
    }
  }
}
 
sub EVENT_COMBAT 
{
my $npc = plugin::val('$npc');
my $zonesn = plugin::val('$zonesn');

if ($event_combat = 0) 
{
$npc->SetHP();
}
}
}
sub defaultCombat()
{
  my $combat_state = plugin::val('$combat_state');
  my $zonesn = plugin::val('$zonesn');
  my $mname = plugin::val('$mname');
 
  if ($combat_state == 1)
  {
    if ($zonesn =~ /^((l|g)faydark|crushbone)$/)
    {
      if ($mname =~ /^(an\_)?orc(\_.+|)$/i) # Everything from 'orc' to 'an_orc_flibberty_gibbet', but not 'orchard_master', etc.
      {
      }
    }
   }
  }
 
 
  return;
 
  # Sample code to work from
  my $random_result = int(rand(100));
    if(($combat_state == 1) &&($random_result<=50)){
    quest::say("Death!!  Death to all who oppose the Crushbone orcs!!");
   }else{
   quest::say("You've ruined your lands. You'll not ruin mine!");
 }

Help have a look whether this can all ZONE NPC????
__________________
To create the most beautiful server for "!!~[BP] PLARYBOT EQ~!" Welcome to our server
Reply With Quote
  #4  
Old 11-08-2012, 10:12 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

sorry. i told you wrong. default-actions doesn't need an EVENT_COMBAT sub. you'd just need to edit defaultCombat() to suit your needs. additionally, i think you want to place default.pl directly in the quests directory for plugins\default-actions.pl to be used.

once that is done, this should do what you are wanting:
Code:
sub defaultCombat()
{
    my $combat_state = plugin::val('$combat_state');
    my $npc = plugin::val('$npc');
  
    if ($combat_state == 0)
    {
        $npc->Heal();
    }
}
i believe you still have to add the changes manually to every existing npc script as they won't use the default. i am not at a computer that i can test this out on at the moment.
Reply With Quote
  #5  
Old 11-09-2012, 01:09 AM
javewow's Avatar
javewow
Sarnak
 
Join Date: Aug 2012
Location: work
Posts: 74
Default

1:this file -default-actions.pl----copy to c:/peq/plugins/ + c:/peq/quests/plugins/

Code:
# Default-actions.pl
#
# Default actions to perform if the user performs particular actions on an NPC.

sub defaultSay
{
  my $handled = plugin::nullzero(shift);
  my $name = plugin::assocName();
  my $text = plugin::val('$text');
  my $mname = plugin::fixNPCName();
  my $faction = plugin::val('$faction');
  my $zonesn = plugin::val('$zonesn');
  my $npc = plugin::val('$npc');
  my $zoneln = plugin::cityName();
  
  if (!$handled)
  {
    if ($mname=~/^Soulbinder\w/)
    {
      if($text=~/^hail/i)
      {
        quest::say("Greetings, ${name}. When a hero of our world is slain, their soul returns to the place it was last bound and the body is reincarnated. As a member of the Order of Eternity, it is my duty to [bind your soul] to this location if that is your wish.");
        quest::doanim(29);

        $handled = 1;
      }
      elsif (($text=~/bind my soul/i) || ($text=~/bind your soul/i))
      {
        quest::say("Binding your soul. You will return here when you die.");
        quest::doanim(42);
        quest::selfcast(2049);

        $handled = 1;
      }
    }
    elsif ($mname=~/^Guard\w/)
    {
      if ($faction > 5)
      {
        quest::me("$mname glowers at you dubiously.");

        $handled = 1;
      }
      else
      {
        quest::say("Hail, $name! Pardon me. I am on duty, keeping $zoneln safe.");

        $handled = 1;
      }
    }
    elsif (($mname=~/^Merchant\w/) || ($mname=~/^Innkeep/) || ($mname=~/^Barkeep/))
    {
      if($text=~/^Hail/i)
      {
        quest::say("Welcome, $name! Why don't you browse through my selection of fine goods and pick out some things you like?");

        $handled = 1;
      }
    }
  }
  
  if (($text=~/test money/i) && (plugin::val('$status') > 20))
  {
    quest::givecash(99, 99, 99, 99);
  }
}

sub defaultItem
{
  plugin::returnUnusedItems();
}

sub defaultDeath
{
  my $handled = plugin::nullzero(shift);
  my $mname = plugin::val('$mname');
  my $zonesn = plugin::val('$zonesn');
  
  if (!$handled)
  {
    if ($mname =~ /^(an\_)?orc(\_.+|)$/i) # Everything from 'orc' to 'an_orc_flibberty_gibbet', but not 'orchard_master', etc.
    {
      # Orc death
      
      quest::say(
        (($zonesn =~ /(g|l)faydark/) || ($zonesn eq 'crushbone')) ? plugin::random('You shall have all the Crushbone Orcs on your tail for my death!!') :
        "DEBUG: $zonesn orc death!");

      $handled = 1;
    }
    elsif ($mname =~ /^(a\_)?gnoll(\_.+|)$/i) # Everything from 'gnoll' to 'a_gnoll_flibberty_gibbet', but not 'gnollish', etc.
    {
      # Gnoll death
      
      quest::say(
        ($zonesn =~ /^qey/i) ? plugin::random('DEBUG: Blackburrow gnoll death!!') :
        "DEBUG: $zonesn (Non-Blackburrow) gnoll death!");
      $handled = 1;
    }
    elsif ($mname =~ /^Guard/i)
    {
      # Guard death
      
      my $city = plugin::cityName();
      
      quest::say( ($city eq 'Kelethin') ? 'Kelethin guard death!' :
                  ($city eq 'Felwithe') ? 'Felwithe guard death!' :
                  "DEBUG: $city guard death!" );

      $handled = 1;
    }
  }
}

sub defaultSlay
{
  my $handled = plugin::nullzero(shift);
  my $mname = plugin::val('$mname');
  my $zonesn = plugin::val('$zonesn');
  
  if (!$handled)
  {
    if ($mname =~ /^Guard/i)
    {
      # Guard kills
      
      # 25% chance for flavor text
      if (int(rand(4)) == 0)
      {
        my $city = plugin::cityName();
      
        quest::say(
          ($city eq 'Kelethin') ? 'For the protection of all Feir\'dal, there shall be no mercy for your kind.' :
          ($city eq 'Felwithe') ? 'Another one bites the dust.' :
          "$city is a little bit safer now." );
      }

      $handled = 1;
    }
  }
}

sub defaultCombat()
{
    my $combat_state = plugin::val('$combat_state');
    my $npc = plugin::val('$npc');
  
    if ($combat_state == 0)
    {
        $npc->Heal();
    }
}
    return;

  # Sample code to work from
  my $random_result = int(rand(100));
    if(($combat_state == 1) &&($random_result<=50)){
    quest::say("Death!!  Death to all who oppose the Crushbone orcs!!");
   }else{
   quest::say("You've ruined your lands. You'll not ruin mine!");
 }
2: default.pl

Code:
sub EVENT_COMBAT 
	{
	if ($combat_state = 0) 
		{
		$npc->Heal();
		}
	}
copy---default.pl to c:/peq/quest/ finishing is ok?
__________________
To create the most beautiful server for "!!~[BP] PLARYBOT EQ~!" Welcome to our server
Reply With Quote
  #6  
Old 11-09-2012, 03:41 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

No, that is not correct. You almost have the plugin correct, but you have extra script lines at the end that will break your plugins:

You should be able to delete this:
Code:
    return;

  # Sample code to work from
  my $random_result = int(rand(100));
    if(($combat_state == 1) &&($random_result<=50)){
    quest::say("Death!!  Death to all who oppose the Crushbone orcs!!");
   }else{
   quest::say("You've ruined your lands. You'll not ruin mine!");
 }
At the end of your plugin file you posted.

Next, you would want to call that plugin from your default.pl file. You do not want to put the default.pl directly in your quests folder, you want it in quests/templates/default.pl so it will effect all NPCs that do not already have a script associated with them.

Then, in that default.pl file, you would have the following code:
Code:
sub EVENT_COMBAT {
	plugin::defaultCombat();
}
That will make it call the plugin you added to restore their HPs to 100%.

As mentioned, any NPC that already has a script associated with them in your templates folder or in the quests zone folder for the zone they are in will still need to be modified to have the new plugin added to them. If they already have an EVENT_COMBAT, you would just need to add the plugin line "plugin::defaultCombat();" inside the EVENT_COMBAT. If they don't have an EVENT_COMBAT already, you would need to add the sub EVENT_COMBAT as I posted above for your default.pl file.

Since this seems to be a bit confusing to you, there is a MUCH easier way to accomplish what you are wanting to do without even having to worry about scripts at all. You can just edit your rule_values table and set " NPC:OOCRegen" to 100. This will make all NPCs regen to 100% about 6 seconds after it leaves combat.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #7  
Old 11-09-2012, 07:52 AM
javewow's Avatar
javewow
Sarnak
 
Join Date: Aug 2012
Location: work
Posts: 74
Default

Your methods are not running

I have tested could not operate of pl

OOCRegen is OK,

others not running!
__________________
To create the most beautiful server for "!!~[BP] PLARYBOT EQ~!" Welcome to our server
Reply With Quote
  #8  
Old 11-09-2012, 08:55 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

It should work, but I am guessing you made more mistakes. If you still need help with it (if OOCRegen isn't good enough for what you want), then please post the plugin and default.pl files you created for this and where you have them saved to.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 07:01 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3