Jump to content
Maintenance : Final step ×

In-game notifications


Recommended Posts

  • Premium

Hello,

Today, I would like to share my in-game notification system with you.

This system can be used for various purposes. For example, in the implementation below, I receive notifications about:

  • A new Biologist mission.
  • An equipped EXP ring that has expired.

The package includes functionality for tracking the expiration of special items (e.g., EXP rings, drop gloves, etc.).

The system is easily extendable. To add new notifications, simply:

  • Add the new item to the ENotification enum (on both the server and client sides).
  • Update the corresponding map on the Python side.
  • Use the SendNotification() method in the appropriate location in your code.

Notifications are queued, so if you get several at once, they will display one by one.

Preview:

spacer.png

 

Download Center

This is the hidden content, please

This is the hidden content, please

Cheers.

  • Metin2 Dev 76
  • Eyes 1
  • Good 7
  • Love 1
  • Love 25
Link to comment
Share on other sites

  • Management

For hidden ads, just put the link

WITHOUT code tag

^^

Link, like this :

https://metin2.dev/topic/33237-in-game-notifications/

All external link are auto-hidden

  • Love 1

 I don't respond to any private messages, except for messages regarding ad system issues... 
 For everything else, please join the Discord server and open a ticket... 

Link to comment
Share on other sites

@ jking Where should I add notifications that should appear at a given lvl?
I added in void CHARACTER::SetLevel

    if (level == 100)
    {
        SendNotification(ENotification::NOTIFICATION_CATEGORY_UNLOCK_NEW_MAP1, 0);
        SendNotification(ENotification::NOTIFICATION_CATEGORY_UNLOCK_NEW_DUNG1, 0);
    }
    if (level == 200)
    {
        SendNotification(ENotification::NOTIFICATION_CATEGORY_UNLOCK_NEW_MAP2, 0);
        SendNotification(ENotification::NOTIFICATION_CATEGORY_UNLOCK_NEW_DUNG2, 0);
    }

But it doesn't work. Sysser:
1123 16:16:21198 :: invalid idx 0
1123 16:17:22742 :: Phase Select does not handle this header (header: 189, last: 32, 189)

Thanks in advance for your help.

Link to comment
Share on other sites

  • Premium

You can add this in SetLevel function like you did, or:

CHARACTER::PointChange()
case POINT_LEVEL:

But the syserr talks about packet header error, check if you implemented the system correctly.

EDIT:
You should avoid using this in SetLevel() function, because it is used also when creating player object. As I can understand you want to use this only when player level up, so PointChange is the correct place.

Edited by jking
  • Love 1
Link to comment
Share on other sites

  • Premium
19 hours ago, Pseudabo said:

Great idea, but update your repo for begginers (you forgot add packet.h for client + some example text for locale_game.txt)

Btw. 10s timer is rlly long xd I used 5s but I think 3s is fit already

Thanks for info. I updated repo & download link.

Link to comment
Share on other sites

  • Management
36 minutes ago, jking said:

Thanks for info. I updated repo & download link.

Hi, m2dl has an update system for files.
No need to create a new file every time ahah, to add an update to a file, simply edit it and click "Update File Archive".

I did it and restored the original M2DL link, the new link is being deleted

 I don't respond to any private messages, except for messages regarding ad system issues... 
 For everything else, please join the Discord server and open a ticket... 

Link to comment
Share on other sites

  • Premium
6 minutes ago, ɛʟ Ǥʟɑçѳи 🧊 said:

Hi, m2dl has an update system for files.
No need to create a new file every time ahah, to add an update to a file, simply edit it and click "Update File Archive".

I did it and restored the original M2DL link, the new link is being deleted

Ye, I know, but there is an error when trying to update file archive:
spacer.png

Link to comment
Share on other sites

  • Management
2 hours ago, jking said:

Ye, I know, but there is an error when trying to update file archive:
spacer.png

Fixed, i forgot to remove this... xD

 I don't respond to any private messages, except for messages regarding ad system issues... 
 For everything else, please join the Discord server and open a ticket... 

Link to comment
Share on other sites

Thanks, i tested it and i saw the icons are not properly align so :

 

	def LoadInfo(self, notification):
		self.UI["title"].SetText(notification.GetTitle())

		item.SelectItem(notification.value)
		width, height = item.GetItemSize()
		iconY = 18 - (height - 1) * 15

		self.UI["icon"] = ui.MakeImageBox(self.UI["bg"], notification.GetIcon(), 0, iconY)
		self.UI["icon"].SetWindowHorizontalAlignCenter()

		lines = SplitDescription(notification.GetDescription(), 35)
		stepY = 102 if len(lines) > 1 else 110
		self.UI["description"] = []

		for count, line in enumerate(lines):
			description = ui.MakeText(self.UI["bg"], line, 0, stepY, None)
			description.SetWindowHorizontalAlignCenter()
			description.SetHorizontalAlignCenter()
			self.UI["description"].append(description)
			stepY += 15

 

Link to comment
Share on other sites

  • 1 month later...
  • Active Member

Hi!
First of all, thank you for sharing it with us, I really appreciate it!

I noticed a small issue with the animation itself. If a new notification has been added to the queue when current notification is sliding out, the animation will freeze on your screen. You can test it easily if you lower the animation speed.

We should prevent another sliding animation starting to play when the current one is not finished yet.

Spoiler
	def SlideIn(self):
		if self.isActiveSlideOut: # Prevent starting a new slide if another slide-out is in progress
			return

		self.LoadInfo(self.queue[0])
		self.SetTop()
		self.Show()
		self.isActiveSlide = True
		self.endTime = app.GetGlobalTimeStamp() + 10

 

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.