Jump to content

Item.remove not working!


Recommended Posts

Hello,

This is the item remove in my source, it doesn't work when using in my quests

What's its prob ? 

 

    int item_remove(lua_State* L)
    {
        LPITEM item = CQuestManager::instance().GetCurrentItem();

        if(!item || CQuestManager::instance().GetCurrentCharacterPtr() != item->GetOwner())
        {
            lua_pushboolean(L, 0);
            return 0;
        }
        
        int count = (int)lua_tonumber(L, 1);
        
        item->SetCount(item->GetCount() - count);
        lua_pushboolean(L, 1);
        
        return 1;
    }

Link to comment
Share on other sites

  • Premium

Yes. Use item.remove(1) and it's been working.

Or replace a function to this:

int item_remove(lua_State* L)
    {
        LPITEM item = CQuestManager::instance().GetCurrentItem();

        if(!item || CQuestManager::instance().GetCurrentCharacterPtr() != item->GetOwner())
        {
            lua_pushboolean(L, 0);
            return 0;
        }
        
        item->SetCount(-item->GetCount());
        lua_pushboolean(L, 1);
        
        return 1;
    }

  • Love 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.