Sphereserver / Source-X

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

@CombatEnd not fired sometimes and combat memories not deleted from players when npcs dies #1055

Closed DavideRei closed 1 year ago

DavideRei commented 1 year ago

Tested with last version and clean script pack

[events e_player_generic_event] //Generic event to all players

ON=@CombatStart say combat start

ON=@CombatEnd say combat end

ON=@CombatAdd say combat add

ON=@CombatDelete say combat delete

.add c_zombie and start the fight

If you kill the zombie with a melee weapon, like i_dagger, @combatEnd doesn't fire. Also if you check the player memories the zombie fight memory is still there (unnamed) linked to a uid that doesn't exists anymore.

If you kill the zombie with magic, like harm, @combatEnd works but there still the memory problem.

Tested with GM account and player account.

Tolokio commented 1 year ago

there was another issue that may be related. I dont find it. But npcs were staying in warmode undef cos combat never ends. I remember I spent a lot of time trying to understand all. I never found the reason.

Jhobean commented 1 year ago

This one?https://github.com/Sphereserver/Source-X/issues/517

DavideRei commented 1 year ago

i don't know if is related, in this case the problem is on players and is not about statf_war. I have to test it between npcs. When the last attacker is deleted from the list, because is killed by melee weapons, @combatEnd doesn't fire.

In the meantime i solved it by script, like this:

ON=@CombatDelete
if (<memoryfind.<src>>) //To remove fight memory linked to the dead npc. Maybe i can check if the attacker is not a player.
    memoryfind.<src>.remove
endif
if (<attacker> == 1) //To fire @combatEnd if it's the last attacker
    fulltrigger @CombatEnd
endif
DavideRei commented 1 year ago

Same problem between players, @combatEnd doesn't fire with melee weapons, works is the player is killed by harm spell. The fight memory remains, but i think is ok in this case, because the uid exists.

Betweens npcs (2 zombies) @combatEnd seems to be called twice, and the fight memory is removed. no statf_war flag on the winner zombie.

drk84 commented 1 year ago

Possible Fix sent.

DavideRei commented 1 year ago

It seems to work, thank you

@CombatEnd doesn't fire when a player with attacker > 0 dies, i don't know if it can be related or if it's the desired behavior

GladieUO commented 1 year ago

for me the memory is still there as "unnamed" even tho NPC dies.

drk84 commented 1 year ago

Chec the color flag in the memory, what they are?

drk84 commented 1 year ago

It seems to work, thank you

@CombatEnd doesn't fire when a player with attacker > 0 dies, i don't know if it can be related or if it's the desired behavior

Yes it's supposed to be fired when the whole attacker list is going to be cleared

GladieUO commented 1 year ago

Chec the color flag in the memory, what they are?

one of three monsters memory was deleted, the rest is unnamed. One color flag is 020, second one 0b1.

edit: another attempt both of 2 monsters that died = both of memories deleted :octocat:

cbnolok commented 1 year ago

Closing as apparently completed and abandoned discussion