Jump to content
Returning Members: Password Reset Required ×

Recommended Posts

Posted (edited)

Hey guys I'm using v6609, I was playing with my NPCs a little

I found out the Guild Controller has a note which says [Guild]

 

image.png.ad18dbf8412ebf6a0e8e0579f9589a84.png image.png.814ebfb458b3a54f50ff048359c7cc8c.png

I know that to get the correct lookface we multiply the NpcType by 10 so for this one it will be 1150 (0 to 9 for directions), mine is 1156

image.thumb.png.7b2298d0c8b684745865b297e7dd3a77.png

However, I found another npc in that npc.ini file and calculated the lookface from it and it was 33230, so I tried to add that npc to my npcs table but when I open the game I can't see the note, also it has a weird avatar on it?

image.pngimage.png.8aa6beccf4fcc8003b38c2cddf90e27c.png

image.thumb.png.ed7f003b6e5dba75cd4be09d1f1e30f7.png

Here's my NpcSpawnInfo packet following https://gitlab.com/conquer-online/wiki/-/wikis/Packets/MsgNpcInfo

using System;
using MTA.Client;

namespace MTA.Network.GamePackets {
    public class NpcSpawn : Writer, Interfaces.IPacket, Interfaces.INpc, Interfaces.IMapObject {
        private byte[] _buffer;

        public NpcSpawn(bool created = true) {
            if (!created) return;
            _buffer = new byte[36];
            WriteUInt16(28, 0, _buffer);
            WriteUInt16(2030, 2, _buffer);
            WriteUInt32((uint)Time32.timeGetTime().GetHashCode(), 4, _buffer);
            // WriteUInt16(1, 22, Buffer);
        }

        public uint UID {
            get => BitConverter.ToUInt32(_buffer, 8);
            set => WriteUInt32(value, 8, _buffer);
        }

        public ushort X {
            get => BitConverter.ToUInt16(_buffer, 16);
            set => WriteUInt16(value, 16, _buffer);
        }

        public ushort Y {
            get => BitConverter.ToUInt16(_buffer, 18);
            set => WriteUInt16(value, 18, _buffer);
        }

        public ushort Mesh {
            get => BitConverter.ToUInt16(_buffer, 20);
            set => WriteUInt16(value, 20, _buffer);
        }

        public Game.Enums.NpcType Type {
            get => (Game.Enums.NpcType)_buffer[22];
            set => _buffer[22] = (byte)value;
        }

        public string Name {
            get => _name;
            set {
                _name = value;

                byte[] buffer = new byte[90];
                _buffer.CopyTo(buffer, 0);
                WriteUInt16((ushort)(buffer.Length - 8), 0, buffer);
                buffer[32] = 1;
                WriteStringWithLength(value, 33, buffer);
                _buffer = buffer;
            }
        }

        public _String Effect { get; set; }

        public ushort MapID { get; set; }

        public Game.MapObjectType MapObjType => Game.MapObjectType.Npc;

        public GameState Owner => null;

        public byte[] SpawnPacket;
        private string _name;
        public string effect { get; set; }

        public void SendSpawn(GameState client, bool checkScreen) {
            if (!client.Screen.Add(this) && checkScreen) return;
            client.Send(_buffer);
            if (effect != "") {
                client.SendScreen(new _String(true) {
                    UID = UID,
                    TextsCount = 22,
                    Type = 10,
                    Texts = { effect }
                });
            }
        }

        public void SendSpawn(GameState client) {
            SendSpawn(client, false);
            if (effect != "") {
                client.SendScreen(new _String(true) {
                    UID = UID,
                    TextsCount = 22,
                    Type = 10,
                    Texts = { effect }
                });
            }
        }

        public byte[] ToArray() {
            return _buffer;
        }

        public void Deserialize(byte[] buffer) {
            _buffer = buffer;
        }

        public void Send(GameState client) {
            SendSpawn(client, false);
        }
    }
}

 

 

 

 

Edited by xFranko
Posted

You're not respecting the ID ranges.

NPCs are from 1 to 99999, Dynamic NPCs from 100000 to 199999 etc

public const uint SysnpcidFirst = 1;
public const uint SysnpcidLast = 99999;
public const uint DynanpcidFirst = 100000;
public const uint DynanpcidLast = 199999;
public const uint SceneNpcMin = 200000;
public const uint SceneNpcMax = 299999;
public const uint MonsteridFirst = 400001;
public const uint MonsteridLast = 499999;
public const uint PetidFirst = 500001;
public const uint PetidLast = 599999;
public const uint CallpetidFirst = 700001;
public const uint CallpetidLast = 799999;
public const uint MapitemFirst = 800001;
public const uint MapitemLast = 899999;
public const uint MagictrapidFirst = 900001;
public const uint MagictrapidLast = 989999;
public const uint SystrapidFirst = 990001;
public const uint SystrapidLast = 999999;
public const uint PlayerIdFirst = 1000000;
public const uint PlayerIdLast = 1999999999;

 

Posted (edited)
On 12/23/2025 at 2:32 PM, Konichu said:

You're not respecting the ID ranges.

NPCs are from 1 to 99999, Dynamic NPCs from 100000 to 199999 etc

public const uint SysnpcidFirst = 1;
public const uint SysnpcidLast = 99999;
public const uint DynanpcidFirst = 100000;
public const uint DynanpcidLast = 199999;
public const uint SceneNpcMin = 200000;
public const uint SceneNpcMax = 299999;
public const uint MonsteridFirst = 400001;
public const uint MonsteridLast = 499999;
public const uint PetidFirst = 500001;
public const uint PetidLast = 599999;
public const uint CallpetidFirst = 700001;
public const uint CallpetidLast = 799999;
public const uint MapitemFirst = 800001;
public const uint MapitemLast = 899999;
public const uint MagictrapidFirst = 900001;
public const uint MagictrapidLast = 989999;
public const uint SystrapidFirst = 990001;
public const uint SystrapidLast = 999999;
public const uint PlayerIdFirst = 1000000;
public const uint PlayerIdLast = 1999999999;

 

You're my superhero!
Thank you, I didn't know there was this limitation!
Mind if I ask please what is the difference between NPCs and Dynamic NPCs (are those the shop ones etc, or the ones that are sobnpcs and have a heal etc?)

image.png.55ef8aa7e55212f9830a267c30d049c2.png

Edited by xFranko
Posted

I don't think they have any difference, since dynamic npcs also have IDs below 100k and some npcs has some dynamic npc ids.

You will have issues using Monster, Traps and Players IDs. Probably map item ids too.

  • xFranko changed the title to [v6609] Notes don't appear on NPCs

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...