Log in

View Full Version : What's wrong with this quest?


Randymarsh9
04-16-2009, 02:29 PM
I just modified one of my old quests to work as a teleporter. The npc doesn't respond to hails or when you give him money. I did enable quest globals for him.

sub EVENT_SAY{
if ($text=~/hail/i){
quest::say("Greetings, $name. I have the ability to teleport you to a variety of [zones], but it will cost you 50 platinum for each teleport.");
}
if ($text=~/zones/i){
quest::say("I can send you to [Cazic] Thule, [Cobalt] Scar, [Dawnshroud], [Iceclad], [Twilight] Sea, and [Wakening] Lands. You must have sufficient [credit].");
}
if ($text=~/credit/i){
quest::say("For each platinum you give me, you will earn one credit for teleports. You can also see your current [balance].");
}
if ($text=~/balance/i){
if ($porter >= 1) {
quest::say("Your current credit is $porter");
$porter = undef;
}
else {
quest::say("You have 0 credit.");
$porter = undef;
}
}
if ($text=~/cazic/i){
if ($porter >= 50) {
quest::setglobal("porter", $porter-50, 0, "Y9");
quest::say("Farewell");
quest::selfcast(1375)
$porter = undef;
}
else {
quest::say("You need more credits!");
$porter = undef;
}
}


if ($text=~/cobalt/i){
if ($porter >= 50) {
quest::setglobal("porter", $porter-50, 0, "Y9");
quest::say("Farewell");
quest::selfcast(2025)
$porter = undef;
}
else {
quest::say("You need more credits!");
$porter = undef;
}
}


if ($text=~/dawnshroud/i){
if ($porter >= 50) {
quest::setglobal("porter", $porter-50, 0, "Y9");
quest::say("Farewell");
quest::selfcast(2431)
$porter = undef;
}
else {
quest::say("You need more credits!");
$porter = undef;
}
}


if ($text=~/iceclad/i){
if ($porter >= 50) {
quest::setglobal("porter", $porter-50, 0, "Y9");
quest::say("Farewell");
quest::selfcast(2022)
$porter = undef;
}
else {
quest::say("You need more credits!");
$porter = undef;
}
}


if ($text=~/twilight/i){
if ($porter >= 50) {
quest::setglobal("porter", $porter-50, 0, "Y9");
quest::say("Farewell");
quest::selfcast(2426)
$porter = undef;
}
else {
quest::say("You need more credits!");
$porter = undef;
}
}


if ($text=~/wakening/i){
if ($porter >= 50) {
quest::setglobal("porter", $porter-50, 0, "Y9");
quest::say("Farewell");
quest::selfcast(2024)
$porter = undef;
}
else {
quest::say("You need more credits!");
$porter = undef;
}
}
}

sub EVENT_ITEM {
if($platinum >= 1){
quest::setglobal("porter", $porter+$platinum, 0, "Y9");
quest::say("Your credit has risen.");
$porter = undef;
}
else {
quest::say("I only take platinum.");
$porter = undef;
plugin::return_items(\%itemcount);
}
}

Andrew80k
04-16-2009, 03:09 PM
Did you reload the quests?

Derision
04-16-2009, 03:17 PM
You are missing a ; after each occurrence of quest::selfcast

Randymarsh9
04-16-2009, 04:35 PM
thank you, that's what I get for copy/pasting.

Justsomeguy
04-16-2009, 08:03 PM
hashes are now used instead of the old $porter restricted vars. Consider using $qglobals{porter} as the old method is deprecated. Using the new way does not require you to use all of the $porter = undef; as there are many potential errors when using that.

example:

