Aller au contenu

Photo

Fixing temporary IPs wich last forever


  • Veuillez vous connecter pour répondre
9 réponses à ce sujet

#1
Kato -

Kato -
  • Members
  • 392 messages
Greetings,

This is an old, well known bug, apply a temp property to your weapon and relog before it expires and you have a permanent item property. Although one can loop throught all inventory items and remove temp props in the OnClientEnter handler, I'm wondering if there's a cleaner fix to this?

Thank you


Kato

#2
SHOVA

SHOVA
  • Members
  • 522 messages
I think this was fixed with 1.69, or one of the expansions. I suggest updating your mod event scripts to the latest. The on client leave, on client enter. that is where the fix should be.

#3
Kato -

Kato -
  • Members
  • 392 messages
Thank you, SHOVA, but unfortunately my mod is very up-to-date and the the bug is still there. Are you sure that 1.69 fixed this?


Kato

#4
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
I only had this issue in my mod before I go the persistent time routines set up for it. The temporary properties should have a timestamp on them for the expiry still, which is auto checked on logging in.

I'll just double check this in my mod though to be sure.

#5
Kato -

Kato -
  • Members
  • 392 messages
Hey Failed.Bard, thank you, this is interesting. When you say that the timestamp is auto-checked, you mean by an integrated system or the server itself?


Kato

#6
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
It looks like temporary item properties are stored on the object an an effect, along with the creator and the timetamp for expiration, based on looking at the item in the .bic file in the server vault.
The game removed the effect from the item I test enchanted on logging back in past its expiration time.

I do think logging out and back in still seperates the caster object stored on it though, which was a common trick I've seen used in quite a few PWs in order to get extra buffs in, or to keep them when the caster needed to rest but the people they enchanted didn't.

#7
Shadooow

Shadooow
  • Members
  • 4 471 messages

SHOVA wrote...

I think this was fixed with 1.69, or one of the expansions. I suggest updating your mod event scripts to the latest. The on client leave, on client enter. that is where the fix should be.


it wasn't its not a bug per see, rather than PW issue, reason why this is happening is that temporary itemproperties have a timestamp when created which tell the game when they should be removed, the problem arise when the PW module restart -> this reset clocks to toolset default date which is way lower than date of itemproperties expiration

persistent time should fix it, if not try this piece of code in your OnClientEnter script:

this should go above void main()

void removeAllTempEffect(object oItem)
{
itemproperty ip = GetFirstItemProperty(oItem);
 while(GetIsItemPropertyValid(ip))
 {
  if(GetItemPropertyDurationType(ip) == DURATION_TYPE_TEMPORARY)
  {
  RemoveItemProperty(oItem, ip);
  }
 ip = GetNextItemProperty(oItem);
 }
}

void removeEffectFromWeapons(object oPC) {
    removeAllTempEffect(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC));
    removeAllTempEffect(GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oPC));
    removeAllTempEffect(GetItemInSlot(INVENTORY_SLOT_CHEST,oPC));
    removeAllTempEffect(GetItemInSlot(INVENTORY_SLOT_CARMOUR,oPC));

    // remove effect also from all item in invertory
    object oItem = GetFirstItemInInventory(oPC);
    while (oItem != OBJECT_INVALID) {
        removeAllTempEffect(oItem);
        oItem = GetNextItemInInventory(oPC);
    }
}

this somwhere inside:

removeEffectFromWeapons(GetEnteringObject());



#8
Kato -

Kato -
  • Members
  • 392 messages
Thanks for the precisions and the the code snippet, ShadoOoW.


Kato

#9
ffbj

ffbj
  • Members
  • 593 messages
I put it on unequipped for weapons too. Oh you expect that your flaming sword will still be flaming after you sheathed it and pulled out another weapon? I don't think so. But that's just the curmudgeon in me.

#10
Kato -

Kato -
  • Members
  • 392 messages
Quite logical indeed, ffbj.