Jump to content

GetSecondsPassed = fail, my timer float is not working...


Nexusmodsaccountno2

Recommended Posts

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 playerref

If timer >= 2

Actorref.MoveTo xmarkerref

Set timer to 0

Endif

End

Link to comment
Share on other sites

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

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
Endif
End

~~~~~~~~~~~~~~~~~~

Just a quick script build to get the idea ... I'm sure it will need some tweaking.

Link to comment
Share on other sites

  • 3 weeks later...

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 Timer
Short Button
Short C4Countdown
Short CaveCollapsed
Begin OnActivate
If GetActionRef !=Player
BigClawsCaveRef.activate
Elseif GetActionRef ==Player
showmessage 5ABigClawsCaveMSG
Endif
End
Begin Menumode 1001
Set Button to GetButtonPressed
if (Button ==0)
Player.moveto BigClawsPlayerMarker
PlaySound DRSCave
Elseif (Button ==1) && Player.GetItemCount WeapNVC4PlasticExplosive >=1 && Player.Getav Explosives >=55
ShowMessage 5ABigClawsCaveC4Success
BigClawsCaveRef.Disable
GoodC4Ref.enable
Set C4Countdown to 1
Elseif (Button ==1) && Player.GetItemCount WeapNVC4PlasticExplosive >=1 && Player.Getav Explosives <55
ShowMessage 5ABigClawsCaveC4Fumble
BigClawsCaveRef.Disable
GoodC4Ref.enable
Set C4Countdown to 2
Elseif (Button ==1) && Player.GetItemCount WeapNVC4PlasticExplosive ==0
ShowMessage 5ABigClawsCaveC4Fail
Elseif (Button ==2) && Player.getav Unarmed >=90 && BigClawsRef.GetinCell 5ABigClawCave ==1
showmessage 5ABigClawsCaveUnarmedSuccess
CollapseEnabler.Enable
PlaySound 5AFXRollingBoulderNoLoop
PlaySound FXMeleeTrapImpact
BigClawsCaveRef.Disable
Setstage 5ABountyBigClaws 25
Elseif (Button ==2) && Player.getav Unarmed >=90 && BigClawsRef.GetinCell 5ABigClawCave ==0
showmessage 5ABigClawsCaveUnarmedSuccess
CollapseEnabler.Enable
PlaySound 5AFXRollingBoulderNoLoop
PlaySound FXMeleeTrapImpact
BigClawsCaveRef.Disable
Setstage 5ABountyBigClaws 15
Elseif (Button ==2) && Player.getav Unarmed <90
showmessage 5ABigClawsCaveUnarmedFail
endif
end
Begin Gamemode
If C4Countdown ==1 && Timer < 15 && CaveCollapsed ==0
Set Timer to Timer + GetSecondsPassed
Elseif C4Countdown ==2 && Timer < 3 && CaveCollapsed ==0
Set Timer to Timer + GetSecondsPassed
ElseIf C4Countdown ==1 && CaveCollapsed ==0 && BigClawsRef.GetinCell 5ABigClawCave ==0
CollapseEnabler.enable
CollapseEnabler.placeatme C4Explosion
Set CaveCollapsed to 1
Setstage 5ABountyBigClaws 15
Showmessage 5ABigClawsStuckoutside
ElseIf C4Countdown ==1 && CaveCollapsed ==0 && BigClawsRef.GetinCell 5ABigClawCave ==1
CollapseEnabler.enable
CollapseEnabler.placeatme C4Explosion
Set CaveCollapsed to 1
Setstage 5ABountyBigClaws 25
ElseIf C4Countdown ==2 && CaveCollapsed ==0 && BigClawsRef.GetinCell 5ABigClawCave ==0
CollapseEnabler.enable
CollapseEnabler.placeatme C4Explosion
Set CaveCollapsed to 1
Setstage 5ABountyBigClaws 15
Showmessage 5ABigClawsStuckoutside
ElseIf C4Countdown ==2 && CaveCollapsed ==0 && BigClawsRef.GetinCell 5ABigClawCave ==1
CollapseEnabler.enable
CollapseEnabler.placeatme C4Explosion
Set CaveCollapsed to 1
Setstage 5ABountyBigClaws 25
endif
end

Edited by Radioactivelad
Link to comment
Share on other sites

Heh

 

Me + SuperHelpfulPosters == SuccessfulTIMER

 

Yeah I am basically saying that my timer actually works now

 

 

Script

 

Short startIt ;to make the timer start and stop

Float timer ;the timer

 

Begin onFire

 

Ref.moveto playerref

Set startIt to 1

Set timer to 0

End

 

Begin gamemode

 

If startit == 1

Set timer to timer + GetSecondsPassed

If timer >= 2

Ref.moveto xmarkerref

Set startit to 0

 

Endif

Endif

 

End

 

 

 

Thanks >= Lots

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...