if ($qglobals{porter} >= 50) {

Randymarsh9
04-17-2009, 12:55 PM
Ok, I have a new problem. I am trying to make a quest that checks the persons class. I have tried all formats I can think of and it will not check the class properly. Right now it is just an extremely simple quest because I am trying to figure out what's wrong with it. Knowing me, I probably just have something out of order.

sub EVENT_SAY{
if ($text=~/hail/i){
if ($class == "shadowknight"){
quest::say("Hello.");
}
}
}


For the class I have also tried
if ($class = "shadowknight"){
if ($class = 'shadowknight'){
if ($class == 'shadowknight'){
if ($class eq "shadowknight"){
if ($class eq 'shadowknight'){

Andrew80k
04-17-2009, 01:04 PM
Have you tried $class eq "Shadowknight" ? I think they are capitalized.

Randymarsh9
04-17-2009, 01:22 PM
Nice, that fixed it. Thanks

Randymarsh9
04-17-2009, 03:47 PM
New problem. I am trying to make a monster spawn adds at 75% and 25% and on death, but the only time one spawns is on death. This is the monsters quest

sub EVENT_SPAWN{
quest::attacknpctype(1211);
}

sub EVENT_HP{
if ($hpevent <=75){
quest::spawn(1210,0,0,76,11,0.50);
}
if ($hpevent <=25){
quest::spawn(1210,0,0,76,11,0.50);
}
}
sub EVENT_DEATH{
quest::spawn(1209,0,0,76,11,0.50);
}

Andrew80k
04-17-2009, 03:54 PM
Are you using quest::setnexthpevent()?

trevius
04-17-2009, 04:01 PM
Here is an example from a simple script on my server:

my $x;
my $y;
my $z;
my $h;

sub EVENT_SPAWN {
quest::setnexthpevent(91);
}

sub EVENT_HP {
if($hpevent == 91) {
my $x = $npc->GetX();
my $y = $npc->GetY();
my $z = $npc->GetZ();
my $h = $npc->GetHeading();
quest::spawn2(quest::ChooseRandom(223002,223003),0 ,0,$x,$y + 10,$z,$h);
quest::spawn2(quest::ChooseRandom(223002,223003),0 ,0,$x,$y - 10,$z,$h);
quest::setnexthpevent(76);

}

if($hpevent == 76) {
my $x = $npc->GetX();
my $y = $npc->GetY();
my $z = $npc->GetZ();
my $h = $npc->GetHeading();
quest::spawn2(quest::ChooseRandom(223002,223003),0 ,0,$x,$y + 10,$z,$h);
quest::spawn2(quest::ChooseRandom(223002,223003),0 ,0,$x,$y - 10,$z,$h);
quest::setnexthpevent(56);
}

if($hpevent == 56) {
my $x = $npc->GetX();
my $y = $npc->GetY();
my $z = $npc->GetZ();
my $h = $npc->GetHeading();
quest::spawn2(quest::ChooseRandom(223002,223003),0 ,0,$x,$y + 10,$z,$h);
quest::spawn2(quest::ChooseRandom(223002,223003),0 ,0,$x,$y - 10,$z,$h);
quest::setnexthpevent(26);
}

if($hpevent == 26) {
my $x = $npc->GetX();
my $y = $npc->GetY();
my $z = $npc->GetZ();
my $h = $npc->GetHeading();
quest::spawn2(quest::ChooseRandom(223002,223003),0 ,0,$x,$y + 10,$z,$h);
quest::spawn2(quest::ChooseRandom(223002,223003),0 ,0,$x,$y - 10,$z,$h);
}
}

sub EVENT_DEATH {
quest::shout ("$name and the others may have beaten me, but they are no match for the beast!");
quest::depop(2700255);
quest::depop(2700256);
}

Randymarsh9
04-19-2009, 01:03 AM
sub EVENT_SPAWN{
quest::attacknpctype(1211);
quest::setnexthpevent(75);
}

sub EVENT_HP{
if ($hpevent <=75){
quest::spawn(1210,0,0,76,11,0.50);
quest::setnexthpevent(25);
}
if ($hpevent <=25){
quest::spawn(1232,0,0,76,11,0.50);
}
}
sub EVENT_DEATH{
quest::spawn(1209,0,0,76,11,0.50);
}

For some reason when the monster gets to 25%, he summons two monsters. I do not know why

trevius
04-19-2009, 05:01 AM
Probably something to do with your script. Looks like you have this:

if ($hpevent <=25){

instead of this, which is what you should be using:

if ($hpevent == 25){

Not completely sure that is the cause of your issue, but that is my best guess.

Randymarsh9
05-02-2009, 05:53 PM
I am making a quest where killing monsters will give you a global credit, and then you can hail someone in PoK for your epic. Here are their two quests:

sub EVENT_DEATH{
quest::setglobal("epic",$epic+1, H1);
$epic = undef;
}

and

sub EVENT_SAY{
if ($text=~/hail/i){
if ($class eq "Cleric"){
if ($qglobals{epic} <5){
quest::say("The world is in dire need of healers such as you. Are you looking to further your power with an [epic]?");
}
elsif(qgbobals{epic} >4){
quest::say("Congratulations. You're help has earned you this weapon.");
quest::summonitem(5532);
$epic = undef;
}
}
}
if ($text=~/epic/i){
if ($class eq "Cleric"){
quest::say("I will gladly assist you in gaining your epic weapon;however, you will need to do something for me in the Plane of War first. Tell me if you are [ready].");
}
}

if ($text=~/ready/i){
if ($class eq "Cleric"){
if ($ulevel >45){
quest::movepc(213, 0,0,0);
}
elsif ($ulevel <46){
quest::say("You aren't good enough.");
}
}
}
}


After I kill the five monsters, I will return to PoK, hail the person, and receive the same dialogue as if I didn't have the global.

joligario
05-02-2009, 08:14 PM
If I were you, I would do a task rather than mess with globals in the death event.

Thovar
12-30-2009, 01:44 PM
You are missing a ; after each occurrence of quest::selfcast

Funny how this solved my problem and didn't realize this WAS the problem I was having. when I saw this posted I looked through my quest I was having an issue with and i as well was missing that silly little ; at the end of one of my many lines in this quest, and all along I thought I had a more complicated problem. ROFL... silly Monday details.