Skip to content

engineSetModelLODDistance clamped to 19999 ID range #4251

@BlueEagle12

Description

@BlueEagle12

Describe the bug

Using engineSetModelLODDistance with engineRequestModel some times errors out because engineSetModelLODDistance seems to be clamped by (GetBaseIDforTXD) which in turn limits the max ID count to 19999 while engineRequestModel may sometimes push in the 20,000 or 30,000 range.

CLuaEngineDefs.cpp: 1098
if (usModelID < g_pGame->GetBaseIDforTXD())

seems to be the line causing faults.

Steps to reproduce

for i = 0,15000 do
  local model = engineRequestModel('object')
  engineSetModelLODDistance(model,500)
end

Version

No response

Additional context

No response

Relevant log output

Security Policy

  • I have read and understood the Security Policy and this issue is not security related.

Activity

BlueEagle12

BlueEagle12 commented on Jun 10, 2025

@BlueEagle12
Author

As a side note, skimming through the code there are numerous other functions that are clamped by the original range and thus unusable with some IDs produced by engineRequestModel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @BlueEagle12

        Issue actions

          engineSetModelLODDistance clamped to 19999 ID range · Issue #4251 · multitheftauto/mtasa-blue