Skip to content
User Avatar
#1550
Auto-translated
Heroist
I don't think it's that complicated. So, here's the idea. You have a function that handles receiving the quest, right?

Then:
n = 0 (write this outside of all functions)

--Your function--
....
Receive the quest (the required one)
n = 1 -- now we set n to one
--end of function--

Now, using a trigger for a new day (Trigger(NEW_DAY_TRIGGER , 'day')) (as an example), call the function to execute.

--new day function--
if n > 0, then
n = n + 1 -- if n > 0, which in our case means that the quest has already become active, we increment n by 1.
--end of new day function--

Thus, we add +1 to n every day, starting from the day after the quest is received.
Now, all that remains is to write a check function (it can be written directly inside the new day function)

--new day function--
--what is written above--
if n == 11 and the quest has already been completed, then
Your actions
Otherwise, if n == 11, then (this already means that the quest has not been completed within this time)
Your other actions
"For aesthetics, if you don't need the counter to continue, set n = 0"
--end of new day function--

If "Your actions" are already written in another function, that's fine. Instead, write startThread (name_of_the_function_with_actions). That's it, I think.
[/code]
Now, a little reference material:

Trigger(NEW_DAY_TRIGGER , 'day') -- trigger for a new day
SetObjectiveState ('objname' , OBJECTIVE_ACTIVE) -- activate the quest, replace the first parameter with the name of your quest
SetObjectiveState ('objname' , OBJECTIVE_COMPLETED/FAILED) -- complete the quest, or fail it.
n = 0 -- and so on (variable)
Trigger(TRIGGER_NAME, nil) -- reset the trigger.


Thus, here is the complete script: (replace the red with your values):

n = 0

function xxx
...
SetObjectiveState ('obj1' , OBJECTIVE_ACTIVE)
n = 1
end

Trigger(NEW_DAY_TRIGGER , 'day')

function day
if n > 0 then
n = n + 1
end
if n == 11 and GetObjectiveState ('obj1') == OBJECTIVE_COMPLETED then
...
elseif n == 11 then
...
end
end

I don't think I wrote anything more complicated. ;)

Thank you very much :) You explained it clearly and understandably. I'll know now :)
Создаётся карта "Забытый Авангард (готовность 80%)