Jump to content

Recommended Posts

  • Management

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)

raw

raw

Link to comment
Share on other sites

  • 9 months later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 3

      Crystal Metinstone

    2. 3

      Feeding game source to LLM

    3. 113

      Ulthar SF V2 (TMP4 Base)

    4. 3

      Feeding game source to LLM

    5. 0

      Target Information System

    6. 3

      Feeding game source to LLM

    7. 2

      anti exp explanation pls

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • 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.