Jump to content

Arrows quiver not working


Recommended Posts

  • Management

Hello,

I've tried to implement the arrows quiver system on my server, but it doesn't do any damage (either on hit or skill) and the effect doesn't show.

A little video:

https://www.youtube.com/watch?v=i-2QZvEnZsg

I already check the tutorial 3 times, but I can't seem to find anything wrong...

If anyone knew the solution, I would appreciate.

Thanks

raw

raw

Link to comment
Share on other sites

  • Replies 16
  • Created
  • Last Reply

Top Posters In This Topic

  • Management
8 hours ago, Xploitz said:

You probably missed something in battle.cpp. Post the CalcArrowDamage function from your battle.cpp here.

int CalcArrowDamage(LPCHARACTER pkAttacker, LPCHARACTER pkVictim, LPITEM pkBow, LPITEM pkArrow, bool bIgnoreDefense)
{
	if (!pkBow || pkBow->GetType() != ITEM_WEAPON || pkBow->GetSubType() != WEAPON_BOW)
		return 0;
	
	if (!pkArrow)
		return 0;
	
	int iDist = (int) (DISTANCE_SQRT(pkAttacker->GetX() - pkVictim->GetX(), pkAttacker->GetY() - pkVictim->GetY()));
	int iGap = (iDist / 100) - 5 - pkAttacker->GetPoint(POINT_BOW_DISTANCE);
	int iPercent = 100 - (iGap * 5);
#ifdef __NEW_ARROW_SYSTEM__
	if (pkArrow->GetSubType() == WEAPON_UNLIMITED_ARROW)
	{
		iPercent = 100;
	}
#endif
	
	if (iPercent <= 0)
		return 0;
	else if (iPercent > 100)
		iPercent = 100;
	
	int iDam = 0;
	float fAR = CalcAttackRating(pkAttacker, pkVictim, false);
	iDam = number(pkBow->GetValue(3), pkBow->GetValue(4)) * 2 + pkArrow->GetValue(3);
	
	int iAtk;
	iAtk = pkAttacker->GetPoint(POINT_ATT_GRADE) + iDam - (pkAttacker->GetLevel() * 2);
	iAtk = (int) (iAtk * fAR);
	iAtk += pkAttacker->GetLevel() * 2;
	
	iAtk += pkBow->GetValue(5) * 2;
	iAtk += pkAttacker->GetPoint(POINT_PARTY_ATTACKER_BONUS);
	iAtk = (int) (iAtk * (100 + (pkAttacker->GetPoint(POINT_ATT_BONUS) + pkAttacker->GetPoint(POINT_MELEE_MAGIC_ATT_BONUS_PER))) / 100);
	iAtk = CalcAttBonus(pkAttacker, pkVictim, iAtk);
	
	int iDef = 0;
	if (!bIgnoreDefense)
		iDef = (pkVictim->GetPoint(POINT_DEF_GRADE) * (100 + pkAttacker->GetPoint(POINT_DEF_BONUS)) / 100);
	
	if (pkAttacker->IsNPC())
		iAtk = (int) (iAtk * pkAttacker->GetMobDamageMultiply());
	
	iDam = MAX(0, iAtk - iDef);
	
	int iPureDam = iDam;
	iPureDam = (iPureDam * iPercent) / 100;
	if (test_server)
	{
		pkAttacker->ChatPacket(CHAT_TYPE_INFO, "ARROW %s -> %s, DAM %d DIST %d GAP %d %% %d", pkAttacker->GetName(), pkVictim->GetName(), iPureDam, iDist, iGap, iPercent);
	}

	return iPureDam;
}

 

raw

raw

Link to comment
Share on other sites

  • Premium
29 minutes ago, charparodar said:

The blue effect doesn't work always, but that's not a big deal, I wanted it to do damage...

Hi, could you send me your item subtypes anum, and the subtypes of arrows and quiver you are using?

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

  • Management
4 minutes ago, Syreldar said:

Hi, could you send me your item subtypes anum, and the subtypes of arrows and quiver you are using?

enum EWeaponSubTypes
{
	WEAPON_SWORD,
	WEAPON_DAGGER,
	WEAPON_BOW,
	WEAPON_TWO_HANDED,
	WEAPON_BELL,
	WEAPON_FAN,
	WEAPON_ARROW,
	WEAPON_MOUNT_SPEAR,
#ifdef __NEW_ARROW_SYSTEM__
	WEAPON_UNLIMITED_ARROW,
#endif
	WEAPON_NUM_TYPES,
};
	static string arSub1[] = { "WEAPON_SWORD", "WEAPON_DAGGER", "WEAPON_BOW", "WEAPON_TWO_HANDED",
				"WEAPON_BELL", "WEAPON_FAN", "WEAPON_ARROW", 
#ifdef __NEW_ARROW_SYSTEM__
				"WEAPON_UNLIMITED_ARROW",
#endif
				"WEAPON_MOUNT_SPEAR"};

