Jump to content

Timer problems


Alehazar

Recommended Posts

I need to set up two timers:

 

upon Moriarty's death my current script checks whether my player killed Moriarty with or without being added to the MegatonCrimeFaction.

 

A New quest is started and I need to incorporate these timers within this Quest.

 

If killed without a crime report, I need a countdown of 24 ingame hours and then add a specific note to my character.

 

If killed with a crime report, the timer needs to be three days, as after 72 ingame hours the people of Megaton won't care anymore about my PC killing Moriarty (provided my PC left Megaton and stays away for those 72 hours.) And then the letter needs to be added

 

Since time (ingame hours ) is handled as a Float, I really don't know understand what I need to do, I do not understand the notation of seconds, minutes, hours within a script; or, more in general, how the game registers the passing of time and how specific actions can be attached when a certain amount of time has expired.

Link to comment
Share on other sites

I'm still a bit new to scripting as well, but I was looking through scripts last night and saw a potential solution to your problem. In the HD00LabScript, they use the "GameDaysPassed" function. Basically, you need to set a float variable that, for this example, we'll call "MoriartyDeathTime". When Moriarty dies, do a "Set MoriartyDeathTime to GameDaysPassed". Then when checking against it, do an "If ( GameDaysPassed - MoriartyDeathTime >= x )". "x" will be "1" for a single game day and "3" for 3 game days. You can also use decimals for calculating fractions of days. Hope this helps.

Link to comment
Share on other sites

Hello, Alehazar

 

You can try this script on Moriarty:

 

---------------------------------------------------------------

 

short MoriartyIsDead

short DoOnce

 

Begin OnDeath

 

set MoriartyIsDead to GameDaysPassed

 

if (DoOnce == 0)

if (GameDaysPassed - MoriartyIsDead ) >= 3

player.addnote "mynote"

set DoOnce to 1

endif

endif

 

END

 

----------------------------------------------------

 

I used a similar script for my mod "Confessor Cromwell decay" at it worked.

 

Hope this works for you.

 

Good luck.

Edited by AmaccurzerO
Link to comment
Share on other sites

@AmaccurzerO:

 

I'll give it a go to see if it pans out -right now, I created the mod without the timer, so when Moriarty dies the required effect is

instantaneous -no notes and no quests involved.

 

I do appreciate the input, but my frustration in getting the timer to work (epic fail), somewhat curbed my enthusiasm to create this mod as I initially intended. I certainly see this as a future release.

So, many thanks for your time and advice.

Link to comment
Share on other sites

Try using "GetTimeDead"

 

http://geck.bethsoft.com/index.php?title=GetTimeDead

 

But it has to be in a "GameMode" block to continually check how much time has passed.

Begin OnDeath ; would only run its code once ... but would be the best way to start the script running.

So use the 2 blocks together , something like this.

 

~~~~~~~~~~~

SCN Myscript
Short DeathTrigger
Begin OnDeath ColinMoriartyRef ; means this must be an object script
Set DeathTrigger to 1
End
Begin GameMode
If DeathTrigger == 1 && GetFactionCombatReaction MegatonCrimeFaction PlayerFaction != 1
If ColinMoriarty.GetTimeDead >= 24
AddNote MyNote
Set DeathTrigger to 2
ElseIf DeathTrigger == 1 && GetFactionCombatReaction MegatonCrimeFaction PlayerFaction == 1
If ColinMoriarty.GetTimeDead >= 70 ; made this less than the 3 day crime flag clearing
AddNote MyNote
Set DeathTrigger to 2
endif
endif
endif
End
~~~~~~~~~~~~~~~~
There is probably a cleaner way to do it , and since the OnDeath block is used , it can't be a quest script.
So maybe a GetDead check in the GameMode block of a quest script ???
But you could just put this onto his script , although that is not advised for mod compatibility.
As far as understanding the time float ... it is a 24 hr clock , not a12 hr with am/pm.
But it only lists the hrs with the decimal places describing tenths and hundreds of an hour.
15 min = .25
30 min = .5
49min & 15sec = .82 approx
Hope that helps.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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