llde / xOBSE

Oblivion Script extender source
247 stars 35 forks source link

GetPathNodesInRadius and GetPathNodesInRect are not working correctly. #182

Open Vitalik-01 opened 1 year ago

Vitalik-01 commented 1 year ago

I have been testing under the following conditions: The activator is installed in the center of the cell (AnvilWorld location), with a large number of nodes of the path grid. The following script is attached to the activator:

ScriptName TTesTT
Float СenterX
Float СenterY
Float Radius
Array_var ListNodes
Array_var   Iterator
Int Adapter

Begin OnActivate
    Let СenterX := GetPos X
    Let СenterY := GetPos Y
    Let Radiys := ****
    Let ListNodes := ar_Construct Array
    Let ListNodes := ar_Construct Array
    Let ListNodes := GetPathNodesInRadius СenterX СenterY Radiys

    ar_Dump ListNodes

    ForEach Iterator <- ListNodes
        Let Adapter := Iterator["value"]
        SetPathNodeDisabled Adapter 1
    Loop
End

After activation, the following result is obtained:

  1. If the radius is less than 2000, it does not detect more than one node. In a rare case, 1 - 2 nodes in the neighboring cell.
  2. If a radius greater than 2000 is specified, it detects nodes located not around the specified radius, but in the form of a polyline shape. In cells with an activator, the detected nodes may be absent or present at the edge of the cell.
  3. The location and number of nodes found does not change when the activator is reused. The result is constant.
  4. Using GetPathNodesInRect leads to a similar result.

I am creating an artificial path network for fish and the real path network periodically interferes with the AI package. For the normal operation of the plugin, it is necessary to make the fish completely ignore the real path grid. The best solution is a new OBSE function, similar to SetAllReachable, which disables pathfinding not for all actors, but only for the specified ones (Ref.SetAllReachable 1). Perhaps there is a way to disable pathfinding for a specific actor that I do not know about. Therefore, I will be glad of any help or advice with this plugin.