[RELEASE]Message above MapNpc

11/19/2019 20:43 NosRaible#1
Hello everyone. I saw someone was looking for this on forum. Here you go :)


[Only registered and activated users can see links. Click Here To Register...]


First Step Go to the GameObject ---> MapNpc

Add this



And add this

11/19/2019 21:48 XV50#2
should've been done using Database Implementation cuz this is just sending straight packets, so if you add 1000x Npcs like OTHER SERVERS, you are fucked if anyone can talk and u dont have a 200€ p/m Server.
11/19/2019 22:22 XV50#3
Why would u have to add the Messages as Method to the init? Because it's not loaded separately.

Code:
public void Initialize(MapInstance currentMapInstance)
        {
            MapInstance = currentMapInstance; <---
            Initialize(); <---
            Messages(); // ??
        }
oh and actually. Your Method won't work as it's supposed to do.

Code:
private void Messages()
        {
            Observable.Interval(TimeSpan.FromSeconds(5)).Subscribe(onNext: s =>
            {

                if (MapNpcId == 20003)
                {
                    MapInstance.Broadcast($"say 2 {MapNpcId} 0 ");
                    //This won't be spammed every 5 seconds. It will be spammed the whole time so the packet won't stop.
                }
            });
        }
Well, your code isn't bad. Well not that bad. But still it's no method to prefer. U should also don't check with if on MapNpcId == . Just add a simple if to ask for db-content. Example method is to add a second method on sending the packet, and give the MapNpc.cs only the task to send the message.

1. Task > SendPacket + Delay
2. Task > LoadByDb

just 2 rows in the MapNpc DB [NpcSay NpcSayDelay]
11/19/2019 22:30 erixor#4
Quote:
Originally Posted by XV50 View Post
Why would u have to add the Messages as Method to the init? Because it's not loaded separately.

Code:
public void Initialize(MapInstance currentMapInstance)
        {
            MapInstance = currentMapInstance; <---
            Initialize(); <---
            Messages(); // ??
        }
oh and actually. Your Method won't work as it's supposed to do.

Code:
private void Messages()
        {
            Observable.Interval(TimeSpan.FromSeconds(5)).Subscribe(onNext: s =>
            {

                if (MapNpcId == 20003)
                {
                    MapInstance.Broadcast($"say 2 {MapNpcId} 0 ");
                    //This won't be spammed every 5 seconds. It will be spammed the whole time so the packet won't stop.
                }
            });
        }
Well, your code isn't bad. Well not that bad. But still it's no method to prefer. U should also don't check with if on MapNpcId == . Just add a simple if to ask for db-content. Example method is to add a second method on sending the packet, and give the MapNpc.cs only the task to send the message.

1. Task > SendPacket + Delay
2. Task > LoadByDb

just 2 rows in the MapNpc DB [NpcSay NpcSayDelay]
You shouldn't call the db at runtime for this kind of operation either. The MapNpc GameObject inherits from the MapNpcDTO, which means if you map it properly, you don't have to call your database
11/19/2019 22:33 XV50#5
Quote:
Originally Posted by erixor View Post
You shouldn't call the db at runtime for this kind of operation either. The MapNpc GameObject inherits from the MapNpcDTO, which means if you map it properly, you don't have to call your database
It was an example. :)
But yeah, you are right. But if i'd explain the way u said, he would absolutely understand NOTHING.

Greetings
11/20/2019 18:05 IceTrailer#6
Wow. 85 % spam.
I can repeat for some of you who read this:
Please follow the board rules.