December 21, 2024, 17:52:11

Author Topic: [Fixed] Selecting Navpoints  (Read 5172 times)

Offline Mularac

  • Lieutenant
  • ***
  • Posts: 531
  • Karma: 11
    • View Profile
[Fixed] Selecting Navpoints
« on: January 31, 2011, 00:42:50 »
Hey, how do you select all the navpoints on an scene?

(and no, using "s.this:class=#Navigation_Point" only sorts out ships, not the rest of the game objects (effects, npcs, devices, etc)).

For example, using something like this:

Select(e.list, s.this:class=#Navigation_Point);

will return npcs, devices, navpoints, and all the sort of things that doesn't fall under the category of ships.

However, if you use this:

Select(e.list, s.ship&s.this:class=#Navigation_Point);

It'll return 0, as navpoints aren't covered in "ships", even though if you debug a variable holding a navpoint it'll appear as "ship/<Name of the navpoint>"

On a related topic, does anyone have a list with all the "s.<something>" "checkers"? Like s.ship, s.device, s.owner, s.devicetype, etc?
« Last Edit: April 05, 2011, 04:31:01 by Mularac »

Offline Arparso

  • Administrator
  • Lieutenant
  • *****
  • Posts: 558
  • Karma: 14
  • I can see you...
    • View Profile
    • http://arparso.de/nexus
Re: Selecting Navpoints
« Reply #1 on: January 31, 2011, 02:54:24 »
Try s.behaviour = 5. As far as I'm aware, all nav points have behaviour 5, no matter if they were created in-editor, in-code or in-game.

If you have some custom shipclass also using behaviour 5 for ... something ... and you don't want to select that, then also check the class:
s.behaviour = 5 & s.class = #Navigation_Point

---------------------

As for the s.<something>: check the modding manual, chapter 9 "Variables, Parameters". About everything there can be used for selection. E.g. "s.ship" just looks for the ship-variable to not be 0 for any given object... which typically only holds true for all ships.

This is also the reason why s.class = #Navigation_Point also gets you NPCs, devices, effects, etc.: #Navigation_Point will be resolved to 0 (which is its shipclass ID), so you basically try to select every object where the class-variable is 0. NPCs don't have a class-variable, so asking them to return the value of their class-variable returns the default value: 0. The same for devices, effects, etc. ... only the actual ships won't be included, since their class-variables will be set to something non-zero.