maxarturo Posted November 30, 2018 Share Posted November 30, 2018 (edited) Hi everyone. I've a small issue that i don't know if it is related to my script (i'm not an experienced scripter) or if it's a Skyrim related game bug ?, my issue: I've a "Magic Stone Illusion" that 2 out of 10 times that i test it, it won't work correctly (all the other magic stones work perfectly = destruction, alteration, conjuration, restoration - all Stones have the same configuration). After been hit with the correct spell is set to Activate a Lever and the Lever will activate Gate & a Light. Actor Casts Magic Spell > Magic Stone > Lever > Gate & Light * The Lever has its default script and a switch light on/off script. With the "Magic Stone Illusion" when gets hit it shows that is been activated (by turning off the symbol) but it won't activate the Lever... sometimes ???? 2/10, and here is where the puzzle gets F***** !!!, because you can't hit the Magic Stone again !!! it only works once. - If it is my script's problem, is there a way to improve it ?. - if it is a game related bug, is there a way to fix it or bypass it ?. My script: Scriptname aXMDmagicTabletAtivateLink extends ObjectReference {Will activate link ref upon hit with correct spell} bool property isDestruction auto bool property isAlteration auto bool property isRestoration auto bool property isIllusion auto bool property isConjuration auto Sound Property WrongSpellSFX Auto Sound Property CorrectSpellSFX Auto bool property done auto bool property FXon auto hidden objectReference property linkToActivate auto bool continueUpdating = FALSE EVENT onLoad() continueUpdating = TRUE registerForSingleUpdate(1.0) endEVENT EVENT onUpdate() if !FXon if game.getPlayer().getDistance(self) < 1024 && done == FALSE ; if the player is nearby, turn on the FX anim playAnimation("playanim02") FXon = TRUE endif else if game.getPlayer().getDistance(self) > 1024 && done == FALSE ; and if the player walks away without solving, turn them off playAnimation("playanim01") FXon = FALSE endif endif if continueUpdating registerForSingleUpdate(1.0) endif endEVENT EVENT onActivate(ObjectReference actronaut) ; Not meant to be activated directly. Play negative feedbackSFX WrongSpellSFX.play(self) endEVENT EVENT OnMagicEffectApply(ObjectReference akCaster, MagicEffect akEffect) ; debug.trace("hit by "+akCaster+" with "+akEffect) ; for now i can't test school so react to any magic effect if done == FALSE if (akEffect.getAssociatedSkill() == "Destruction") && isDestruction solveMe(akCaster) elseif (akEffect.getAssociatedSkill() == "Alteration") && isAlteration solveMe(akCaster) elseif (akEffect.getAssociatedSkill() == "Restoration") && isRestoration solveMe(akCaster) elseif (akEffect.getAssociatedSkill() == "Illusion") && isIllusion solveMe(akCaster) elseif (akEffect.getAssociatedSkill() == "Conjuration") && isConjuration solveMe(akCaster) else ; Must have been hit with an incorrect spell type. Play negative feedback SFX WrongSpellSFX.play(self) endif endif endEVENT FUNCTION SolveMe(objectReference whoSolved) done = TRUE ;unregisterForUpdate() continueUpdating = FALSE playAnimation("playanim01") CorrectSpellSFX.play(self) linkToActivate.Activate(whoSolved) linkToActivate.setOpen() endFUNCTION Thank you very much for taking the time to look at this, whoever you are !!!!! Edited November 30, 2018 by maxarturo Link to comment Share on other sites More sharing options...
Evangela Posted November 30, 2018 Share Posted November 30, 2018 If the object is in an interior cell, OnCellAttach is the better choice than OnLoad I think, because otherwise the object might still be loaded into memory, and the register may not happen as expected. Also, when using more than one conditional operator in a condition statement, you need to group them according to the intended logic you're aiming for. change: game.getPlayer().getDistance(self) < 1024 && done == FALSE to: (game.getPlayer().getDistance(self) < 1024) && (done == FALSE) This may or may not help. Link to comment Share on other sites More sharing options...
maxarturo Posted November 30, 2018 Author Share Posted November 30, 2018 If the object is in an interior cell, OnCellAttach is the better choice than OnLoad I think, because otherwise the object might still be loaded into memory, and the register may not happen as expected. Also, when using more than one conditional operator in a condition statement, you need to group them according to the intended logic you're aiming for. change: game.getPlayer().getDistance(self) < 1024 && done == FALSEto: (game.getPlayer().getDistance(self) < 1024) && (done == FALSE)This may or may not help.I've already try this but the "Illusion Stone" still gives me the same problem 2/10. And the weird thing is that only the "Illusion Stone" has this issue !!???.... All other stones works perfectly with the same exact set up. Thanks for replying ! Link to comment Share on other sites More sharing options...
NexusComa Posted November 30, 2018 Share Posted November 30, 2018 on load will only go off 1 time when you load the game ... Link to comment Share on other sites More sharing options...
maxarturo Posted November 30, 2018 Author Share Posted November 30, 2018 on load will only go off 1 time when you load the game ...So you too advise me to change it from.OnLoad to OnCellAttach Link to comment Share on other sites More sharing options...
PeterMartyr Posted November 30, 2018 Share Posted November 30, 2018 Personally I prefer onload, which will fired every time the object is loaded by the way. If the object is in an interior cell, OnCellAttach is the better choice than OnLoad I think, because otherwise the object might still be loaded into memory, and the register may not happen as expected. Also, when using more than one conditional operator in a condition statement, you need to group them according to the intended logic you're aiming for. change: game.getPlayer().getDistance(self) < 1024 && done == FALSEto: (game.getPlayer().getDistance(self) < 1024) && (done == FALSE)This may or may not help. No need, papyrus is not C# the && operator separated them anyway, and so they are evaluated separately already. and to take your line of thought to the ultimate coding convention, it should look like this (which I hate) & only do when I am force too. ((game.getPlayer().getDistance(self) < 1024) && (done == FALSE)) but I still think this Fine for Papyrus game.getPlayer().getDistance(self) < 1024 && done == FALSE so there no need to change it. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 30, 2018 Share Posted November 30, 2018 5 stones all with the same script. It works fine on 4 of them. Has occasional issues with the 5th one. Make sure you are testing on a clean game (one that has not seen the mod before) at all times. If testing all 5 in one session, change up the order if possible. Should a different stone start to exhibit the same issue when it falls in the same position as the initially problematic stone, then there could be some processing issue that crops up depending upon how much is in memory. Also, if possible, confirm if the problematic stone always works after a save, exit, reload. If it does, then that could be a work around for users to use should they also encounter the issue. Link to comment Share on other sites More sharing options...
maxarturo Posted December 1, 2018 Author Share Posted December 1, 2018 I think i've solve the issue... I deleted everything = Illusion stone, lever, gate, light. saved and exit CK then i runned again CK and re-build everything from scratch. Now it seems everything is working correctly after 5 testings, but i'll continue testing tomorrow, i'm too tired now. It appears to be some sort of stupid glitch !. Thanks to everyone for taking the time to reply to my post !! Link to comment Share on other sites More sharing options...
Recommended Posts