Jump to content

Problem with function that check if player standing next to water


Zoom

Recommended Posts

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

I have a function from Koray that check if player standing next to water.

 

bool CHARACTER::IsNearWater() const
{
	if (!GetSectree())
		return false;
	
	for (int x = -1; x <= 1; ++x)
	{
		for (int y = -1; y <= 1; ++y)
		{
			if (IS_SET(GetSectree()->GetAttribute(GetX() + x * 100, GetY() + y * 100), ATTR_WATER))
				return true;
		}
	}
	
	return false;
}

 

I need to use this function in quest, so i maked something like this:

 

int pc_near_water(lua_State* L)
	{
		LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
		
		if (ch)
			lua_pushboolean(L, ch->IsNearWater());
		
		return 0;
	}

 

That's all i have but when i try fishing nex to water or anywhere i want, i can't.

 

Anybody can help me?

Link to comment
Share on other sites

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


  • Similar Content

  • Activity

    1. 1

      Metin2 Property objects loaded from D:/ymir work

    2. 20

      Item ToolTip Width Fix

    3. 4

      Connection problem

    4. 1276

      [40250] Reference Serverfile + Client + Src [15 Available Languages]

    5. 1276

      [40250] Reference Serverfile + Client + Src [15 Available Languages]

    6. 1276

      [40250] Reference Serverfile + Client + Src [15 Available Languages]

    7. 1

      Sanii Switchbot problem

    8. 4

      Connection problem

  • 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.