Cookies


Vsroplus only uses the cookies it needs to keep you signed in and remember your language. No ads, no tracking.

Got it

Need to learn more? Privacy policy

Our guides are in English for now.

Achievement Finish

By completing this guide, you should be able to trigger achievement completion and build your own custom systems.

Stored Procedure: _OnAchievementFinish
Parameters:

@CharID INT - Character ID
@CharName VARCHAR(64) - Character name
@AchievementID INT - Achievement ID
@AchievementCodeName VARCHAR(129) - Achievement CodeName

Let's send a text notification to the character using _Char_SendTextNotification to ensure that the trigger works fine for us.

USE [vPlus]
GO

/****** Object: StoredProcedure [dbo].[_OnAchievementFinish] Script Date: 2/19/2024 1:39:51 AM ******/

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:      <Author,,Name>
-- ALTER date:  <ALTER Date,,>
-- Description: <Description,,>
-- =============================================

ALTER PROCEDURE [dbo].[_OnAchievementFinish]
    @CharID INT,
    @CharName VARCHAR(64),
    @AchievementID INT,
    @AchievementCodeName VARCHAR(129)
AS
BEGIN
    SET NOCOUNT ON;

    /*
        This procedure is executed once an achievement is completed.
    */

    --------- Your code starts here --------

    -- Checking if the player finished the Gold Spender achievement
    IF (@AchievementCodeName = 'GOLD_SPENDER_01')
    BEGIN
        EXEC _Char_SendTextNotification @CharID, 'Congratulations! You have successfully completed the Gold Spender achievement Lvl 1', 1, 0, 0;
    END
END

Last updated: 19 February, 2024

An error has occurred. This application may no longer respond until reloaded. Reload 🗙