Jump to content
Maintenance ×
×
×
  • Create New...
  • 0

Pet PickUp


Karbust

Question

  • Web Developer

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)

QJ0orbR.png

Metin2 Icon Database

Link to comment
Share on other sites

  • Answers 1
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

1 answer to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.


  • Activity

    1. 1

      Metin2 TitleBar Move Frezze

    2. 1

      Metin2 TitleBar Move Frezze

    3. 0

      Navicat "Trial" Reset

    4. 13

      Item ToolTip Width Fix

    5. 0

      Guild icon wrong position

    6. 3

      Monster health

    7. 4

      Luffy Pet

    8. 38

      Core X → Top Metin2 & Metin2 Download → Changelogs

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.