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

07-28-2008, 07:25 AM
|
Hill Giant
|
|
Join Date: May 2008
Location: Colorado
Posts: 238
|
|
Problems with a signal script
I have a script that is supposed to call the guards to come in and kill the non-allied player who hails the king. On my king NPCs I have the following script:
Quote:
elsif($faction >= 2)
{
quest::signal(999139,5);
quest::signal(999140,5);
quest::say("Why should I suffer the likes of you? You shall pay for your presumptuousness.");
quest::shout("GUARDS!");
}
|
On two of the kingdom guards I have this:
Quote:
sub EVENT_SIGNAL
{
quest::attack($name);
quest::shout("The King calls for help!");
}
|
The shouts work fine in each case, but the guards do not come. I tried changing $name to $client, with the same results. Then I changed $name to the PC's actual name (Neiv), and it worked. Obviously I do not want to hard-code my player name in the quest script. Why isn't $name working? How do I adjust the script to recognize any player who hails the king?
|

07-28-2008, 08:15 AM
|
Dragon
|
|
Join Date: May 2006
Location: Cincinnati, OH
Posts: 689
|
|
$name will report the $name of the player who initiated that section of code (in this case, the sub EVENT_SIGNAL portion). I believe your problem would lie in the fact that it is actually the King's script that is triggering it, and so it doesn't know who is doing it in the first place.
I would suggest looking at something like Cazic Thule's script from the Plane of Fear. That has a pretty good method for adding a client to an NPC's hate list without even using a file for them. Or, if you're really intent on using signals, you could store the $name from the King's file in a variable and pass it along to the guards that way.
Good luck!
|

07-28-2008, 05:25 PM
|
 |
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
The Tunare script in growthplane is another good example of adding to the hate list on other NPCs.
You could probably still send the signal to make them do the shout, but you could probably avoid using the signal at all if you just make the shout come from a sub EVENT_COMBAT.
|

07-28-2008, 10:38 PM
|
Hill Giant
|
|
Join Date: May 2008
Location: Colorado
Posts: 238
|
|
Thanks. I've looked at both scripts and experimented a bit with them, but can't seem to figure out what's going on with them (nothing like this in the Lexicon).
|
 |
|
 |

07-28-2008, 10:55 PM
|
 |
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
This is part of a script I made by using the Tunare script as an example and it works perfectly:
Code:
sub EVENT_ATTACK {
my $guardian_one = $entity_list->GetMobByNpcTypeID(2700500);
my $guardian_two = $entity_list->GetMobByNpcTypeID(2700501);
my $guardian_three = $entity_list->GetMobByNpcTypeID(2700502);
my $guardian_four = $entity_list->GetMobByNpcTypeID(2700503);
my $guardian_five = $entity_list->GetMobByNpcTypeID(2700504);
my $guardian_six = $entity_list->GetMobByNpcTypeID(2120410);
if ($guardian_one) {
my $hate_guardian_one = $guardian_one->CastToNPC();
$hate_guardian_one->AddToHateList($client, 1); }
if ($guardian_two) {
my $hate_guardian_two = $guardian_two->CastToNPC();
$hate_guardian_two->AddToHateList($client, 1); }
if ($guardian_three) {
my $hate_guardian_three = $guardian_three->CastToNPC();
$hate_guardian_three->AddToHateList($client, 1); }
if ($guardian_four) {
my $hate_guardian_four = $guardian_four->CastToNPC();
$hate_guardian_four->AddToHateList($client, 1); }
if ($guardian_five) {
my $hate_guardian_five = $guardian_five->CastToNPC();
$hate_guardian_five->AddToHateList($client, 1); }
if ($guardian_six) {
my $hate_guardian_six = $guardian_six->CastToNPC();
$hate_guardian_six->AddToHateList($client, 1); }
}
|
 |
|
 |
 |
|
 |

