• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

TrinityCore 3.3.5 Achievement events

slp13at420

Mad Scientist
Are there any Achievement events like OnAchievementReceived or OnAchievementEarned ?
i.e. it triggers when the player earns an achievement.

the only thing I did find is:
Code:
[COLOR="#808080"]
class Check_Criteria : public AchievementCriteriaScript
{
public: Check_Criteria() : AchievementCriteriaScript("Check_Criteria"){ }

		virtual bool OnCheck(Player* source, Unit* target) override
		{
			TC_LOG_INFO("server.loading", "ACHIEVEMENT_CRITERIA-ON_CHECK");
			return true;
		};
};
[/COLOR]
 
Last edited:

slp13at420

Mad Scientist
yea I was hoping it would trigger on anything that would classify as an Achievement requirement, but it wont trigger event when I test with earning [Safe Deposit]. so I was assuming I was pondering its use wrong .


Code:
[COLOR="#808080"]
class Check_Criteria : public AchievementCriteriaScript
{
public: Check_Criteria() : AchievementCriteriaScript("Check_Criteria"){ }

		virtual bool OnCheck(Player* source, Unit* target) override
		{
			TC_LOG_INFO("server.loading", "ACHIEVEMENT_CRITERIA-ON_CHECK");
			return true;
		};
};
[/COLOR]


My core:
Code:
[COLOR="#808080"]
class AchievementCriteriaScript : public ScriptObject
{
    protected:

        AchievementCriteriaScript(const char* name);

    public:

        // Called when an additional criteria is checked.
        virtual bool OnCheck(Player* source, Unit* target) = 0;
};
[/COLOR]
 
Last edited:

Tommy

Founder
It probably isn't working because

Code:
virtual

is in front of "bool". Remove "virtual" and that blasted semicolon on the ending bracket of "OnCheck"!
 

slp13at420

Mad Scientist
fixed em :
Code:
[COLOR="#808080"]
class Check_Criteria : public AchievementCriteriaScript
{
public: Check_Criteria() : AchievementCriteriaScript("Check_Criteria"){ }

		bool OnCheck(Player* source, Unit* target) override
		{
			TC_LOG_INFO("server.loading", "ACHIEVEMENT_CRITERIA-ON_CHECK");
			return true;
		}
};
[/COLOR]

I should see a response by the time I purchase the final bank slot for [Safe Deposit] achievement.

but I still don't and yea its included in the group at the end for scriptloader.

and yea sometimes it throws a fit if there isn't a `;` at the end of one before another. so I kinda let it tell me some of the simple fixes crap lol
 
Last edited:

slp13at420

Mad Scientist
ok update:
here is what I have:
Code:
[COLOR="#808080"]
class Check_Criteria : public AchievementCriteriaScript
{
public: Check_Criteria() : AchievementCriteriaScript("Check_Criteria"){ }

		bool OnCheck(Player* source, Unit* target) override
		{
			TC_LOG_INFO("server.loading", "ACHIEVEMENT_CRITERIA-ON_CHECK");
			return true;
		}
};

void AddSC_Player_Check_Criteria()
{
	new Check_Criteria;
}
[/COLOR]

if I omit the `override` then I get issues trying to login.

and I get this error during startup but the script is added to `world.achievement_criteria_data` as shown in the pic below:



it gives that error and ofc it never fires when I complete objective 546 `Safe Deposit`.

did I go wrong somewhere or is this TC's problem?
 
Top