Yesterday I ran across a very new problem. I tried to change a graphic of an equipped item.
The graphic updated correctly to the character who wore the item.
Characters nearby didn't see the difference - to them, item's graphic stayed the same.
Same happened if the modified item was onto NPC.
Packets sent by POL were absolutely the same. For some reason onlooking clients just did not update the view accordingly.
It wasn't until the character went away and returned back that the item's graphic updated.
I tried this with different items.
I tried sending the 0x2E packet again after .graphic change.
Finally I tried to solve the error by sending delete object packet (
http://packets.polserver.com/index.php?op=showpacket&packet=0x1D) just before updating the graphic member, and that seems to solve it.
I tested this using client 5.0.6c, and finally the discussion may begin... Is this something that the newer clients introducted, or just a mistake of mine? If latter, what is the error I made? If this "feature" do exist, is it possible to alter core to do the job, so scripters would not have to create ChangeGraphic()-functions to work around this problem?
Using the 5.0.6c client, the error occurs on both POL097RC5 and POL097 2008-02-26.
--
Just in case someone needs it, this is one way to solve this problem: use the function below instead of item.graphic (when changing graphic of an item equipped to character [using 5.0.6c client {if what said above if valid}])
Code:
function ChangeGraphic( item, graphic )
var mobile := item.container;
if (mobile)
var packet := CreatePacket(0x1D, 5);
packet.SetInt32(1, item.serial);
foreach player in ListMobilesNearLocationEx(mobile.x, mobile.y, mobile.z, 18, LISTEX_FLAG_NORMAL + LISTEX_FLAG_HIDDEN + LISTEX_FLAG_GHOST + LISTEX_FLAG_CONCEALED, mobile.realm)
if (!player.isa(POLCLASS_NPC))
if (mobile != player)
packet.SendPacket(player);
endif
endif
endforeach
endif
item.graphic := graphic;
endfunction