Management Karbust 4927 Posted August 1, 2017 Management Share Posted August 1, 2017 Hello, I'm having a trouble when I'm trying to create a function to block/unblock pet pick up. This are my functions: int pet_pick_up(lua_State* L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); CPetSystem* petSystem = ch->GetPetSystem(); CPetActor* petActor; if (0 == petSystem) return 0; petActor->CanPickUp(lua_toboolean(L, 1)); return 1; } int pet_cant_pick_up(lua_State* L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); CPetSystem* petSystem = ch->GetPetSystem(); CPetActor* petActor; if (0 == petSystem) return 0; petActor->CanPickUp(lua_toboolean(L, 0)); return 1; } This is my other functions on PetSystem public: bool PickUpAuto() const { return pickup; }; void CanPickUp(bool pick) { pickup = pick; }; private: bool pickup; On CPetActor::Update I'm using this: if (this->IsSummoned()) { if(!PickUpAuto()) return true; this->BringItem(); this->PickUpItems(900); // 900 = RANGE } On the quest: if pc.getqf("pickup_pet") == 0 then pet.pick_up() pc.setqf("pickup_pet", 1) syschat("Pickup da pet ativado.") return elseif pc.getqf("pickup_pet") == 1 then pet.cant_pick_up() pc.setqf("pickup_pet", 0) syschat("Pickup da pet desativado.") return end Sometimes it blocks, sometimes it doesn't, I can't specify more because I can't find a pattern... Thanks P.S.: I'm using this Pet Pick Up System: https://pastebin.com/pjGgK8Qz (it was posted on another community) Link to comment Share on other sites More sharing options...
Management Karbust 4927 Posted May 2, 2018 Author Management Share Posted May 2, 2018 BUMP 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