Beiträge von Kōdo

    The problem is in the file uicharacter.py if you want to fix it do as I have shown below:

    find:


    change to:

    Are you sure your pet model is stored in Value(0)?
    to be sure open mysql go to itemVnum ID and check if the pet model is stored in value(0)

    If you are using your code to give instructions to another entity you could also pass its current coords and then std::sort() the vector of the found npcs (if there were multiple) by distance to that entity.

    So you could easily pick the closest .front() npc of them for your entity if needed.

    There is a source function "DISTANCE_APPROX", which you can use for this sorting.

    Thank you for the tip, you are right this way of checking the distance of the Npc is a good idea

    I modified the code in the way you specified and this is the result:

    Bitte melden Sie sich an, um diesen Link zu sehen.


    *
    I have added the ACMD functions to the main thread

    I think there is an issue in your logic, atleast under some conditions.

    The method will select the last npc found on the map.


    So if I place 10 NPC's of the same vnum on the map, it will probably select only one (the first npc matching the vnum).

    Maybe it would be better to return a struct with npc's that were found instead of the first one?

    You're right, I hadn't thought of that

    so it's time for an update.


    If anyone has any more ideas on how to improve the code write a comment

    Hi, I would like to share with you the code that returns the location of a given Vnum-NPC on the map.

    I needed a function to determine the correct location for a movement, when I gave the cords from the regen the location was not the expected result I wanted.
    This code solves the problem, maybe there is another solution but this is mine and it works has been tested


    Bitte melden Sie sich an, um dieses Bild zu sehen.



    latest version GetNpcLocationsByVnum

    *this code will show you all NPC positions on the map with the same Vnum
    Bitte melden Sie sich an, um diesen Link zu sehen.



    ACMD function's in cmd_gm.cpp


    I hope someone will take advantage, it's nice to share with you and especially with those who also share their work for free