PDA

View Full Version : couple of questions about perl


jimbox114
10-07-2004, 04:37 AM
There is a couple of commands I am having trouble with. One of them is the Quest::depop command. How is this actually used? I have tried useing it as quest::depop, quest::depop() and quest:depop(xxx)

XXX is the npc id of the mob I wish to depop. None of these seemed to work. I know the syntax in the quest file is right, cause I changed the quest::depop to a quest::say and it worked fine.

Another I am unsure about how to make a NPC do something when they get to a certain waypoint. I see the subevent for it, but how do you actually define the WP you wish to have the action take place?

And finnally is there a place with a sample quest on how to make a mob despawn after X time. Like say I wanted a mob to spawn for 2 minutes (120 seconds) then depop?

sotonin
10-07-2004, 07:37 AM
im curious about this as well. i was never able to the depop command to work. anybody who HAS actually seen it work with their quests. please post your experiences )

jimbox114
10-08-2004, 05:30 AM
IF quest::depop does not work, does anybody have any idea's how to get rid of a npc after a certain amount of time? Basically we got a mob that spawns after a boss npc is slayed. This npc ports you to part 2 of the zone. We are wanting to leave the zone static, and obviously it wouldn't be good to just leave that npc there forever.

One thing I thought of, what if you set the npc to cast a spell on itself that would kill it? Like say after 5 minutes it would cast ice comet on itself? Think that might work? Of course the npc would have to be lower level and have low hp.

sotonin
10-08-2004, 05:50 AM
interesting idea. make it Cazic Touch. (aka death touch) and flag the npc as a merchant so his corpse poofs )

Cisyouc
10-08-2004, 06:53 AM
Er...quest::depop(); works for me.

sotonin
10-08-2004, 06:54 AM
Please post your code that works so we may see it.

thanks

Malignus Wingnut
10-08-2004, 01:55 PM
Yeah...ive never been able to get quest::depop(); to work for me... plz post cisyouc.

Cisyouc
10-08-2004, 02:58 PM
Im not sure if you wanted the source code or the perl quest, but here is an example of a perl quest I have for a Planar Projection that is triggered by quest::spawn(); on the death of Manaetic Behemoth in Innovation.

The code is set up so after 5 hails he depops or after 1 minute.
sub EVENT_SAY
{
if($text=~/hail/i)
{
if($temple2 == 0){
if($pplimit == 0){
quest::me("A Planar Progression says, 'You have slain the Manaetic Behemoth? Astounding. See Relm M`Loch.");
quest::setglobal("temple2","1","7","C999999");
quest::setglobal("pplimit","1","2","C010000");
quest::yellow("You have recieved a character flag!");}
if($pplimit == 1){
quest::me("A Planar Progression says, 'You have slain the Manaetic Behemoth? Astounding. See Relm M`Loch.");
quest::setglobal("temple2","1","7","C999999");
quest::setglobal("pplimit","2","2","C010000");
quest::yellow("You have recieved a character flag!");}
if($pplimit == 2){
quest::me("A Planar Progression says, 'You have slain the Manaetic Behemoth? Astounding. See Relm M`Loch.");
quest::setglobal("temple2","1","7","C999999");
quest::setglobal("pplimit","3","2","C010000");
quest::yellow("You have recieved a character flag!");}
if($pplimit == 3){
quest::me("A Planar Progression says, 'You have slain the Manaetic Behemoth? Astounding. See Relm M`Loch.");
quest::setglobal("temple2","1","7","C999999");
quest::setglobal("pplimit","4","2","C010000");
quest::yellow("You have recieved a character flag!");}
if($pplimit == 4){
quest::me("A Planar Progression says, 'You have slain the Manaetic Behemoth? Astounding. See Relm M`Loch.");
quest::setglobal("temple2","1","7","C999999");
quest::setglobal("pplimit","5","2","C010000");
quest::yellow("You have recieved a character flag!");}
if($pplimit == 5){
quest::me("A Planar Progression says, 'You have slain the Manaetic Behemoth? Astounding. See Relm M`Loch.");
quest::setglobal("temple2","1","7","C999999");
quest::setglobal("pplimit","6","2","C010000");
quest::yellow("You have recieved a character flag!");
quest::setglobal("pplimit","0","2","C999999");
quest::depop();}
} }
}
sub EVENT_SPAWN
{
quest::settimer(1,60);
}
sub EVENT_TIMER
{
quest::depop();
}

quest::yellow(); is a custom command which acts like quest::me(); only it displays yellow text.

jimbox114
10-09-2004, 04:36 AM
That is the exact way I have tried useing quest::depop() but it just won't work. I tried useing it that way on Fronglo's Server, and have tried in on Evolutions and both times it has done nothing. Both Servers have used .5.7dr6, maybe that has something to do with it?

Looks like I might go with plan b, and have the npc suicide after a few minutes.

***EDIT***

The idea of useing cazic touch don't seem to work too well. Here is the script I have been useing to try and despawn the npc. I know the timer is set pretty low that is just for testing purposes. I plan to let it stay spawned alot longer once its working.


#teleporter
##Spawns on the death of mini-boss npc. Ports players to part two of zone, then should depop after a certain time.

sub EVENT_SPAWN
{
quest::shout ("Finnally I have been freed from the clutches of this evil bird!");
quest::settimer(1,15);
}

sub EVENT_SAY
{
if ($text=~ /Hail/i){quest::say("Greetings, I am Druzzil Ro, the Mother of Solusek Ro. After seeing the horrible things my son had been doing he had me carried away by that vial creature. So what brings you to this fiery place? Are you here to fight my son [Solusek Ro]?");}

if ($text=~ /solusek/i){quest::say("I see, I will help you then. I can transport you to his secret hideing area. I hate to see any harm come to my only son, however I can see he has become [evil] just like his father. Anyways let me know when you are [ready]. Once I teleport you there, I can not bring you back.");}

if ($text=~ /evil/i){quest::say("Yes I knew long ago the type of person his father had become. I had thought I could raise him better. However my son's heart was tainted years ago, and there was just nothing I could do. Let me know if you are ready to venture on");}

if ($text=~ /ready/i){quest::say("Very well, off you go then. I wish you luck."); quest::movepc(212,218,1480,-63);}

}

sub EVENT_TIMER
{
quest::say("I must now go, best of luck");
#quest::depop();
quest::castspell(131,982);
}


With the quest::depop she just said I must go now over and over again. With the castspell you could see her making the spell cast motion, but she was not actually casting it. After about 5 times the zone crashed.

ajb20
10-27-2004, 02:22 AM
Just wanted to bump this for anyone still having problems. here is a very simple quest that is tested and depop() works fine.

sub EVENT_SPAWN
{
quest::settimer(a386,30);
}

sub EVENT_TIMER
{
if($timername==a386)
{
quest::depop();
quest::stoptimer(a386);
}
}

sub EVENT_SAY
{
if($text=~/hail/i)
{
quest::say("Hello GM $name. I see you are testing me to see if I depop after 30 seconds. Well good luck.");
}
}

Be sure to do quest::stoptimer(); or it will crash the zone though because it will restart the timer and try to depop a non-existant mob :)

fathernitwit
10-27-2004, 04:15 AM
another note that might yeild a little more success is that depop can take an optional arg which is a id from npc_types and will depop the first of those that it finds in the zone. This will fix the timer issue as well as might work better overall.

killspree
10-27-2004, 12:25 PM
Is that a recent change? It was $timer a while back, not $timername.

Edit: That *may* be your problem - perl variables are in embparser.cpp, the variable you need to use is $timer. The variables from parser.cpp are for the old quest system.