Jump to content

24 hour timer script not working


nonplusultra

Recommended Posts

Could someone tell me why this script is not working?

The prospector is moving to his xmarker, but after that he is not coming back, not before 24 hours nor after.

 

 

	

float time
int hourspassed


If drugs == 1 && search == 1
		NWCEProspectorREF.removescriptpackage NWCEProspectorSandboxPACK
NWCEProspectorREF.addscriptpackage NWCEProspectorSearchPACK
               if time != GameHour
				Set time to GameHour
                       Set hourspassed to hourspassed + 1
endif
                       If hourspassed >= 24
			set done to 1
			NWCEProspectorREF.removescriptpackage NWCEProspectorSearchPACK
			NWCEProspectorREF.moveto NWCEProspectorMarkerREF
			NWCEProspectorREF.addscriptpackage NWCEProspectorSandboxPACK
               Set hourspassed to 0
		Set search to 0
               endif
       endif

Link to comment
Share on other sites

you need to nail down which part of the script isn't working..

vital skill here is Debugging,

You know that a certain part of the script -is- working because your prospector is doing that part, so keep testing, isolate different parts of the script until you find the part that isn't cooperating.

 

if I were you, I'd make sure your AI packages work properly, that'd be a good place to start, then see if you can trigger them seperately....then check your timers are working by using something else that's obvious as a trigger.

my experience has been that AI packages often don't start instantly and obviously, they sometimes take a few moments before the actor starts doing anything new.

I test my timers by adding money to my player character, that's generally a decent cue. plus if you want to check each hour or so, you can add the same amount of money as the hour itself, it's like having a clock.

 

I'd also check that it's not failing to be triggered due to fast-travel or Wait functions...use a smaller scale timer system for testing, once that's working, scale up. that way you don't spend half an hour waiting for something to happen when it's broken and won't.

Link to comment
Share on other sites

Okay, now I've made a completly new script and I've reduced it to a simple add money command.

 

Here's the new script:

 

	If money == 1
Set time to GameHour
set money to 2
endif

if money == 2 && time + 1 <= gamehour
                       Set hcount to hcount + 1
set money to 1
endif
                       If hcount >= 5
			player.additem f 500
               Set hcount to 0
               endif

 

I've also created a message box which shows me the current amount of hcount!

Before money was set to 1 the amount was 0, when I set it to 1 and wait one hour the value of hcount is 1, so all is working fine until here.

BUT!, if I'm waiting one more hour it is still on 1 or if I'm waiting more than 1 hour from the beginning it is completly stucking on 0...

 

So, what's the issue with this script?

Or an another question, how would you do a script that counts every ingame hour?

 

thanks for helping ;>

 

P.S.: This is just one block of the entire quest script, so in the real script there is a begin gamemode and end part!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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