Increase time according to spawn entities.

Announcements, support questions, and discussion for Quest Machine.
Post Reply
cyber
Posts: 5
Joined: Wed Jul 10, 2024 3:28 am

Increase time according to spawn entities.

Post by cyber »

can somebody help me please. Here is my issue. When the player accept the quest, 3 object spawn somewhere in map. I calculate the distance between (player to spawn 1 + spawn1 to spawn2 + spawn2 to spawn 3 + spwan3 to player). Now I want to set this distance as a timer for this quest.
User avatar
Tony Li
Posts: 22110
Joined: Thu Jul 18, 2013 1:27 pm

Re: Increase time according to spawn entities.

Post by Tony Li »

Hi,

You can make a subclass of TimerQuestCondition. You could override the StartChecking() method to determine a time based on the distance. Then set the counter value to that time. Rough example:

Code: Select all

public class DistanceTimerQuestCondition : TimerQuestCondition
{
    public override void StartChecking(System.Action trueAction)
    {
        base.StartChecking(trueAction);
        m_counter.currentValue = ComputeTimeBasedOnDistance();
    }
}
Then use this custom condition instead of the base TimerQuestCondition in your quest.
Post Reply