Forum

> > Stranded II > Scripts > Time of day, activation script
Forums overviewStranded II overview Scripts overviewLog in to reply

English Time of day, activation script

5 replies
To the start Previous 1 Next To the start

old Time of day, activation script

Lion_Hearted
User Off Offline

Quote
I am trying to add an on changeday script to a unit, under the condition that its dead... however, as all of you know, all dead units are deleted on changeday, which doesn't give time for the script to finish processing...

I need a script that will essentially be the same thing as the...
1
on:changeday {
script, but instead of activating at midnight, it would activate at 11 PM, which would of course, give time for the script to run its course...

Is this even possible? I looked through the stranded 2 command reference and come up dry. Do you guys have any tips?

old Re: Time of day, activation script

Hurri04
Super User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
on:start {
	timer "unit", 1, 10000, 0, "checktime";
}

on:checktime {
	if($eventexecuted==0)
		if(hour()==23) {
			freetimers "unit", 1;
			event "onehourbeforemidnight", "global";
			$eventexecuted=1;
		}
	}
}

on:onehourbeforemidnight {
	[YOUR SCRIPT]
}

on:changeday {
	timer "unit", 1, 1350000, 1, "closetoonehourbeforemidnight";
}

on:closetoonehourbeforemidnight {
	$eventexecuted=0;
	timer "unit", 1, 10000, 0, "checktime";
}

this script should start a timer when beginning the map.
this timer checks every 10 seconds whether it is already 11 pm or not.
if this is the case the timer is deleted and an event is started where you have to put your script.

then on changeday a new timer is started which does nothing until about 10:30 pm and then starts an event which again starts a new timer which does the same thing as the very first timer, it checks whether the hour is 11 pm or not.

this way the event "onehourbeforemidnight" is executed every day.

old Re: Time of day, activation script

Lion_Hearted
User Off Offline

Quote
Thank you everyone for their ideas...

I tried using your idea Hurri, however the timer doesn't calculate in sleeping times... DC's fixes that problem so I went with his idea instead.

old Re: Time of day, activation script

Hurri04
Super User Off Offline

Quote
well yeah, I forgot about the sleeping time...
my script could be changed so the timer which runs 1350 seconds after changeday (10:30 pm) is taken out of the script and instead the timer which checks on the time has to be run from the point of changeday on.

however, DC's solution seems to be easier as I see it now.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview