Sphereserver / Source-X

Ultima Online server emulator
Apache License 2.0
58 stars 47 forks source link

Decay timer not set on ammo at @hitmiss #1072

Closed DavideRei closed 1 year ago

DavideRei commented 1 year ago

When you miss a ranged attack and an ammo is created on the ground, the timer on the ammo is -1

On Garbage Collection you get errors

image

Jhobean commented 1 year ago

Nice, I had this error but did not know why. Good find

canerksk commented 1 year ago

In CCharFight.cpp, close 1912 lines and replace it.

pAmmo->UnStackSplit(1);
1912. //pAmmo->MoveToDecay(pCharTarg->GetTopPoint(), g_Cfg.m_iDecay_Item);
pAmmo->MoveNear(pCharTarg->GetTopPoint(), 0);
pAmmo->Update();
pAmmo->SetDecayTimeS(g_Cfg.m_iDecay_Item);

I added it and the problem was solved. I don't know if this is the real solution but I don't have a problem right now. In fact, a local variable can be added for the arrow thrown as well as the local.arrow local variable in the bag. for example "Local.ArrowThrown" so that the thrown arrow can be closed or deleted with the script.

This issue was most likely after the item creation and timing order was changed.

related issue; https://github.com/Sphereserver/Source-X/issues/1027

drk84 commented 1 year ago

Fix sent

DavideRei commented 1 year ago

it works, thank you