07-28-2008, 11:29 PM
|
Hill Giant
|
|
Join Date: May 2008
Location: Colorado
Posts: 238
|
|
Thanks Trevius,
My event is a SAY, not an ATTACK. The player hails the king to trigger the guards. The guards do not attack if the player is turning in the Grail. They also do not attack if the player has ally status--only when he is less than ally and has no grail to turn in. Would it then be something like?
Quote:
sub EVENT_SAY
{
if($text=~/hail/i)
{
if(plugin::check_hasitem($client, 13732))
{
quest::say("What is this? You bring good tidings indeed, $name! Give me the Grail, and together we shall defeat the Enemy. As for you, $name . . . be assured that you shall not fail to be rewarded for showing such kindness to our Kingdom. Your stature and your bank will be increased, and you will be made a full citizen of the Kingdom. But come now; we must act quickly. Give me the Grail.");
}
elsif($faction >= 2)
{
my $guard_one = $entity_list->GetMobByNpcTypeID(999139);
my $guard_two = $entity_list->GetMobByNpcTypeID(999140);
if ($guard_one) {
my $hate_guard_one = $guard_one->CastToNPC();
$hate_guard_one->AddToHateList($client, 1); }
if ($guard_two) {
my $hate_guard_two = $guard_two->CastToNPC();
$hate_guard_two->AddToHateList($client, 1);
quest::say("Why should I suffer the likes of you? You shall pay for your presumptuousness.");
quest::shout("GUARDS!");
}
else
{
quest::say("Do you not see I have enough [trouble] already? Why should I welcome you, $name? For your welcome here is doubtful");
}
}
|
|
 |
|
 |
 |
|
 |

07-28-2008, 11:59 PM
|
 |
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
Do you mean if they have the grail in their inventory AND they have ally faction? Or if they have the grail OR ally faction? Do they need both to keep from being attacked, or just either one?
If they need both, I think it should be something like this:
Code:
sub EVENT_SAY {
if($text=~/hail/i) {
if(plugin::check_hasitem($client, 13732)&&($faction >= 2)) {
quest::say("What is this? You bring good tidings indeed, $name! Give me the Grail, and together we shall defeat the Enemy. As for you, $name . . . be assured that you shall not fail to be rewarded for showing such kindness to our Kingdom. Your stature and your bank will be increased, and you will be made a full citizen of the Kingdom. But come now; we must act quickly. Give me the Grail."); }
else {
quest::say("Why should I suffer the likes of you? You shall pay for your presumptuousness.");
quest::shout("GUARDS!");
my $guard_one = $entity_list->GetMobByNpcTypeID(999139);
my $guard_two = $entity_list->GetMobByNpcTypeID(999140);
if ($guard_one) {
my $hate_guard_one = $guard_one->CastToNPC();
$hate_guard_one->AddToHateList($client, 1); }
if ($guard_two) {
my $hate_guard_two = $guard_two->CastToNPC();
$hate_guard_two->AddToHateList($client, 1); }
}
}
}
|
 |
|
 |

07-29-2008, 12:23 AM
|
Hill Giant
|
|
Join Date: May 2008
Location: Colorado
Posts: 238
|
|
Quote:
Originally Posted by trevius
Do you mean if they have the grail in their inventory AND they have ally faction? Or if they have the grail OR ally faction? Do they need both to keep from being attacked, or just either one?
|
Either one. They can be dubious, but if they have the grail, they won't be attacked. If they are ally and have no grail they won't be attacked. They are attacked only if the have no ally status AND they have no grail.
|

07-29-2008, 12:51 AM
|
Hill Giant
|
|
Join Date: May 2008
Location: Colorado
Posts: 238
|
|
I used your script and made the proper adjustments, and it is working now. Thanks Trevius, you're awesome!
|

07-29-2008, 07:17 AM
|
Hill Giant
|
|
Join Date: May 2008
Location: Colorado
Posts: 238
|
|
On a related note, is this basically the same script I would use if I want all of a certain npctype in a zone to attack a player who enters that zone if he has the grail in his inventory. Is there an Event that could trigger an attack upon zone entry, perhaps with a 15-sec delay to give the unsuspecting player time to move away from zonelines?
|

07-29-2008, 08:06 AM
|
 |
Developer
|
|
Join Date: Mar 2003
Posts: 1,498
|
|
Maybe put a signalwith in the player.pl file.
|

07-29-2008, 08:28 AM
|
Dragon
|
|
Join Date: May 2006
Location: Cincinnati, OH
Posts: 689
|
|
You could very well do that by creating a player.pl for the zone and using a proximity around where they would zone in. If they have the grail, then start the timer. When the timer fires, signal the NPCs (if they're going to shout) and add them to the hate list.
|

07-30-2008, 07:28 AM
|
Hill Giant
|
|
Join Date: May 2008
Location: Colorado
Posts: 238
|
|
Quote:
Originally Posted by So_1337
You could very well do that by creating a player.pl for the zone and using a proximity around where they would zone in. If they have the grail, then start the timer. When the timer fires, signal the NPCs (if they're going to shout) and add them to the hate list.
|
What Event would actually trigger this?
|

07-30-2008, 08:19 AM
|
Dragon
|
|
Join Date: May 2006
Location: Cincinnati, OH
Posts: 689
|
|
If you set a proximity, it would be sub EVENT_ENTER. Come to think of it, though, I'm not sure where you would set the proximity in a player.pl file, as it doesn't exactly spawn. So sub EVENT_SPAWN is out. Hrm.
I may have misspoke.
After some digging, it seems that sub EVENT_ENTERZONE is available for player.pl scripts. This would do away with the need to set a proximity, but doesn't really help if you have more than one zoneline and don't want it to be triggered each time.
|

07-30-2008, 03:24 PM
|
Hill Giant
|
|
Join Date: May 2008
Location: Colorado
Posts: 238
|
|
Quote:
Originally Posted by So_1337
After some digging, it seems that sub EVENT_ENTERZONE is available for player.pl scripts. This would do away with the need to set a proximity, but doesn't really help if you have more than one zoneline and don't want it to be triggered each time.
|
Actually I do want it to apply to all zones. Does that mean player.pl is stored in the general quest folder, not in the zone folder? Never used player.pl.
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 02:30 AM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |