Jump to content
  • Table dbscripts_on_creature_movement has no unique ids for primary key


    MrFreak
    • Status: Not a bug
      Main Category: Database
      Sub-Category: Creature
      Version: 2.0.11 Milestone: 20 Priority: New
      Implemented Version: 0.20

    Table dbscripts_on_creature_movement has no unique ids for primary key

    If you look into table dbscripts_on_creature_movement you will notice a problem with the primary keys. To best honest, there are none.

    SELECT COUNT(ID) FROM dbscripts_on_creature_movement;
    tells you that there are 672 IDs found but this query
    SELECT COUNT(DISTINCT ID) FROM dbscripts_on_creature_movement;
    tells you that there are just 246 unique IDs so a lot of the primary keys are threefold or even more existing in the table. This could be because the primary key field id isn't set as a primary key too!

    According to this docs: [url]http://docs.getmangos.com/en/latest/database/world/creature-movement.html[/url]
    This ids are used for this purpose:
    [quote]script_id

    If a script should be executed, this references the “dbscripts_on_creature_movement” table tables unique ID for which the entry is valid. If not, set the value to zero.[/quote]

    You see that the IDs should be unique but in fact they are far away from this. I'm not sure what Mangos does when it tries to execute one of the ids which exist multiple times.


    User Feedback

    Recommended Comments

    OLD dbdocs used by accident and talked with Ants. The script_ids uniqueness refers to the id of each script. This is unique because it is calculated as id + delay which gives you a composite key between them. Delay field is responsible for the sequential execution of them.

    Link to comment
    Share on other sites

    [quote=MrFreak]This is unique because it is calculated as id + delay which gives you a composite key between them. Delay field is responsible for the sequential execution of them.[/quote]
    Not that exactly. The world table structure is more or less reasonable and elaborated. If you do not see the key composed of the two fields, then it's not a key. Nothing prevents us to define several script commands with the same delay, i.e. executed at the same moment of time. The execution order remains undefined though.

    The dbscript_on_* tables should be moved as a whole to the same trash bin as EventAI engine, being substituted by something like TC's SmartAI. However, even TC's SmartAI has yet no full support for this (for instance, spell events not related to gameobjects, so the SmartAI cannot substitute dbscripts_on_event).

    Link to comment
    Share on other sites



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...

Important Information

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. Privacy Policy Terms of Use