PDA

View Full Version : stumped with some perl


Teppen
07-21-2004, 01:03 PM
Ive been scripting the monk epic in perl, and I need to know how to script a few things. If anyone could supply sample code, id appreciate it. or if what im wanting to do is not in yet just let me know. only looking for posts from people who understand perl very well. saves me from getting confused. thanks in advance, hope my questions get answered.

FYI: if someone can help me with atleast problems 1 & 2, I have mostly all of the monk epic done including headband/sash, robe of the lost circle, and robe of the whistling fist. and ofcourse ill post it on the forum, just got stumped be a few things in the cestial fist part.

problem #1

doing a quest where the npc is at first in one part of the zone, and when you kill him he respawns in another part of the same zone. ive included a snippit of the code below to give an example of what im try to pull off.



sub EVENT_DEATH
{
{
quest::say("Not bad.. Now lets see if you can find my trueform if you do we discuss this further.");
quest::itemsummon(1683);
quest::spawn(0,0,0,0,0,0);
}
}



how do you use the quest::spawn(0,0,0,0,0,0); and are there any errors in the above code? yes ive looked at the command list sticky in forums.. but how to use spawn still throws me, i do understand the last three 0's are x, y, z cords.

problem #2

this problem ties in with problem 1. I have an npc that when given a certain if($text=~/..../i) will depop and triggers a totally different npc to spawn in another part of the same zone. but there are two different npc id's for example 00001.pl and 00002.pl and when 00001.pl depops it tells 00002.pl to spawn and start the actual quest, but when the npc from 00002.pl is killed he triggers the npc from 00001.pl to respawn. if this is possible then alot of quests repeat this implement. the code i got for each npc id is below.



#5149.pl
#Zone - Lavastorm
#Type - Quest
#Class - Monk
#Mob - a Fire Sprite

sub EVENT_SAY
{
if($text=~/Hail, $mname/i)
{
quest::emote("ignores you.");
}
if($text=~/I challenge Eejag/i)
{
quest::depop();
quest::spawn(0,0,0,0,0,0);
#wanting it to spawn Eejag from 6517.pl
#dont know if the quest::spawn is correct use here.
}
}



so after 'a fire sprite' depop will it trigger 6517.pl ? like below. I understand im missing stuff from quest::spawn(); just wanting to know if this setup will work? and if not could a snippet be provided.



#6517.pl
#Zone - Lavastorm
#Type - Quest
#Class - Monk
#Mob - Eejag

sub EVENT_SPAWN
{
quest::shout("What imbecile dares challenge a Celestial Fist?! Do you even know who you are challenging? HA! You are nothing but an insect! I will enjoy crushing you, I have not charred the flesh of an idiot in decades! If you truly wish to fight me, the battle shall be held in my ouwn element. Come, challenger, come down to the pits of flowing fire.");
}



problem #3

problem #3 has nothing to do with the monk epic, but was curious if theres was a way to implement it. if so it might enable all newbie armor quests.

1.) setup a global.pl for any assemblykit.
example: 17270.pl = silentfist assembly kit (item id)

2.) inside 17270.pl put something like:



#17270.pl
#Silentfist Assembly Kit (combine check)

#Bracer of the Silentfist (27373).
#1 woven spider silk (9914), 2 rat whisker (13071),
#1 gnoll jawbone (27392), 1 cloth wristband (1009).

sub EVENT_ITEM
{
if($itemcount{9914} && $itemcount{13071} && $itemcount{13071} && $itemcount{27392} && $itemcount{1009}== 1)
{
quest::summonitem(27373); #Bracer of the Silentfist
}
}

#Robe of the Silentfist (12256).
#blah blah blah blah .............

sub EVENT_ITEM
{
if($itemcount{0000} && $itemcount{0000} && $itemcount{0000} && $itemcount{0000} && $itemcount{0000}== 1)
{
quest::summonitem(12256); #Robe of the Silentfist
}
}

# keep repeating til every piece of the Silentfist newbie armor
# is included in 17270.pl



note: in eqlive combining in the kit just give you a certain pattern which then you have to combine the pattern and mold quest npc gave you in either a loom, or forge to recieve the actual armor. but decided to do so in kit to just give an idea of what i was thinking. if this worked one could jus make a forge id global.pl and insert how i did above to give the eqlive effect. these are just ideas, never been implemented. If this worked or if some way near it, setting looms-global.pl, forges-global.pl, and etc would be an easy way to combine tradeskills. dunno. just babbling lol.

animepimp
07-21-2004, 02:22 PM
quest::spawn(npc_type,grid,guildwarset,x,y,z); - Spawn "npc_type" on "grid" with "guildwarset" at "x","y","z".

Npc_type is the id of the NPC you want to spawn. This id is the same number that you name the quest file. Grid is a grid number for the zone that they should walk around on. Just use 0 if you don't want them to walk. Guildwarset should be 0 unless you are running a guildwar server. And the rest is the position.

You cannot spawn a copy of the same NPC in a different place to do what you want in #1. You need to make 2 NPCs with the same name and stats but different IDs because they need to have different quest files.

And for #2 yes you can have them both spawn each other if you use the right spawn() syntax.

For #3 you cannot do this with perl quests. Only NPCs can trigger quests, not items. You could make a NPC with those quest files to turn stuff into them. Or there is a section of the DB devoted to combining items in containers with formulas to get something to come out, but I ahve no idea of the syntax and its fairly buggy.

sianyde
07-21-2004, 02:39 PM
[quote="animepimp"]quest::spawnGrid is a grid number for the zone that they should walk around on. Just use 0 if you don't want them to walk. [quote]

Quick question: does the mob just wander around randomly in that grid?

Teppen
07-21-2004, 03:24 PM
thanks animepimp. your post was exactly what I was looking for. I understand the syntax better now.

I had an idea that the quest forum admin might take under consideration. create two sub directories under quest creation. name the first directory legit perl quests, and a second directory called non legit perl quests. so people can post in either folder full working quests or snippits for others to use. while keeping this forum for general quest support. just an idea.

sotonin
07-21-2004, 05:47 PM
Quick question: does the mob just wander around randomly in that grid?

I believe he's refering to an actual pathing grid taken from the grids table. If this is the case, no it is not random, but a preset walking path.