Making Hidden Items Respawn Everyday - Pawkkie/Team-Aquas-Asset-Repo GitHub Wiki

By PCG.

Defining flag end's constant.

In include/constants/flags.h, at the end of the hidden items flags. below FLAG_HIDDEN_ITEM_ROUTE_105_BIG_PEARL, create a new constant FLAG_HIDDEN_ITEMS_END.

#define FLAG_HIDDEN_ITEMS_END FLAG_HIDDEN_ITEM_ROUTE_105_BIG_PEARL

You can either have this constant, or just use FLAG_HIDDEN_ITEM_ROUTE_105_BIG_PEARL. Your choice.

Declaring the function.

We need to declare our new function in include/event_data.h. I declared mine right below void ClearDailyFlags(void)

void ClearDailyHiddenItemFlags(void);

Defining the function.

In src/event_data.c, preferably under void ClearDailyFlags(void).

void ClearDailyHiddenItemFlags(void)
{
    u32 i = 0;

    for (i = FLAG_HIDDEN_ITEMS_START; i <= FLAG_HIDDEN_ITEMS_END; i++)
    {
        FlagClear(i);
    }
}

Calling the function.

In src/clock.c, you need to call the function in static void UpdatePerDay(struct Time *localTime)

static void UpdatePerDay(struct Time *localTime)
{
    u16 *days = GetVarPointer(VAR_DAYS);
    u16 daysSince;
    if (*days != localTime->days && *days <= localTime->days)
    {
        daysSince = localTime->days - *days;
        ClearDailyFlags();
+       ClearDailyHiddenItemFlags();
        UpdateDewfordTrendPerDay(daysSince);
        UpdateTVShowsPerDay(daysSince);
        UpdateWeatherPerDay(daysSince);
        UpdatePartyPokerusTime(daysSince);
        UpdateMirageRnd(daysSince);
        UpdateBirchState(daysSince);
        UpdateFrontierManiac(daysSince);
        UpdateFrontierGambler(daysSince);
        SetShoalItemFlag(daysSince);
        SetRandomLotteryNumber(daysSince);
        *days = localTime->days;
    }
}

And that's it! With that your hidden items will respawn everyday!

You can also do the same thing normal items, or a select few.