Is this what you asked for?

Thanks

raw

raw

Link to comment
Share on other sites

  • Premium
Just now, charparodar said:

enum EWeaponSubTypes
{
	WEAPON_SWORD,
	WEAPON_DAGGER,
	WEAPON_BOW,
	WEAPON_TWO_HANDED,
	WEAPON_BELL,
	WEAPON_FAN,
	WEAPON_ARROW,
	WEAPON_MOUNT_SPEAR,
#ifdef __NEW_ARROW_SYSTEM__
	WEAPON_UNLIMITED_ARROW,
#endif
	WEAPON_NUM_TYPES,
};

	static string arSub1[] = { "WEAPON_SWORD", "WEAPON_DAGGER", "WEAPON_BOW", "WEAPON_TWO_HANDED",
				"WEAPON_BELL", "WEAPON_FAN", "WEAPON_ARROW", 
#ifdef __NEW_ARROW_SYSTEM__
				"WEAPON_UNLIMITED_ARROW",
#endif
				"WEAPON_MOUNT_SPEAR"};

Is this what you asked for?

Thanks

The problem is for sure not in the CalcArrowDamage method, else you would receive the test_server debug messages.

Can you show me your 

int CHARACTER::GetArrowAndBow(LPITEM * ppkBow, LPITEM * ppkArrow, int iArrowCount)

and your

void CHARACTER::UseArrow(LPITEM pkArrow, DWORD dwArrowCount)

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

  • Management
1 minute ago, Syreldar said:

The problem is for sure not in the CalcArrowDamage method, else you would receive the test_server debug messages.

Can you show me your 


int CHARACTER::GetArrowAndBow(LPITEM * ppkBow, LPITEM * ppkArrow, int iArrowCount)

and your


void CHARACTER::UseArrow(LPITEM pkArrow, DWORD dwArrowCount)

int CHARACTER::GetArrowAndBow(LPITEM * ppkBow, LPITEM * ppkArrow, int iArrowCount)
{
	LPITEM pkBow;
	if (!(pkBow = GetWear(WEAR_WEAPON)) || pkBow->GetProto()->bSubType != WEAPON_BOW )
	{
		return 0;
	}
	
	LPITEM pkArrow;
#ifdef __NEW_ARROW_SYSTEM__
	if (!(pkArrow = GetWear(WEAR_ARROW)) || pkArrow->GetType() != ITEM_WEAPON || pkArrow->GetProto()->bSubType != WEAPON_ARROW && pkArrow->GetProto()->bSubType != WEAPON_UNLIMITED_ARROW)
#else
	if (!(pkArrow = GetWear(WEAR_ARROW)) || pkArrow->GetType() != ITEM_WEAPON || pkArrow->GetProto()->bSubType != WEAPON_ARROW)
#endif
	{
		return 0;
	}
	
#ifdef __NEW_ARROW_SYSTEM__
	if (pkArrow->GetProto()->bSubType == WEAPON_UNLIMITED_ARROW)
	{
		iArrowCount = MIN(iArrowCount, 200);
	}
	else
	{
		iArrowCount = MIN(iArrowCount, pkArrow->GetCount());
	}
#else
	iArrowCount = MIN(iArrowCount, pkArrow->GetCount());
#endif

	*ppkBow = pkBow;
	*ppkArrow = pkArrow;
	return iArrowCount;
}

void CHARACTER::UseArrow(LPITEM pkArrow, DWORD dwArrowCount)
{
#ifdef __NEW_ARROW_SYSTEM__
	if (pkArrow->GetSubType() != WEAPON_UNLIMITED_ARROW)
	{
		int iCount = pkArrow->GetCount();
		DWORD dwVnum = pkArrow->GetVnum();
		iCount = iCount - MIN(iCount, dwArrowCount);
		pkArrow->SetCount(iCount);
		if (iCount == 0)
		{
			LPITEM pkNewArrow = FindSpecifyItem(dwVnum);
			sys_log(0, "UseArrow : FindSpecifyItem %u %p", dwVnum, get_pointer(pkNewArrow));
			if (pkNewArrow)
				EquipItem(pkNewArrow);
		}
	}
#else
	int iCount = pkArrow->GetCount();
	DWORD dwVnum = pkArrow->GetVnum();
	iCount = iCount - MIN(iCount, dwArrowCount);
	pkArrow->SetCount(iCount);
	if (iCount == 0)
	{
		LPITEM pkNewArrow = FindSpecifyItem(dwVnum);
		sys_log(0, "UseArrow : FindSpecifyItem %u %p", dwVnum, get_pointer(pkNewArrow));
		if (pkNewArrow)
			EquipItem(pkNewArrow);
	}
#endif
}

 

raw

raw

Link to comment
Share on other sites

  • Premium

Either pkArrow returns a null value for some reason, or the subtype you are using for the quiver item is incorrect.

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

  • Management
37 minutes ago, Syreldar said:

