Weather-based tasks - sometimes it works, sometimes not
Posted: Mon Sep 05, 2022 8:50 pm
Hi again,
the following code segment is supposed to do the following:
- if it's evening or night, and if the weather is fog, rain or thunderstorm, and if the player is at the correct location, a specific type of monster will be generated.
- if it's day, the night monsters disappear and are not generated. Instead, a day type will be generated
Problem: This works quite often. But sometimes it does not, even though nothing is different.
I have to purge the quest and re-start it, then it works.
But the variables / tasks status in the quest debugger are correct even when it does not work.
Once again I'm clueless. It should work all the time, not just sometimes...
the following code segment is supposed to do the following:
- if it's evening or night, and if the weather is fog, rain or thunderstorm, and if the player is at the correct location, a specific type of monster will be generated.
- if it's day, the night monsters disappear and are not generated. Instead, a day type will be generated
Code: Select all
-- during foggy and rainy nights in my location, the monsters arrive
_NightFoes_ task:
when _wet_ and _dark_ and _atMyLocation_
create foe _FoeA_ every 4 minutes 12 times with 100% success
create foe _FoeB_ every 30 minutes 15 times with 100% success
-- at daytime, a few other foes appear
_DayFoes_ task:
when _bright_ and _atMyLocation_
create foe _FoeC_ every 11 minutes 13 times with 60% success
-- when it is day again, the night foes disappear
_RemoveNightFoes_ task:
when _bright_
remove foe _FoeA_
remove foe _FoeB_
clear _NightFoes_
clear _RemoveNightFoes_
-- to determine weather
_wet_ task:
when _rain_ or _fog_ or _thunderstorm_
_rain_ task:
weather rain
_fog_ task:
weather fog
_thunderstorm_ task:
weather thunder
-- to determine time of day
_bright_ task:
when _day_
_dark_ task:
when _evening_ or _night_
_day_ task:
daily from 04:31 to 21:29
_evening_ task:
daily from 21:30 to 23:59
_night_ task:
daily from 00:00 to 04:30
-- to determine correct location (gets set with pc at command somewhere else in the script)
_atMyLocation_ task:
I have to purge the quest and re-start it, then it works.
But the variables / tasks status in the quest debugger are correct even when it does not work.
Once again I'm clueless. It should work all the time, not just sometimes...