PDA

View Full Version : Script help


herold
08-13-2006, 11:19 AM
Dont know if this is the right place for this, sorry if it isn't, but here goes...
I am trying to make a KEI casting NPC and have "developed" the following script ... problem is, it is not working.

sub EVENT_SAY
{
if($text=~/Hail/i){quest::say("Greetings $name. If you pay me 50 platinum pieces, I will cast Koadic's Endless Intellect on you.");}
}

sub EVENT_ITEM
{
if($platinum == 50)
{
quest::castspell($userid,2570);
}
}or
sub EVENT_SAY
{
if($text=~/Hail/i){quest::say("Greetings $name. If you pay me 50 platinum pieces, I will cast Koadic's Endless Intellect on you.");}
if($platinum == 50)
{
quest::castspell($userid,2570);
}
}
none of them are working ... anyone got any ideas?

ylosh
08-13-2006, 12:33 PM
npcs will not cast group buff spells like koadics on players right now with castspell. detrimental or single target buffs work fine. castspell is also (spellid,$userid)

you can use quest::sellfcast(spellid); for koadics, wunshi and other group buffs.

herold
08-13-2006, 01:03 PM
selfcast will also affact the toon next to the NPC casting it, yes?

Zengez
08-13-2006, 01:21 PM
the selfcast makes the client think the player cast it on themself, so it will cast it on the player and any/all players in that player's group that are within the spell range

hope that helps

herold
08-13-2006, 01:36 PM
I have evolved the code to the following, but still it does not work...sub EVENT_SAY
{
if($text=~/Hail/i){quest::say("Greetings $name. If you pay me 50 platinum pieces, I will cast Koadic's Endless Intellect on you.");}
}
sub EVENT_ITEM
{
if($platinum == 50)
{
quest::selfcast(2570,$userid);
}
}A friend of mine suggested that the NPC class is irrelevant ... ie. enchanter vs. warrior ... is this true?

And last but not least, I am trying to put the script on Nayr Cogswin on PoK (warrior, gnome - by the soulbinder) ... if he has to be an enchanter, where exactly do I change that? I tried looking under the table "npc_types" (in MySQL Control Center 0.9.2-beta ... which as far as I can see only loads 1000 entries/rows), but again with no luck...

ylosh
08-13-2006, 04:40 PM
quest::selfcast(spellid); don't need $userid

Aramid
08-14-2006, 01:52 AM
A friend of mine suggested that the NPC class is irrelevant ... ie. enchanter vs. warrior ... is this true?

And last but not least, I am trying to put the script on Nayr Cogswin on PoK (warrior, gnome - by the soulbinder) ... if he has to be an enchanter, where exactly do I change that? I tried looking under the table "npc_types" (in MySQL Control Center 0.9.2-beta ... which as far as I can see only loads 1000 entries/rows), but again with no luck...

Your friend is correct.

Did you name your script Nayr_Cogswin.pl (must be spelled exactly as the NPC's name in the database) and save it to your poknowledge folder under quests? If the name doesn't work, target him with someone that can use the #showstats command and get his npc ID number. Rename the script to that number ie:202117.pl if his ID was 202117.

herold
08-14-2006, 08:08 AM
Your friend is correct.

Did you name your script Nayr_Cogswin.pl (must be spelled exactly as the NPC's name in the database) and save it to your poknowledge folder under quests? If the name doesn't work, target him with someone that can use the #showstats command and get his npc ID number. Rename the script to that number ie:202117.pl if his ID was 202117.I used the 3rd party tool that came with the install, called "Questeditor" ... the "hail" portion of the script works, so the script is placed right, yes?

I will try and remove the $userid from the selfcast portion and see how that turns out.

herold
08-14-2006, 10:44 AM
Script works now :D

Thanks all for your help.

sub EVENT_SAY
{
if($text=~/Hail/i){quest::say("Greetings $name. If you pay me 50 platinum pieces, I will cast Koadic's Endless Intellect on you.");}
}
sub EVENT_ITEM
{
if($platinum == 50)
{
quest::selfcast(2570);
}
}

herold
08-14-2006, 11:18 AM
I modified the script and expanded it ... quite usefull for servers with small communities.

sub EVENT_SAY
{
if($text=~/Hail/i)
{quest::say("Greetings $name. If you want me to cast a spell on you, please say so and I will give you my [pricelist]. If you want me to [heal] you, please say so and I will do it for free.");}
if($text=~/pricelist/i)
{quest::say("I can cast the following spells : Spirit of Wolf = 1 pp // Dead Man Floating = 3 pp // Clarity II = 5 pp // Spiritual Light = 8 pp // Spiritual Radiance = 15 pp // Temperance = 1 peridot // Virtue = 4 peridots // KEI = 50 pp");}
if ($text=~/heal/i)
{
quest::selfcast(13);
}
}
sub EVENT_ITEM
{
if($platinum == 1)
{
quest::selfcast(278);
}
if($platinum == 3)
{
quest::selfcast(457);
}
if($platinum == 5)
{
quest::selfcast(1693);
}
if($platinum == 8)
{
quest::selfcast(2176);
}
if($platinum == 15)
{
quest::selfcast(2177);
}
if($item1== 10028)
{
quest::selfcast(3692);
}
if($itemcount{10028} == 4)
{
quest::selfcast(3467);
}
if($platinum == 50)
{
quest::selfcast(2570);
}
}