View Full Version : Remove Item
Is there a quest function for removing an item from a player upon the player's death? I have an Event_Slay that triggers a check_hasitem upon killing a player. If the player is carrying the item, I want the npc to "loot" it (really, just remove it from the player). It does not have to happen at the player's death; it could just as easily be an hp event. Either way, what do I use to remove the item from the player? Is there a quest::removeitem() function?
So_1337
08-01-2008, 05:49 PM
On our server, we wound up with players farming zones I didn't realize were revamped for the drops that were there. This obviously presented a problem.
We use a translocating NPC for people to get around. I set a proximity for him of 50 units. Then I set an enter proximity script like this:
sub EVENT_ENTER {
if ($name ne /Greenmist/){
$client->NukeItem(XXXXX);
}
}
There was a whole list. Anyone but me would have those items nuked from their person with no fanfare or even a message. It would work just as well under other sub EVENT types so long as you have a method for triggering it.
Hope this helps =)
very nice, SO-, thank you. That will work perfectly. Is there another quest list that contains commands like this, besides the Lexicon and this (http://www.eqemulator.net/wiki/wikka.php?wakka=QuestTutorial)page? Where else might I find obscure quest functions?
So_1337
08-01-2008, 06:16 PM
The QuestObjects (http://www.eqemulator.net/wiki/wikka.php?wakka=QuestObjects) Wiki page.
Very helpful thanks!
Any reason I cannot access the entityList page?
So_1337
08-01-2008, 08:26 PM
It isn't written. When you try to access it, it's prompting you to write it.
Okay, I can't seem to get this concept to work. The following script is on an npc that kills a player who has an item (the player script causes the npc to add the player with the item to his hate list):
sub Event_Slay
{
if(plugin::check_hasitem($client, 13732)
{
$client->NukeItem(13732);
}
}
Is the Event_Slay able to trigger the client losing an item after the character is dead? I replaced NukeItem with RemoveItem and client with corpse, but to no avail. Can't figure out why this isn't working. Should I be using a different event?
joligario
08-02-2008, 03:01 AM
Might be case sensitive. Try sub EVENT_SLAY
trevius
08-02-2008, 03:04 AM
It could be because the character is already zoning when it tries to run the script. I don't know if it would work the way you want it to. Also, if you have the zone set as dynamic and the only player in the zone dies, that zone will drop immediately. And, I imagine that would stop the script from running as well.
And, I do think it is case sensitive.
Okay, I finally got SLAY to work here:
sub EVENT_SLAY
{
if(plugin::check_hasitem($client, 13732))
{
$client->NukeItem(13732);
}
}
Thanks for the help!
Kilralpine
07-30-2009, 03:25 PM
Im attempting to use this as part of a Perl script that will allow NPC's to Add/remove loot to their loot tables according to wether or not they have a specific TASK.
I Have Tried these two different scripts:
sub EVENT_SIGNAL {
if($signal == 11) && (plugin::check_hasitem($npc, 3233)) {
$npc->NukeItem(3233);
quest::shout("got signal from trigger, removing 1 heart");
}
}
^^ Receives a signal from an outside trigger ^^
And simply
sub EVENT_EXIT
{
if (quest::istaskactivityactive(500,0)) {
$client->Message(4, "left area, removing 1 heart");
$npc->NukeItem(3233);
}
}
Neither one seems to fire off at all, debugging using alot of client messages and shout messages... everytime perl gets to the $npc->NukeItem(3233); it simply just stops... not sure what else i can do to remove the items... I tried using signalwiths because i figured that the entity $npc hadnt been defined because its in the sub EVENT_EXIT (which is all $client) - I Think????
The situation is... Trakanon spawns, sets a radius... If anyone with a task enters the radius it adds 1 quest item (this parts working). Problem is, if characters leave and re-enter the radius he adds an extra heart - this is what im trying to combat. What i want to do is have it so that when the players leave the radius it will remove the same heart that was added when they entered.
Any responses will be greatly appreciated! =)
Kilralpine
07-30-2009, 03:41 PM
Here is the Full Script... just incase its confusing..
TRAKANON
sub EVENT_SPAWN {
my $x = $npc->GetX();
my $y = $npc->GetY();
my $range = 210;
quest::set_proximity($x - $range, $x + $range, $y - $range, $y + $range);
}
sub EVENT_ENTER
{
if (quest::istaskactivityactive(500,0)) {
$client->Message(4, "Quest Item Added To Loot Table");
quest::addloot(3233,1);
}
}
sub EVENT_EXIT
{
if (quest::istaskactivityactive(500,0)) {
$client->Message(4, "signal sent");
quest::signalwith(999456,10,1); #Signal to questloot_trigger to send signal back
}
}
sub EVENT_SIGNAL {
if($signal == 11) && (plugin::check_hasitem($npc, 3233)) {
$npc->NukeItem(3233);
quest::shout("got signal from trigger, removing 1 heart");
}
}
QUESTLOOT_TRIGGER
sub EVENT_SIGNAL {
if($signal == 10) {
quest::shout("TRIGGER RECIEVED GO AHEAD");
quest::signalwith(89154,11,1); #Signal for trakky to remove the item
}
}
I Originally had it just try to remove the item when they EVENT_EXIT, but i think its not really sure who $npc is... Sorry im not very good with the quest objects yet; does it need to be defined somewhere?
joligario
07-31-2009, 08:54 AM
Here's at least 1 of your problems:
if($signal == 11) && (plugin::check_hasitem($npc, 3233)) {
should be
if(($signal == 11) && (plugin::check_hasitem($npc, 3233)) {
Haven't tested out the other portions for you yet.
Kilralpine
07-31-2009, 10:00 AM
Using this bit of code... I can get trakanon to respond, the addition of the line:
$npc->NukeItem(3233);
Causes the script to break.
sub EVENT_SIGNAL {
if($signal == 11) {
quest::shout("got signal from trigger, removing 1 heart");
}
}
^^ WORKING
sub EVENT_SIGNAL {
if($signal == 11) {
$npc->NukeItem(3233);
quest::shout("got signal from trigger, removing 1 heart");
}
}
^^BROKEN^^
Anyone know what would cause that quest object to break my script???
Kilralpine
07-31-2009, 10:04 AM
OK i found the issue, using this page:
http://www.eqemulator.net/wiki/wikka.php?wakka=QuestObjects
Apparently the handle NukeItem is not supported for npc->
Anyone know another way of removing items from mobs via Quest script??? These scripts could prove quite usefull for any mob that has the ability to drop quest items...
Kilralpine
07-31-2009, 10:30 AM
Here is the solution, after reading the list carefully i noticed this line:
RemoveItem(item_id, quantity= 0, slot= 0)
Therefore, $npc->RemoveItem(3233, 1); is the correct format/handle for NPCS to remove items
Completed Quest Script (No Trigger Mob or Signals):
##################
#ZONE - Sebilis
#NPC - Trakanon
#Quest - Green Dragon Hearts (Mobside)
#Author - Kilralpine
##################
#####
# This script will add the item 3233 to trakanon's loottable if a player with the task 500 enters his vicinity.
# If a player is to leave his vicinity it will remove the item...
# Therefore this script allows npcs to drop quest items ONLY if a player near them has the correct task, this can be adapted to any npc/task/item. ###
#####
sub EVENT_SPAWN {
my $x = $npc->GetX();
my $y = $npc->GetY();
my $range = 210;
quest::set_proximity($x - $range, $x + $range, $y - $range, $y + $range);
}
sub EVENT_ENTER
{
if (quest::istaskactivityactive(500,0)) {
quest::addloot(3233,1);
}
}
sub EVENT_EXIT
{
if (quest::istaskactivityactive(500,0)) {
$npc->RemoveItem(3233, 1);
}
}
Gunna go ahead and add this to the custom quests section
Tharkun
09-14-2009, 10:52 PM
zomgz this has so many useful applications
great job
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.