By completing this guide, you should be able to trigger monster kills to function and build your own custom systems.
Stored Procedure: _Trigger_MonsterKill
Parameters:
@CharID INT - Killer character ID
@ObjectID INT - Monster ID
@Rarity TINYINT - Monster rarity
Let's send a text notification using _Char_SendTextNotification to ensure that the trigger works fine for us.
USE [vPlus]
GO
/****** Object: StoredProcedure [dbo].[_Trigger_MonsterKill] Script Date: 1/18/2024 11:10:11 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[_Trigger_MonsterKill]
@CharID INT,
@ObjectID INT,
@Rarity TINYINT
AS
BEGIN
SET NOCOUNT ON;
/*
This procedure is executed whenever a player kills a monster.
*/
--------- Your code starts here --------
DECLARE @RefMonsterCodeName128 VARCHAR(128) = (
SELECT CodeName128
FROM SRO_VT_SHARD.dbo._RefObjCommon
WHERE ID = @ObjectID
);
IF (@RefMonsterCodeName128 = 'MOB_CH_MANGNYANG')
BEGIN
EXEC _Char_SendTextNotification @CharID, 'You have killed a mangyang', 1, 0, 0;
END
END