avertuss 48 Posted February 24, 2016 Share Posted February 24, 2016 Hello, i have function int game_drop_map(lua_State* L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); LPITEM item = NULL; PIXEL_POSITION pos; long kordx = 0; long kordy = 0; // Id Itemu if (lua_isnumber(L, 1)) { item = ITEM_MANAGER::instance().CreateItem((DWORD)lua_tonumber(L, 1)); } //Kord x if (lua_isnumber(L, 2)) { kordx = ((DWORD)lua_tonumber(L, 2)); } // kord y if (lua_isnumber(L, 3)) { kordy = ((DWORD)lua_tonumber(L, 3)); } pos.x = kordx; pos.y = kordy; item->AddToGround(ch->GetMapIndex(), pos); item->StartDestroyEvent(); item->SetOwnership(ch); return 0; } item is on ground, but without ownership. Can you repair this function? Link to comment Share on other sites More sharing options...
ondry 334 Posted February 24, 2016 Share Posted February 24, 2016 shouldn't you first set ownership and then drop the item ? Spoiler item->SetOwnership(ch); item->AddToGround(ch->GetMapIndex(), pos); item->StartDestroyEvent(); Link to comment Share on other sites More sharing options...
avertuss 48 Posted February 24, 2016 Author Share Posted February 24, 2016 Idk. I use this in quest like this game.drop_map(19, 330926, 759282) Link to comment Share on other sites More sharing options...
Frozen 189 Posted February 24, 2016 Share Posted February 24, 2016 There is a function called game.drop_item_with_ownership because of that Usage: game.drop_item_with_ownership(vnum, count, time on floor) Link to comment Share on other sites More sharing options...
avertuss 48 Posted February 24, 2016 Author Share Posted February 24, 2016 But I need a function that spawns item on which coordinates with the owner. Link to comment Share on other sites More sharing options...
Frozen 189 Posted February 24, 2016 Share Posted February 24, 2016 7 minutes ago, avertuss said: But I need a function that spawns item on which coordinates with the owner. This should work: Spoiler int game_drop_map(lua_State* L) { if (lua_isnumber(L, 1)) { const char * playername = lua_tostring(L, 1); LPCHARACTER ch = CHARACTER_MANAGER::instance().FindPC(playername); }else{ sys_err("Need to have player name in first argument!"); return 0 } LPITEM item = NULL; PIXEL_POSITION pos; long kordx = 0; long kordy = 0; // Id Itemu if (lua_isnumber(L, 2)) { item = ITEM_MANAGER::instance().CreateItem((DWORD)lua_tonumber(L, 1)); } //Kord x if (lua_isnumber(L, 3)) { kordx = ((DWORD)lua_tonumber(L, 3)); } // kord y if (lua_isnumber(L, 4)) { kordy = ((DWORD)lua_tonumber(L, 4)); } pos.x = kordx; pos.y = kordy; item->AddToGround(ch->GetMapIndex(), pos); item->StartDestroyEvent(); item->SetOwnership(ch); return 0; } Kind Regards, Frozen Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now