LeanWolf Posted May 23, 2016 Share Posted May 23, 2016 Hi! My house mod has a Sword-in-the-Stone style weapon display/charger, basically put in any enchanted weapon and it will recharge it. The setup is a standard vanilla weapon rack, using it's scripts, with an additional script attached to the WeaponRackTrigger.Here are the essentials of that script: EVENT onTriggerEnter(objectReference triggerRef) if(SKSE.GetVersionRelease() > 0) float WeapMaxCharge = (triggerRef.GetItemMaxCharge()) if (WeapMaxCharge > 0.0) int Count = 0 While (!triggerRef.Is3DLoaded()) && (Count < 50) Utility.Wait(0.1) ;timer to be sure object is3DLoaded before playing FX Count += 1 EndWhile WeaponChargeFX.Play(triggerRef) ;not working, except on Miraak's Staff? triggerRef.SetItemCharge(WeapMaxCharge) ;totally working endIf endif endEVENTIt works fine, except:The WeaponChargeFX does NOT play, oddly it does play for a few odd weapons, like Miraak's Staff, but otherwise no effects. Occasionally when the weapon is removed from the display, the activator does not re-enable, meaning you can't put in another weapon. As there is no other way to re-enable the activator, the display/charger becomes broken and useless.Most crucially, can anyone tell me why the activator sometimes fails to re-enable itself when the weapon is removed? I'm using USLEEP, as is most of my home's users I assume, so those WeaponRack scripts are being used (to place the weapon on the rack) together with my little additional charging script. Less importantly, but also anoying, can someone tell me how to get the special charging effects to play? I've tried sending the effect to a static object instead of the weapon but it still doesn't appear. Any help would be greatly appreciated, thanks. Link to comment Share on other sites More sharing options...
Fantafaust Posted May 28, 2016 Share Posted May 28, 2016 This may sound stupid, but I honestly don't know, so here it is: Isn't your code in OnTriggerEnter only run when the trigger is entered? ie it would be run when you opened the rack, but not when you closed it? If that was the case, wouldn't it be better to set up the FX to play in the OnTriggerLeave event?Or am I missing something here? Link to comment Share on other sites More sharing options...
LeanWolf Posted May 29, 2016 Author Share Posted May 29, 2016 Isn't your code in OnTriggerEnter only run when the trigger is entered? ie it would be run when you opened the rack, but not when you closed it? If that was the case, wouldn't it be better to set up the FX to play in the OnTriggerLeave event?I want the special effect to play when the weapon is charged, so yes when it is placed on the rack. I cannot play an effect on an item that has left the rack, and it wouldn't look right to play the charged effect when the weapon is removed. Thanks for your reply though, I'm at a complete loss as to why the effects won't play for most weapons, but will for a rare few. I'd also dearly like to know why the activator sometimes doesn't re-enable itself when the weapon is removed. I may have to head over to the AFK forums to see if some of the Papyrus gurus who re-made the weapon rack scripts can shed some light on these mysteries. Link to comment Share on other sites More sharing options...
Elias555 Posted May 29, 2016 Share Posted May 29, 2016 Cool idea! Playing vfx is a weird one, it annoyed me to no end before it finally worked out for me. How much of the code can you strip away before the vfx plays? Link to comment Share on other sites More sharing options...
LeanWolf Posted May 29, 2016 Author Share Posted May 29, 2016 How much of the code can you strip away before the vfx plays?That pretty much is the whole script, minus the properties. I haven't tried removing anything, as it's already as minimal as I can make it. Link to comment Share on other sites More sharing options...
Elias555 Posted May 29, 2016 Share Posted May 29, 2016 How much of the code can you strip away before the vfx plays?That pretty much is the whole script, minus the properties. I haven't tried removing anything, as it's already as minimal as I can make it. That's not what I mean. Remove conditions until the vfx plays then slowly add what you need and see what's causing the vfx not to play. It's just for testing purposes. Link to comment Share on other sites More sharing options...
Fantafaust Posted May 29, 2016 Share Posted May 29, 2016 (edited) I rarely if ever went into houses in my games, and never used the weapon racks, so I didn't know you just clicked to place the weapon.Does the rack not activate at all unless you place a weapon in it, or do you think you might need a check for there being a weapon in it in the first place?EDIT: Reading up on the AFK forums has led me to believe that perhaps it's the racks themselves, as they seem to despise script changes. So is your testing being performed on a totally new game, or are you entering and exiting the cell with the racks enough times to make it set up correctly? Edited May 30, 2016 by Fantafaust Link to comment Share on other sites More sharing options...
LeanWolf Posted May 30, 2016 Author Share Posted May 30, 2016 Reading up on the AFK forums has led me to believe that perhaps it's the racks themselves, as they seem to despise script changes.I'm almost certain it's the WeaponRack scripts that are somehow interfering, or vice versa. I think I'll just set up a button to re-enable the activator should it refuse to do so on its own. The effects I can live without. Link to comment Share on other sites More sharing options...
Fantafaust Posted May 30, 2016 Share Posted May 30, 2016 (edited) Are you sure a new game wouldn't fix it? I'd be interested in testing this for you. Can you upload a plugin for me to try out?EDIT:reading this Dissection Article I believe I see that OnLoad is when the weapon is actually loaded in 3D on the rack. Have you tried placing your code in that event instead? Edited May 30, 2016 by Fantafaust Link to comment Share on other sites More sharing options...
LeanWolf Posted May 31, 2016 Author Share Posted May 31, 2016 I added an onTriggerLeave section to re-enable the activator (even though the weaponRack scripts should handle that) and it seems to work now, the effects even play more often now. Link to comment Share on other sites More sharing options...
Recommended Posts