View Single Post
  #17  
Old 01-27-2004, 03:35 AM
mollymillions's Avatar
mollymillions
Hill Giant
 
Join Date: May 2003
Posts: 176
Default

Just thought i would post a couple of snippets that may or may not be useful examples (please correct me if any are bad examples).

Random handout and say
Code:
quest::summonitem("int(rand(7))+5019");
Code:
my @items = (5303,5304,5305,5313,6303,6311,6312,7300,7301,7311,7499);
quest::summonitem("$items[int(rand($#items+1))]");
Code:
sub EVENT_TIMER {
my $random = int(rand(4));	
if($random == 0){
	quest::say("Outta my way, ya big lummox!"); }
if($random == 1){
	quest::say("Time to drain the [dragon]..  If ya know what I mean..  Bwah ha ha ha."); }
if($random == 2){
	quest::say("You know you love me."); }
if($random == 3){
	quest::say("Hey Fishboy! You dropped something! Bwah ha ha ha!"); }	
}
Sometimes its required that an NPC moves away from another one, usually to allow one of them to be killed. You can't make an NPC walk or run to a particular location, as far as i know, so as a work around you can get the NPC to follow the PC for a short period -but If the NPC is not killed there is no easy way to return it to its spawn location.
Code:
sub EVENT_SAY { 
if($text=~/come/i){ 
	quest::follow($userid);
	quest::settimer(1,30); }
}
sub EVENT_TIMER {
quest::stoptimer(1);
quest::sfollow();
}
Recently i have found this query usefull for checking tradeskills
Code:
SELECT items.name product, skillneeded, i1.name i1
, i2.name i2, i3.name i3, i4.name i4, i5.name i5
, i6.name i6, i7.name i7, i8.name i8, i9.name i9
, i10.name i10, tradeskillrecipe.*
FROM tradeskillrecipe, items
LEFT JOIN items i1 ON tradeskillrecipe.i1 = i1.id
LEFT JOIN  items i2 ON tradeskillrecipe.i2 = i2.id
LEFT JOIN  items i3 ON tradeskillrecipe.i3 = i3.id
LEFT JOIN  items i4 ON tradeskillrecipe.i4 = i4.id
LEFT JOIN  items i5 ON tradeskillrecipe.i5 = i5.id
LEFT JOIN  items i6 ON tradeskillrecipe.i6 = i6.id
LEFT JOIN  items i7 ON tradeskillrecipe.i7 = i7.id
LEFT JOIN  items i8 ON tradeskillrecipe.i8 = i8.id
LEFT JOIN  items i9 ON tradeskillrecipe.i9 = i9.id
LEFT JOIN  items i10 ON tradeskillrecipe.i10 = i10.id
WHERE tradeskillrecipe.product = items.id
ORDER BY items.name
NPC's and loot:
Code:
select npc_types.id, left(npc_types.name,32), spawn2.zone, lootdrop_entries.item_id, items.name
from npc_types, spawnentry, spawn2
left join loottable_entries on npc_types.loottable_id = loottable_entries.loottable_id
left join lootdrop_entries on loottable_entries.lootdrop_id = lootdrop_entries.lootdrop_id
left join items on lootdrop_entries.item_id = items.id
where npc_types.id = spawnentry.npcid
and spawnentry.spawngroupid = spawn2.spawngroupid
and npc_types.name like '%Slixin_Klex%'
order by npc_types.name
Reply With Quote