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.

 

 

  Reveal hidden contents

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...