|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Quests::Q&A This is the quest support section |
|
|
|
02-09-2015, 12:37 AM
|
Hill Giant
|
|
Join Date: Dec 2012
Posts: 116
|
|
Default.pl only loading for 1 mob in zone
EDIT::: Problem seems to be with default.pl only loading for 1 mob and not the quest itself. See 2nd post.
Trying to make a zone wide quest to add loot. For testing purposes i have it set to >=1 later will be more like 90. The idea is if a chance is rolled then pick a random item from a set of items and add it to NPC loot.
So i went to the zone folder made a file called default.pl and went on doing normal quest routine. here is where it gets weird.... This quest seems to pick 1 mob each #reloadqst and stick with that through each #repop until I do #reloadqst again. you can see my test line there, which really helped narrow this down. Any ideas what I am doing wrong here?
Code:
my @drops = (6701,6702,6703,6704);
sub EVENT_SPAWN{
quest::shout("test");
if(quest::ChooseRandom(1..100) >= 1){
$item = $drops[int(rand @drops)];
quest::shout($item);#test line remove when working
$npc->AddItem($item,1);
}
}
EDIT:: Is there an issue with the default.pl file beingside inside a zone folder and not just in eqemu\quests\ ?
|
|
|
|
02-09-2015, 09:45 AM
|
Hill Giant
|
|
Join Date: Dec 2012
Posts: 116
|
|
The problem seems to be in the default.pl not loading all mobs in the zone.
I used to get the quest working on a_cracked_skeleton. Now it seems to always trigger on Ariam Depoper, however if i remove a quest npcs file for #Paleontologist then he gets picked up. It seems like its picking up the first npc and not all of them.
So with no other quests in the /befallen directory other than default.pl i get #Paleontologist as the only mob responding to the quest. When I add his quest back into the zone it seems to only work for Ariam Depoper. Another note, #paleontologist is not the first or last mob alphabetically but is is the mob with the highest ID number.
|
02-09-2015, 11:16 AM
|
|
Developer
|
|
Join Date: Dec 2012
Posts: 515
|
|
You don't want @drops outside of the sub event.. thats never a good idea
zonesn\default.pl -- Will only load on NPCs in that zone who DO NOT have a quest file!!
global\global_npc.pl -- Will load on all NPCs in any zone even if they have a quest!
|
02-09-2015, 11:18 AM
|
Hill Giant
|
|
Join Date: Dec 2012
Posts: 116
|
|
Quote:
Originally Posted by NatedogEZ
You don't want @drops outside of the sub event.. thats never a good idea
zonesn\default.pl -- Will only load on NPCs in that zone who DO NOT have a quest file!!
global\global_npc.pl -- Will load on all NPCs in any zone even if they have a quest!
|
Moving the @drops into the subroutine fixed it! Thanks Nate
|
02-09-2015, 11:21 AM
|
Hill Giant
|
|
Join Date: Dec 2012
Posts: 116
|
|
Here is the working quest code if anyone wants to reuse it. This is in the zone directory in the file default.pl
Code:
sub EVENT_SPAWN{
my @drops = (6701,6702,6703,6704);#define loot drops here
if(quest::ChooseRandom(1..100) >= 95){ #probability an item will be added
$item = $drops[int(rand @drops)];
$npc->AddItem($item);
}
}
|
02-09-2015, 12:25 PM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
FYI,
It is OK to define arrays outside of the subs, but you can't use "my" on them or they won't be loaded.
Also, if you are using default.pl, I highly suggest adding something like the below to the top of any subs you have in default.pl:
Code:
# Prevent pets or charmed NPCs from loading the default.pl
if (!$npc || $npc->GetOwnerID() || $npc->GetSwarmOwner())
{
return;
}
This will prevent your default.pl script from being applied to pets.
|
02-09-2015, 01:18 PM
|
|
Developer
|
|
Join Date: Dec 2012
Posts: 515
|
|
Quote:
Originally Posted by trevius
FYI,
It is OK to define arrays outside of the subs, but you can't use "my" on them or they won't be loaded.
|
Ah.. weird I always had the problem he did when I did that.. it would just load on 1 NPC and never load on other npcs in the same zone.. so generally I just don't ever place anything outside the subs
|
02-09-2015, 01:36 PM
|
Hill Giant
|
|
Join Date: Dec 2012
Posts: 116
|
|
What exactly does my do, make it a local variable just inside the sub it is placed in? vs no my making is more global to the whole script?
Good call on the swarm pets too, I will add that, that could have been exploit city!
|
02-10-2015, 11:41 AM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
Yeah, "my" basically makes the variable only valid within the current block of code. If you remove the "my", then it can global to the whole script. Using "my" outside of a block (such as sub EVENT or anything with brackets) will just not let it work properly by perl design. I am not exactly sure why it even works for a single NPC, but either way it is not recommended.
When you have a static array like that which isn't being altered in the script, it is fine to define it outside of the subs as long as you leave off the "my". However, if you have a variable outside of the subs that does get modified by the script, it can effect all NPCs that use that same script since it is global.
It can sometime be tricky to get the right results when working with stuff like default.pl which will be applied to a large number of NPCs. Understanding the functionality of "my" and global variables can help a lot.
|
|
|
|
05-16-2018, 06:20 PM
|
Fire Beetle
|
|
Join Date: Oct 2013
Posts: 11
|
|
File
Where do you save this .pl file i cant seem to get it to spawn loot on npcs? I currently have it saved as default.pl in the /quests/crushbone folder
|
05-16-2018, 10:46 PM
|
Administrator
|
|
Join Date: May 2013
Location: United States
Posts: 1,594
|
|
You can put it in zone/default.pl.
|
05-23-2018, 03:48 PM
|
Fire Beetle
|
|
Join Date: Oct 2013
Posts: 11
|
|
Ok so i put the below in both the zone/default.pl file and i tried adding it to the quests/global folder with the file name global_npc.pl and neither are spawning npcs with loot. I must be doing something wrong. I am trying to figure out an easy way to add a list of item ID's to all the npcs in the zone with a probability of around 90-95%. Let me know if there is a more streamlined method of implementation.
sub EVENT_SPAWN{
my @drops = (50516, 50011, 50518, 50014, 50012, 50015, 50013, 50017, 50016, 50018, 50029, 50027, 50031, 50032, 50028, 50030, 50026, 50507, 50510, 50501, 50512, 50503, 50514, 50515, 50021, 50019, 50022, 50020, 50023, 50024, 50025, 50506, 50007, 50005, 50006, 50010, 50008, 50009, 50513, 50502, 50508, 50511, 50517, 50504, 50505);#define loot drops here
if(quest::ChooseRandom(1..100) >= 95){ #probability an item will be added
$item = $drops[int(rand @drops)];
$npc->AddItem($item);
}
}
|
05-23-2018, 03:55 PM
|
Demi-God
|
|
Join Date: Apr 2008
Location: MA
Posts: 1,164
|
|
We have global loot system now ...
|
05-23-2018, 04:01 PM
|
Fire Beetle
|
|
Join Date: Oct 2013
Posts: 11
|
|
Well... Do explain or give me a link where i can read up on how that works. Clearly I missed something.
|
05-23-2018, 05:51 PM
|
Hill Giant
|
|
Join Date: Jun 2010
Posts: 105
|
|
check the plugins in the wiki, there is an addloot plugin that works wonders.
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 12:30 AM.
|
|
|
|
|
|
|
|
|
|
|
|
|