View Full Version : quest::creategroundobject() No charges
kayen85
11-12-2008, 04:04 PM
Using quest::creategroundobject() it will always spawn items with zero charges no matter what the item is set for in the dbase.
Is there anyway we can get something added to fix this?
Also does anyone have an example using sub EVENT_PICK_UP
I am having trouble getting it work as described.
ect where 4671 is the item that was spawned. Just doesn't work. I have this on the npc that spawns the item.
sub EVENT_PICK_UP {
if ($picked_up_id == 4671) {
quest::say("You have picked up food");
}
}
Thanks.
Kayen
GM Stormhaven
kayen85
11-12-2008, 04:27 PM
Could it just be done like this
old
void QuestManager::CreateGroundObject(int32 itemid, float x, float y, float z, float heading, int32 decay_time)
{
entity_list.CreateGroundObject(itemid, x, y, z, heading, decay_time);
}
new
void QuestManager::CreateGroundObject(int32 itemid, float x, float y, float z, float heading, int32 decay_time, uint8 charges)
{
entity_list.CreateGroundObject(itemid, x, y, z, heading, decay_time, charges );
}
trevius
11-14-2008, 06:36 AM
I confirmed that there definitely is an issue with this. Everything seems to work properly for ground spawns accept they can't have charges. I am not sure if that is an issue with creating the item, or if something happens when an item is put on the ground or when it is picked up that it removes charges automatically. I am thinking it might be set that way to remove a possible exploit to recharge items by dropping them and picking them back up (at least for tradeable items).
As for the EVENT_PICK_UP, I think that needs to be used in the player.pl only. I don't think NPCs can use that.
Yeah it's player pl only, npcs have nothing to do with picking up items! When I was making it I didn't really take into account charges I thought that would get set correctly automatically, we can fix it.
cavedude
11-14-2008, 02:34 PM
That's partially my fault I'm sure. The sub EVENT obviously should be used with player.pl, but I put it under the normal section of the wiki. I'll fix that now as well.
trevius
11-23-2008, 03:25 AM
Even using player.pl, I still can't get EVENT_PICK_UP to work. Here is my example player.pl file that I am using in overthere:
sub EVENT_PICK_UP {
if ($picked_up_id == 4607) {
quest::spawn2(2700766, 0, 0, 1925.4, 3147.5, -50, 192);
}
}
I pick up the item 4607 (a crate) and it is supposed to spawn a Cockatrice at the same location. But, I get nothing at all no matter how I write it.
I also confirmed that ground spawn still always have 0 charges on them if they are set to have a certain amount. They work properly if #summoned, but not if picked up from being a ground spawn.
trevius
11-23-2008, 03:31 AM
NOTE: - This is still a problem: I confirmed that ground spawn still always have 0 charges on them if they are set to have a certain amount. They work properly if #summoned, but not if picked up from being a ground spawn.
Nevermind on the player pick up issue though lol. I figured out the problem. Apparently, the sub is called:
sub EVENT_PLAYER_PICKUP
NOT:
sub EVENT_PICK_UP
I edited the Wiki to reflect this correction. Just took a little searching through the source to figure out the root cause lol. I am not sure where people got "EVENT_PICK_UP" from though.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.