Dawid Chemloul
06/11/2025, 6:22 AMnuutti_holtta_mp
06/11/2025, 8:28 AMMetaOfferGroupId offerGroupId = <desired offer group id>;
MetaOfferGroupInfoBase offerGroupInfo = player.GameConfig.OfferGroups.GetValueOrDefault(offerGroupId);
player.MetaOfferGroups.TryStartActivation(offerGroupInfo, player);
If you don't want it to check the segments and other conditions in this trigger, you can use ForceStartActivation instead of TryStartActivation.
(edit: fixed the code snippet a bit)Dawid Chemloul
06/11/2025, 8:30 AMDawid Chemloul
06/11/2025, 8:30 AMDawid Chemloul
06/11/2025, 8:31 AMnuutti_holtta_mp
06/11/2025, 12:39 PMPlayerMetaOfferGroupsModelBase<...> subclass, CustomCanStartActivation method, so that the specific offer cannot be normally activated, but can be activated via an explicit trigger. Along these lines:
public class MyPlayerOfferGroupsModel : PlayerMetaOfferGroupsModelBase<MyOfferGroupInfo>
{
...
MetaOfferGroupId _currentExplicitlyTriggeredId = null;
public void TriggerActivationExplicitly(MyOfferGroupInfo info, IPlayerModelBase player)
{
_currentExplicitlyTriggeredId = info.GroupId;
TryStartActivation(info, player);
_currentExplicitlyTriggeredId = null;
}
protected override bool CustomCanStartActivation(MyOfferGroupInfo info, IPlayerModelBase player)
{
// In this example, RequireExplicitTrigger is a custom config property,
// but it could be any other condition as desired.
if (info.RequireExplicitTrigger)
{
if (_currentExplicitlyTriggeredId != info.GroupId)
return false;
}
return base.CustomCanStartActivation(info, player);
}
}nuutti_holtta_mp
06/11/2025, 12:39 PMnuutti_holtta_mp
06/11/2025, 12:39 PMAdditionalConditions list configurable for both offers and groups, that might be possible to arrange in a way that the conditions are fulfilled only on specific triggers. This isn't documented but it's possible to populate that list from config data when defining custom config data types for offers and offer groups.Dawid Chemloul
06/11/2025, 12:42 PMDawid Chemloul
06/11/2025, 12:42 PMnuutti_holtta_mp
06/11/2025, 1:05 PMDawid Chemloul
06/11/2025, 1:33 PMvar state = player.MetaOfferGroups.TryGetState(OfferGroupId);
return null for an offer that was never activated for a given player?nuutti_holtta_mp
06/11/2025, 1:37 PMDawid Chemloul
06/11/2025, 1:47 PMDawid Chemloul
06/11/2025, 2:25 PMDawid Chemloul
06/11/2025, 2:30 PM[MetaMember(1)] public bool IsManual;
[IgnoreDataMember] public bool ManualActivation = false;
then action after retrieving group info can set it before calling to TryActivate
and set it back after...
and in CanActivate we check the two values of the info...
no state in the groups model...Dawid Chemloul
06/11/2025, 2:35 PMcsharp
try
{
groupInfo.ManualActivation = true;
player.MetaOfferGroups.TryStartActivation(groupInfo, player);
}
finally
{
groupInfo.ManualActivation = false;
}nuutti_holtta_mp
06/12/2025, 7:36 AMDawid Chemloul
06/12/2025, 9:41 AM