Author Topic: Fixing temporary IPs wich last forever  (Read 341 times)

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Fixing temporary IPs wich last forever
« on: December 17, 2011, 04:15:55 pm »


               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
               
               

               
            

Legacy_SHOVA

  • Hero Member
  • *****
  • Posts: 893
  • Karma: +0/-0
Fixing temporary IPs wich last forever
« Reply #1 on: December 17, 2011, 04:22:07 pm »


               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.
               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Fixing temporary IPs wich last forever
« Reply #2 on: December 17, 2011, 04:28:29 pm »


               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
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Fixing temporary IPs wich last forever
« Reply #3 on: December 17, 2011, 04:41:35 pm »


               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.
               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Fixing temporary IPs wich last forever
« Reply #4 on: December 17, 2011, 04:48:46 pm »


               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
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Fixing temporary IPs wich last forever
« Reply #5 on: December 17, 2011, 05:08:48 pm »


               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.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Fixing temporary IPs wich last forever
« Reply #6 on: December 17, 2011, 06:48:08 pm »


               

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());


               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Fixing temporary IPs wich last forever
« Reply #7 on: December 17, 2011, 07:09:31 pm »


               Thanks for the precisions and the the code snippet, ShadoOoW.


Kato
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Fixing temporary IPs wich last forever
« Reply #8 on: December 18, 2011, 03:13:21 am »


               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.
               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Fixing temporary IPs wich last forever
« Reply #9 on: December 18, 2011, 04:08:52 pm »


               Quite logical indeed, ffbj.