Either pkArrow returns a null value for some reason, or the subtype you are using for the quiver item is incorrect.

db/src/ProtoReader.cpp:

	static string arSub1[] = { "WEAPON_SWORD", "WEAPON_DAGGER", "WEAPON_BOW", "WEAPON_TWO_HANDED",
				"WEAPON_BELL", "WEAPON_FAN", "WEAPON_ARROW", 
#ifdef __NEW_ARROW_SYSTEM__
				"WEAPON_UNLIMITED_ARROW",
#endif
				"WEAPON_MOUNT_SPEAR"};

dump_proto/ItemCSVReader.cpp:

string arIAFVSub1[] = { "WEAPON_SWORD", "WEAPON_DAGGER", "WEAPON_BOW", "WEAPON_TWO_HANDED",
"WEAPON_BELL", "WEAPON_FAN", "WEAPON_ARROW", "WEAPON_UNLIMITED_ARROW", "WEAPON_MOUNT_SPEAR" };

common/item_lenght.h:

enum EWeaponSubTypes
{
	WEAPON_SWORD,
	WEAPON_DAGGER,
	WEAPON_BOW,
	WEAPON_TWO_HANDED,
	WEAPON_BELL,
	WEAPON_FAN,
	WEAPON_ARROW,
	WEAPON_MOUNT_SPEAR,
#ifdef __NEW_ARROW_SYSTEM__
	WEAPON_UNLIMITED_ARROW,
#endif
	WEAPON_NUM_TYPES,
};

Client/GameLib/ItemData.h:

		enum EWeaponSubTypes
		{
			WEAPON_SWORD,
			WEAPON_DAGGER,	//À̵µ·ù
			WEAPON_BOW,
			WEAPON_TWO_HANDED,
			WEAPON_BELL,
			WEAPON_FAN,
			WEAPON_ARROW,
#ifdef ENABLE_NEW_ARROW_SYSTEM
			WEAPON_UNLIMITED_ARROW,
#endif
			WEAPON_MOUNT_SPEAR,

			WEAPON_NUM_TYPES,

			WEAPON_NONE = WEAPON_NUM_TYPES+1,
		};

Item_proto.txt

79501	"??? ???1"	"ITEM_WEAPON"	"WEAPON_UNLIMITED_ARROW"	1	"ANTI_MUSA | ANTI_SURA | ANTI_MUDANG | ANTI_DROP | ANTI_GIVE | ANTI_MYSHOP | ANTI_SAFEBOX"	"ITEM_STACKABLE | ITEM_SLOW_QUERY"	"WEAR_ARROW"	"NONE"	100000	0	0	0	0	"REAL_TIME"	86400	"LIMIT_NONE"	0	"APPLY_NONE"	0	"APPLY_NONE"	0	"APPLY_NONE"	0	17	4	0	25	0	0	0	0	0
79502	"??? ???7"	"ITEM_WEAPON"	"WEAPON_UNLIMITED_ARROW"	1	"ANTI_MUSA | ANTI_SURA | ANTI_MUDANG | ANTI_DROP | ANTI_GIVE | ANTI_MYSHOP | ANTI_SAFEBOX"	"ITEM_STACKABLE | ITEM_SLOW_QUERY"	"WEAR_ARROW"	"NONE"	550000	0	0	0	0	"REAL_TIME"	604800	"LIMIT_NONE"	0	"APPLY_NONE"	0	"APPLY_NONE"	0	"APPLY_NONE"	0	17	4	0	25	0	0	0	0	0
79503	"??? ???15"	"ITEM_WEAPON"	"WEAPON_UNLIMITED_ARROW"	1	"ANTI_MUSA | ANTI_SURA | ANTI_MUDANG | ANTI_DROP | ANTI_GIVE | ANTI_MYSHOP | ANTI_SAFEBOX"	"ITEM_STACKABLE | ITEM_SLOW_QUERY"	"WEAR_ARROW"	"NONE"	0	0	0	0	0	"REAL_TIME"	1296000	"LIMIT_NONE"	0	"APPLY_NONE"	0	"APPLY_NONE"	0	"APPLY_NONE"	0	17	4	0	25	0	0	0	0	0
79504	"??? ???30"	"ITEM_WEAPON"	"WEAPON_UNLIMITED_ARROW"	1	"ANTI_MUSA | ANTI_SURA | ANTI_MUDANG | ANTI_DROP | ANTI_GIVE | ANTI_MYSHOP | ANTI_SAFEBOX"	"ITEM_STACKABLE | ITEM_SLOW_QUERY"	"WEAR_ARROW"	"NONE"	0	0	0	0	0	"REAL_TIME"	2592000	"LIMIT_NONE"	0	"APPLY_NONE"	0	"APPLY_NONE"	0	"APPLY_NONE"	0	17	4	0	25	0	0	0	0	0

I think this is all that is related to the subtype...

raw

raw

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 months later...

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.