Whenever I am trying anything new like that, I always test it by setting quest::say to report what the quest is actually getting. So, when you get the owner ID, I would add a quest::say after that to see exactly what ID it is getting, if any:
Code:
sub EVENT_SPAWN {
quest::say("im up.");
$target = $npc->GetOwnerID();
quest::say("My owner's ID is $target");
}
And then, if it returned nothing, then most likely the object isn't being used properly. If something is returned, then you need to know what kind of ID it is getting. Most likely it is getting the character's entity ID, which would be something like 222 (and can be verified by doing a #showstats on yourself). It could also be getting the character, which is a string of characters more like EBDSX=11ASDF13 or something (completely made that up). In this case, it should be getting the entity ID. So, now we need to get the client using that entity ID. Here is how to do that:
Code:
sub EVENT_SPAWN {
quest::say("im up.");
$target = $npc->GetOwnerID();
quest::say("My owner's ID is $target");
$getclient = $entity_list->GetClientByID($target);
quest::say("I got client $getclient");
}
Using says after each step will show where the script is failing, if it is. Next, you should be able to summon the item for them:
Code:
sub EVENT_SPAWN {
quest::say("im up.");
$target = $npc->GetOwnerID();
quest::say("My owner's ID is $target");
$getclient = $entity_list->GetClientByID($target);
quest::say("I got client $getclient");
$getclient->SummonItem(1333, 1);
quest::say("All Done");
}
That is basically the same thing you have already done, but it explains the steps of how I would do it and I think corrects a couple of mistakes in the script you posted.
If that doesn't work, you might be able to use something like this:
Code:
sub EVENT_SPAWN {
quest::say("im up.");
$target = $npc->GetOwnerName();
quest::say("My owner's name is $target");
$npc->SetTarget($target);
quest::say("Target has been set to $target");
quest::summonitem(1333);
quest::say("All Done");
}
Let me know if none of that helps. We can probably think of some way to do it. I am not at home atm, so I can't test any of it for you.