Author Topic: Question : weapon buffs from scrolls staying on ....  (Read 409 times)

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
Question : weapon buffs from scrolls staying on ....
« on: April 25, 2011, 12:37:31 am »


                It seems if player does not rest before exiting they keep the buffs on weapons from scrolls.

Q: What is the solution?
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Question : weapon buffs from scrolls staying on ....
« Reply #1 on: April 25, 2011, 12:45:17 am »


               Look at the script for the scroll and see what is going wrong.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Question : weapon buffs from scrolls staying on ....
« Reply #2 on: April 25, 2011, 03:00:12 am »


               This works even on all others buffs by default. Cleric can buff his friend, then relog, then rest and them buff himself and they are fully buffed both...

Some PWs solves this via dispel OnEnter, boosts on weapons/armor including, others doesnt care...
               
               

               
            

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
Question : weapon buffs from scrolls staying on ....
« Reply #3 on: April 26, 2011, 12:47:38 am »


               Problem if player logs out ,when they login the buffs on weapon are permanent

keen, magic weapon, greater magic weapon, darkfire, flame weapon, and one or two bard/paladin weapon buff

I have a script that takes buffs off PC but does not take them off weapon .Is this going to be a script or in the nwnplayer.ini file?
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Question : weapon buffs from scrolls staying on ....
« Reply #4 on: April 26, 2011, 01:16:55 am »


               I do not think what you are discribing is what normally happens.   Without knowing what scrolls are adding the proptries or seeing the script that is adding them?  I am at a loss.

Are they standard boiware scrolls?   Casting standard Bioware Spells.  Have the Spell Scripts  Been modified?
               
               

               
            

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
Question : weapon buffs from scrolls staying on ....
« Reply #5 on: April 26, 2011, 01:23:51 am »


               Sorry guys ..yes the standard darfire/greater magic weapon/scrolls and then standard weapon spells cast remain on weapon after relogging. I just tried a dispelling script oneneter like ShaDoOoW suggested but it didnt effect weapon.

void main()
{

object oPC = GetEnteringObject();

if (!GetIsPC(oPC)) return;


   // This is the Object to apply the effect to.


   // Create the effect to apply
   effect eDispelAll = EffectDispelMagicAll(40);

   // Create the visual portion of the effect. This is instantly
   // applied and not persistant with wether or not we have the
   // above effect.
   effect eVis = EffectVisualEffect(VFX_IMP_DISPEL);

   // Apply the visual effect to the target
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC);
   // Apply the effect to the object
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eDispelAll, oPC);
}
               
               

               
            

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
Question : weapon buffs from scrolls staying on ....
« Reply #6 on: April 27, 2011, 01:25:18 am »


               Deafening Clang - x2_s0_deafclng
Flame Weapon - x2_s0_flmeweap
Greater Magic Weapon - x2_s0_grmagweap
Magic Vestment - x2_s0_magvest
Blackstaff - x2_s0_blckstff

These are some of the spells staying on players weapons ...if you guys have a fix to make them temporary or a link please let me know .
               
               

               
            

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
Question : weapon buffs from scrolls staying on ....
« Reply #7 on: April 27, 2011, 02:17:16 pm »


               We had this problem too last year and I am racking my brain how we solved it...I will do a search on our archives as it sucked big beans.
               
               

               
            

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
Question : weapon buffs from scrolls staying on ....
« Reply #8 on: April 27, 2011, 02:29:59 pm »


               Thanks TSMDude ... any help or clue how to solve this is appreciated greatly . It is #1 on my list of fixes and I am reminded regularly. lol
               
               

               
            

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
Question : weapon buffs from scrolls staying on ....
« Reply #9 on: April 27, 2011, 08:50:39 pm »


               All right...I cannot find what we did. I know it was due to our game clock. Basically it was also not JUST scrlls but any spell effect. We found that we had a memory leak somewhere though that was the MAIN cause of this and plugged it as the system was getting over loaded and after we patched it it was fine.

You us enwnx too right? Check and see what script is being called too much.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Question : weapon buffs from scrolls staying on ....
« Reply #10 on: April 27, 2011, 09:03:32 pm »


               This code will allow you to delete the spells from weapons after relog.

put this above void main

// remove all temporary effect on item
void removeAllTempEffect(object oItem) {
    itemproperty vlastnost;
    if (GetIsObjectValid(oItem)) {
          vlastnost = GetFirstItemProperty(oItem);
          while (GetIsItemPropertyValid(vlastnost))
          {
            if (GetItemPropertyDurationType(vlastnost)==DURATION_TYPE_TEMPORARY) RemoveItemProperty(oItem, vlastnost);
            vlastnost = 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);
    }
}


and then add removeEffectFromWeapons(oPC) somewhere below if (!GetIsPC(oPC)) return; line

but it shouldnt happen this way, do you have any of those weapon boost spellscripts in your module? if so post it.
               
               

               


                     Modifié par ShaDoOoW, 27 avril 2011 - 08:04 .
                     
                  


            

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
Question : weapon buffs from scrolls staying on ....
« Reply #11 on: April 27, 2011, 09:57:56 pm »


               ShaDoOoW ..I will give your script a try .Thanks

The only spell as far as spells go is I adjusted the TimeStop so it doesnt effect whole module.


TSMDude  I use game version 1.69 with CEP 2.3 running on linux server.No nwnx2.
Yes it is mainly weapon spells that stay.Head DM made a list for me but not sure where I put it .
module hour is set to 2 minutes ...if I remember correctly ,it has been like this since I put server up.
I do have a save character script that fires every 2 minutes.
Also my module clock I have not made persistent.
               
               

               


                     Modifié par Knight_Shield, 27 avril 2011 - 08:59 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Question : weapon buffs from scrolls staying on ....
« Reply #12 on: April 27, 2011, 10:36:10 pm »


               

Knight_Shield wrote...
Also my module clock I have not made persistent.

This is probably the reason why its happening. The itemproperties doesnt use the same way to fade as effects, instead they have set up timeline in which they will be removed. So if the clocks doesnt advance temporary itemproperties will never fade, also if you cast a weapon spell in the day 10 after module start day, the fade day will be set to lets say 11 after module start but if player logout and then log in when server restarts his weapons still be set to fade on day 11. Guess this is not removed after rest by default cos another issue I explained above. So adding that script above into OnPlayerRest event is probably good idea too.
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Question : weapon buffs from scrolls staying on ....
« Reply #13 on: April 28, 2011, 12:50:02 am »


               I just do a remove temporary item property on unequip, and then on rest I also unequip the items in the players right and left hand. Of course this is somewhat related to my rest/fatigue system where players will need to periodically rest to recover fatigue. Yeah and you should get Dekalens persistent clock too,  Comes in real handy with the seasonal weather changes where I use Blasco Yangs weather system.  Probably one reason I have not had too much trouble in this regard since I have been using Dekalen's persistent clock for so long.  One other reason I use remove temp properties was to avoid certain exploits like selling magic items with temporary porperies on them. 
               
               

               


                     Modifié par ffbj, 27 avril 2011 - 11:58 .
                     
                  


            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
Question : weapon buffs from scrolls staying on ....
« Reply #14 on: April 29, 2011, 07:28:39 am »


               Simply add the following in your modules OnAcquired Event:

object oItem = GetModuleItemAcquired();
    IPRemoveAllItemProperties(oItem,DURATION_TYPE_TEMPORARY);

When a player relogs, all equipment on their PC is recreated, IE acquired, and this is the best place to catch and correct the issue. The only drawback is that if a player crashes and relogs, their weapon buffs are gone.