EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   addloot on spawn? (https://www.eqemulator.org/forums/showthread.php?t=32448)

Templus 11-09-2010 01:12 AM

addloot on spawn?
 
this doesn't seem to work:

Code:

sub EVENT_SPAWN{
$npc->addloot(119811);
}

i put it into "test.pl" in my zone and #reloadquest and then do #spawn test 1 1 1 1 1 1

but there's no loot on test's corpse...

I've also tried just "addloot" instead of "$npc->addloot" no dice .. as well as both of those variations with addloot(119811,1) no dice

I'm just a myriad of errors aren't i :(

Thanks in advance :)

EDIT: i can't even get a simple hail function working with my test NPC .. i guess I can't use quests with npcs that I spawn with GM commands? or something? i don't even know :(

Caryatis 11-09-2010 02:09 AM

You have some reading to do son

trevius 11-09-2010 02:56 AM

Multiple issues with what you are trying to do. First, the command is used like this:

quest::addloot(itemid,charges); #Adds x-charges of an item to the NPC's loot

As seen on this page from the Wiki:

http://www.eqemulator.net/wiki/wikka...=QuestTutorial

The $npc-> pointers are only used in the quest objects from this page:

http://www.eqemulator.net/wiki/wikka...a=QuestObjects

They are categorized so you can know what type of pointers work with each command. The $npc one works with the NPC or Mob section commands. The $client works with the Client or Mob section. The rest are all in their own sections and don't work with NPC or Client.

Another problem is that quests don't load for an NPC unless it is in the database, and using #spawn doesn't put them into the database until you use "#npcspawn create" on them or something. Once you have created the spawn, you will need to do a repop and maybe even a zone restart (forget if one is required for sure or not offhand) before scripts will load.

Also, many commands have trouble working directly from EVENT_SPAWN due to the NPC being in the middle of the process of being created at that time. I think more work now than what used to work from that event, but if you can't get them to work from EVENT_SPAWN, the easiest work-around is to set a 5 second timer and use EVENT_TIMER to do your script commands.

Templus 11-09-2010 05:31 PM

Tried doing it a number of ways based on the suggestions. Still can't get it working. Oh well :(

Thanks :)

trevius 11-10-2010 09:29 AM

Also, make sure you can #summonitem the item you are trying to add to the loot table. If it is an item you added since your last server restart, the item won't be added in-game until you restart your server completely, as items are all loaded only when the server is first started and never updated after that point.

mamba700 07-09-2011 03:54 PM

Add Defiant Loot on Spawn
 
Here is an example of adding Crude Defiant in Crushbone to the stock orc_centurion.pl


Code:

#Orc chit-chat
#Revised Angelox 10-23-06
#zone: Crushbone
sub EVENT_COMBAT{

 $rand = rand();
 
if(($rand < .3)&&($combat_state == 1))  {  quest::say("Death!!  Death to all who oppose the Crushbone orcs!!");
 } 
if(($rand > .67)&&($combat_state == 1)) {
 quest::say("Hail, Emporer Crush!!");
 } 
if(($rand >= .3)  && ($rand <= .67)&&($combat_state == 1))  { 
 quest::say("Fall before the might of Clan Crushbone!!");
 }

}

sub EVENT_ATTACK{  quest::say("Centurions!!  Legionnaires!!  Come join the fight!");

}

sub EVENT_DEATH{

 quest::say("You shall have all the Crushbone orc legions on your tail for my death!");

}

sub EVENT_TIMER{


 $defiantrand = rand(28);
 $defiantrand = $defiantrand + 50004;

 $defiantchance = rand(100);

 if ($defiantchance <= 50) {
  quest::addloot($defiantrand,1); #Adds x-charges of an item to the NPC's loot
 }

quest::stopalltimers();

}


sub EVENT_SPAWN{

  quest::settimer($mytimer,5);
}



All times are GMT -4. The time now is 12:45 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.