|
 |
 |
| Author |
Message |
OldnGrey
Joined: 04 Feb 2006 Posts: 517
|
|
 |
|
|
 |
 |
|
 |
 |
|
 |
 |
|
 |
 |
| Author |
Message |
OldnGrey
Joined: 04 Feb 2006 Posts: 517
|
Posted: Wed Sep 12, 2007 5:06 am Post subject: |
|
|
Interesting. Thanks for the comments. I knew it wasn't totally straightforward otherwise creating a clothed npc wouldn't work. You've helped me look a bit further.
Looking further into the code for vendors wearing an item, it appears all clothing is first stripped from the npc, then the new item equipped, then the rest are equipped. Thing is, they are equipped from the storage area which appear to be always created in britannia realm.
ie from:
inv_pb := find_or_create_item(storage, me.serial + " PB", 0xE7C);
So therefore the bug appears to be caused when an item is equipped from a different realm.
Here's the code that will show the problem:
| Code: | function wear_item(byref item, byref you)
foreach thing in ListEquippedItems(you)
if ( thing == item )
Say("But you're wearing that!");
return 0;
endif
endforeach
foreach thing in ListEquippedItems(me)
MoveItemToContainer(thing, inv_pb);
endforeach
EquipItem(me, item);
foreach thingie in ListRootItemsInContainer(inv_pb)
if ( !EquipItem(me, thingie) )
if ( GetObjProperty(thingie, "mine") )
DestroyItem(thingie);
else
MoveObjectToLocation(thingie, me.x, me.y, me.z, me.realm, MOVEOBJECT_FORCELOCATION);
endif
endif
endforeach
endfunction
|
Even more this makes me think the change responsible is still:
| Quote: | 4-23 MuadDib
Added : Realm checks in transmitting of packets to clients "in range". |
If the item starts from a different realm, perhaps we are prevented from seeing it even when it's being equipped. |
|
 |
|
|
 |
 |
|
 |
 |
|
 |
 |
|
 |
 |
|
 |
 |
|
 |
 |
|
 |
 |
|
 |
 |
| Author |
Message |
ncrsn
Joined: 10 Feb 2006 Posts: 165
|
Posted: Tue Sep 25, 2007 4:25 pm Post subject: |
|
|
| Yukiko wrote: |
| Code: | use uo;
use os;
use cfgfile;
include "include/client";
include "include/attributes";
include "equip";
program equipweapon(who, item)
if(!item.IsA(POLCLASS_CONTAINER))
MoveItemToContainer(who.backpack, item);
EquipItem(who, item);
endif
var val := HandleMods(who, item);
return val;
endprogram | |
I'm not a dev, nor have I tested out this bug you have, but isn't the code above running into eternal loop?
Equipping item launches the equipscript, where it gets equipped again and launches the equipscript and gets equipped again and ---.
If that is the problem, maybe setting a cprop into an item and ignoring it if that cprop exists could solve that? Something like this:
| Code: |
program equipscript(who, item)
if (GetObjProperty(item, "#IgnoreEquip"))
EraseObjProperty(item, "#IgnoreEquip");
return 1;
endif
SetObjProperty(item, "#IgnoreEquip", 1);
// Do rest of the normal equipping stuff.
endprogram
|
Another way could be testing if item to be equipped is in backpack already, and if it's not, moving it into it.
Didn't test this though, just got this idea. Don't know if I got any of that right. |
|
 |
|
|
 |
 |
|