Nexusmodsaccountno2 Posted January 22, 2019 Share Posted January 22, 2019 This script compiles fine but it does not moveto in game after the 2 seconds timer expires. Is there something wrong with my timer or does begin Onfire not work with timers or is it something else? Float timer Begin onfire Set timer to timer + GetSecondsPassed Actorref.MoveTo playerrefIf timer >= 2Actorref.MoveTo xmarkerrefSet timer to 0EndifEnd Link to comment Share on other sites More sharing options...
dubiousintent Posted January 22, 2019 Share Posted January 22, 2019 Please see 'TIP Block Types Multiple vs Single Frame processing' under the "Scripting" section of the wiki "Getting started creating mods using GECK" article. "Begin onfire" is an "On<Event>" type block, so it only passes once through the code. You need to move timing processes like this out into a multiframe type block. You should also note that the game engine has a problem with keeping time because of how it stores and uses "time". While this should not be a problem for a short "seconds" based timer, this issue is fixed in the "JIP LN NVSE Plugin", but you have to require it to be used with your mod. See the Optional game patches (toggle-able via ..\Data\NVSE\Plugins\jip_nvse.ini): in the description page. -Dubious- Link to comment Share on other sites More sharing options...
Mktavish Posted January 25, 2019 Share Posted January 25, 2019 If the OnFire is definitely what you want to use to trigger the event.You could use a "Begin ScriptEffectUpdate" for your timer like this. SCN MyFireScript Begin OnFire Actorref.MoveTo playerref ActorRef.CIOS TimerSpell End SCN MyTimerScript Float Timer Begin ScriptEffectUpdate Set Timer to Timer + GetSecondsPassed If timer >= 2 Actorref.MoveTo xmarkerref ActorRef.Dispel TimerSpell EndifEnd ~~~~~~~~~~~~~~~~~~Just a quick script build to get the idea ... I'm sure it will need some tweaking. Link to comment Share on other sites More sharing options...
Nexusmodsaccountno2 Posted February 10, 2019 Author Share Posted February 10, 2019 Tried it out with both getsecondspassed and scripteffectelapsedseconds and it did not work.Thanks for the idea though.I might just use a begin onunequip to get the moveto to work instead. For meTimers >= Fail Can never get them to work... Link to comment Share on other sites More sharing options...
Radioactivelad Posted February 15, 2019 Share Posted February 15, 2019 (edited) If it helps, I did once use a Timer in my mod, Five Aces. Here's the script, but honestly I couldn't tell you *why* it works at this point. I too had a lot of trouble with it. For Context, the player is setting a Brick of C4 to collapse the entrance of a cave.Activating the cave entrance, it brings up a menu with multiple options, one of which is to use C4 to block the cave.If that passes, it checks their explosive skill.Depending on the explosives skill, it activates either a 15 or 3 second timer, which upon ending sets off the effects representing the cave collapse. SCN 5ABigClawsCaveScript Float TimerShort ButtonShort C4CountdownShort CaveCollapsed Begin OnActivate If GetActionRef !=PlayerBigClawsCaveRef.activate Elseif GetActionRef ==Playershowmessage 5ABigClawsCaveMSG Endif End Begin Menumode 1001 Set Button to GetButtonPressed if (Button ==0)Player.moveto BigClawsPlayerMarkerPlaySound DRSCave Elseif (Button ==1) && Player.GetItemCount WeapNVC4PlasticExplosive >=1 && Player.Getav Explosives >=55ShowMessage 5ABigClawsCaveC4SuccessBigClawsCaveRef.DisableGoodC4Ref.enableSet C4Countdown to 1 Elseif (Button ==1) && Player.GetItemCount WeapNVC4PlasticExplosive >=1 && Player.Getav Explosives <55ShowMessage 5ABigClawsCaveC4FumbleBigClawsCaveRef.DisableGoodC4Ref.enableSet C4Countdown to 2 Elseif (Button ==1) && Player.GetItemCount WeapNVC4PlasticExplosive ==0ShowMessage 5ABigClawsCaveC4Fail Elseif (Button ==2) && Player.getav Unarmed >=90 && BigClawsRef.GetinCell 5ABigClawCave ==1showmessage 5ABigClawsCaveUnarmedSuccessCollapseEnabler.EnablePlaySound 5AFXRollingBoulderNoLoopPlaySound FXMeleeTrapImpactBigClawsCaveRef.DisableSetstage 5ABountyBigClaws 25 Elseif (Button ==2) && Player.getav Unarmed >=90 && BigClawsRef.GetinCell 5ABigClawCave ==0showmessage 5ABigClawsCaveUnarmedSuccessCollapseEnabler.EnablePlaySound 5AFXRollingBoulderNoLoopPlaySound FXMeleeTrapImpactBigClawsCaveRef.DisableSetstage 5ABountyBigClaws 15 Elseif (Button ==2) && Player.getav Unarmed <90showmessage 5ABigClawsCaveUnarmedFail endif end Begin Gamemode If C4Countdown ==1 && Timer < 15 && CaveCollapsed ==0Set Timer to Timer + GetSecondsPassed Elseif C4Countdown ==2 && Timer < 3 && CaveCollapsed ==0Set Timer to Timer + GetSecondsPassed ElseIf C4Countdown ==1 && CaveCollapsed ==0 && BigClawsRef.GetinCell 5ABigClawCave ==0CollapseEnabler.enableCollapseEnabler.placeatme C4ExplosionSet CaveCollapsed to 1Setstage 5ABountyBigClaws 15Showmessage 5ABigClawsStuckoutside ElseIf C4Countdown ==1 && CaveCollapsed ==0 && BigClawsRef.GetinCell 5ABigClawCave ==1CollapseEnabler.enableCollapseEnabler.placeatme C4ExplosionSet CaveCollapsed to 1Setstage 5ABountyBigClaws 25 ElseIf C4Countdown ==2 && CaveCollapsed ==0 && BigClawsRef.GetinCell 5ABigClawCave ==0CollapseEnabler.enableCollapseEnabler.placeatme C4ExplosionSet CaveCollapsed to 1Setstage 5ABountyBigClaws 15Showmessage 5ABigClawsStuckoutside ElseIf C4Countdown ==2 && CaveCollapsed ==0 && BigClawsRef.GetinCell 5ABigClawCave ==1CollapseEnabler.enableCollapseEnabler.placeatme C4ExplosionSet CaveCollapsed to 1Setstage 5ABountyBigClaws 25 endif end Edited February 15, 2019 by Radioactivelad Link to comment Share on other sites More sharing options...
Nexusmodsaccountno2 Posted February 15, 2019 Author Share Posted February 15, 2019 Woah that is an impressive bit of code. I will sort through it and see if I can pick out the stuff I need and get this timer to work. Thanks all! Link to comment Share on other sites More sharing options...
Nexusmodsaccountno2 Posted February 15, 2019 Author Share Posted February 15, 2019 Heh Me + SuperHelpfulPosters == SuccessfulTIMER Yeah I am basically saying that my timer actually works now Script Short startIt ;to make the timer start and stopFloat timer ;the timer Begin onFire Ref.moveto playerrefSet startIt to 1Set timer to 0End Begin gamemode If startit == 1Set timer to timer + GetSecondsPassed If timer >= 2Ref.moveto xmarkerrefSet startit to 0 EndifEndif End Thanks >= Lots Link to comment Share on other sites More sharing options...
Recommended Posts