TrickyVein Posted November 30, 2016 Share Posted November 30, 2016 (edited) For those who understand how papyrus functions better than I do, I'd like some help understanding what is going on with this chunk of script: EVENT OnTimer(Int aiTimerID) objectreference NewExplosion if aiTimerID == 0 if (NewExplosion != None) NewExplosion.Delete() else NewExplosion = Game.FindClosestReferenceOfTypeFromRef(BaseProjectile, Self.GetCasterActor(), 10000) if self.getcasteractor().getdistance(NewExplosion) > 500 NewExplosion.PlaceAtMe(BaseExplosion, 1) endif if bIsNidHogg == True else NewExplosion = None endif StartTimer(fAltTimer, 0) endif endif ENDEVENT BaseProjectile & BaseExplosion are just projectile and explosion properties that match the projectile of the weapon and what's supposed to explode, respectively. This is a video showing what I want to have happen, and it was working before: (The explosions that are being placed at the projectile when the timer runs launch additional projectiles that smack into the ground, which is what is supposed to happen.) Since changing this bit of script above (and unfortunately losing, completely what the original looked like) the same projectiles, spawned from the same explosions are being destroyed at the same time the explosions are placed. If I run with the bit of script above, one can actually see the projectiles for a brief interval after being spawned from their respective explosions before papyrus finishes lagging and for some reason, results in their destruction. I obviously don't understand the logic behind when certain functions run or OnTimer events very fully, so I would really love some help rewriting this bit of script and restoring the effect as seen in the vid. Edited November 30, 2016 by TrickyVein Link to comment Share on other sites More sharing options...
ajs52698 Posted December 1, 2016 Share Posted December 1, 2016 (edited) Generally when something Isnt working with scripts for me and I cant find the issue I make sure I make a clean save which usually resolves it, all I got for you sorry :sad: Edited December 1, 2016 by ajs52698 Link to comment Share on other sites More sharing options...
TrickyVein Posted December 1, 2016 Author Share Posted December 1, 2016 If the objectref placed explosion is getting reset each time the OnTimer event runs, do the projectiles which the explosion spawns get treated as children to it somehow and also get disabled/reset? If that is true, how can I make sure to create an objectref that persists and takes on a value independently of the OnTimer event? I've tried storing objectref variables both in the script properties and in the event and it seems to make no difference. I've also tried creating two objectref variables, one stored in the script and one in the event and setting the one that's stored in the script to the one that gets reset each time in the OnTimer block, again with seemingly no difference. Am I barking up the wrong tree here, or how would I make sure to not disable or overwrite the objectref which represents where an explosion is placed? Link to comment Share on other sites More sharing options...
Reneer Posted December 1, 2016 Share Posted December 1, 2016 (edited) The script looks fine to me at a glance. Have you tried writing out debug messages to the Papyrus log? You could also check to see if any variables are none (especially the NewExplosion variable). Edited December 1, 2016 by Reneer Link to comment Share on other sites More sharing options...
TrickyVein Posted December 1, 2016 Author Share Posted December 1, 2016 EVENT OnTimer(Int aiTimerID) if aiTimerID == 0 NewExplosion = Game.FindClosestReferenceOfAnyTypeInListFromRef(LauncherProjectileList, Self.GetCasterActor(), 10000) objectreference xMarker = NewExplosion.PlaceAtMe(BaseExplosion, 1) if xMarker StartTimer(fAltTimer, 0) else xMarker.Delete() endif endif ENDEVENT But everything I'm trying is really just the same thing, written different ways. My feeling is that there was a way that I was breaking up the processing of papyrus in the OnTimer Event completely unintentionally with additional conditions, but since thought to remove them for optimization. Now, I don't know what those were - but if one wanted to intentionally lag papyrus or stall it for checking an additional condition, how could one do that? I thought that maybe the FindClosestReferenceOfTypeFromRef function could have been grabbing the wrong projectiles, but not from an explosion which hasn't even been created yet... unless I'm mistaken. That would be really weird. Link to comment Share on other sites More sharing options...
Reneer Posted December 1, 2016 Share Posted December 1, 2016 The way to pause a script is to use Utility.Wait(float seconds). Link to comment Share on other sites More sharing options...
TrickyVein Posted December 2, 2016 Author Share Posted December 2, 2016 I give up for now. And I leave this as a challenge: get the same effects to work as seen in the vid that I posted, which means creating explosions on a projectile that spawn additional projectiles and which AREN'T destroyed. The good news is that it's possible. There's a way. I have no idea what that is. I have no idea what I did. Link to comment Share on other sites More sharing options...
Reneer Posted December 2, 2016 Share Posted December 2, 2016 I'll be taking a crack at it when I get home from the convention. Link to comment Share on other sites More sharing options...
Recommended Posts