Code Monkey home page Code Monkey logo

Comments (6)

Khopa avatar Khopa commented on September 2, 2024

There is something weird with this mission, it must be very old.

I experience the same behaviour on mission load, in the DCS mission editor, the 4 viggens appears on parking slots 19, 18, 20, 24.
But in the panel on the right, they are set up on parking slot 01,02,03,04

See :
image

Then if you save the mission or drag the viggen around, they'll jump to slot 1,2,3,4

I haven't looked into the file format, but I'd say that the slot logic has changed, so DCS default them to the first available slot.

A similar logic could maybe be implemented in pydcs as a fallback mechanism.

Edit : My bad, the fallback to default slot seems already implemented.

from dcs.

Khopa avatar Khopa commented on September 2, 2024

Sorry kind of misunderstood the issue. I'm not sure whether you are encountering the issue on miz load, or if the loaded data is incorrect ?

Where do you encounter the issue exactly ?

(I do not have the error when i load the mission file (unmodified).)

My code :

    def test_load_no_room_error(self):
        test_mission_folder = os.path.join(os.path.dirname(__file__), 'missions')
        m = dcs.mission.Mission()
        self.assertTrue(m.load_file(os.path.join(test_mission_folder, "No Room for Error.miz")))

        group = m.country("Georgia").find_group("Bolt 1")
        print(group)

        print("Parking Index :")
        print(group.units[0].parking)
        print(group.units[1].parking)
        print(group.units[2].parking)
        print(group.units[3].parking)

        print("Parking IDs :")
        print(group.units[0].parking_id)
        print(group.units[1].parking_id)
        print(group.units[2].parking_id)
        print(group.units[3].parking_id)

        print("Parking Slot objects :")
        print(m.terrain.senaki_kolkhi().parking_slot(group.units[0].parking))
        print(m.terrain.senaki_kolkhi().parking_slot(group.units[1].parking))
        print(m.terrain.senaki_kolkhi().parking_slot(group.units[2].parking))
        print(m.terrain.senaki_kolkhi().parking_slot(group.units[3].parking))

Output :

Mission file is using an old format, be aware!
Parking slot id '121' for 'Bolt 1' on airport 'Senaki-Kolkhi' not valid, placing on next free
Parking slot id '90' for 'Bolt 1' on airport 'Senaki-Kolkhi' not valid, placing on next free
Parking slot id '83' for 'Bolt 1' on airport 'Senaki-Kolkhi' not valid, placing on next free
Parking slot id '82' for 'Bolt 1' on airport 'Senaki-Kolkhi' not valid, placing on next free
Group: Bolt 1
Parking Index :
14
15
16
17
Parking IDs :
06
07
08
09
Parking Slot objects :
ParkingSlot(14, "06", large=False, heli=False)
ParkingSlot(15, "07", large=False, heli=False)
ParkingSlot(16, "08", large=False, heli=False)
ParkingSlot(17, "09", large=False, heli=False)

from dcs.

wrycu avatar wrycu commented on September 2, 2024

Hmm. I have the latest version (the released version, not the latest commits) and just load the mission, resulting in the following stacktrace:

Mission file is using an old format, be aware!
Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm 2020.1.3\plugins\python\helpers\pydev\pydevd.py", line 1438, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:\Program Files\JetBrains\PyCharm 2020.1.3\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:/Users/w/PycharmProjects/leetsaber/misc/async.py", line 304, in <module>
    m_data = parser.parse_mission(mission)
  File "C:\Users\w\PycharmProjects\leetsaber\misc\t_dcs.py", line 839, in parse_mission
    self.msn.load_file(str(mission_name))
  File "C:\Users\w\PycharmProjects\leetsaber\venv\lib\site-packages\dcs\mission.py", line 355, in load_file
    self.coalition[col_name].load_from_dict(self, imp_mission["coalition"][col_name])
  File "C:\Users\w\PycharmProjects\leetsaber\venv\lib\site-packages\dcs\coalition.py", line 112, in load_from_dict
    plane.set_parking(slot)
  File "C:\Users\w\PycharmProjects\leetsaber\venv\lib\site-packages\dcs\unit.py", line 125, in set_parking
    parking_slot.unit_id = self.id
AttributeError: 'NoneType' object has no attribute 'unit_id'

Maybe it's been fixed?

from dcs.

rp- avatar rp- commented on September 2, 2024

Yeah I said, I fixed some issues with old missions and one of them was with invalid parking id's(since they changed the format).
So now if the id isn't valid it will be placed in the next free slot of the airport.

Btw. I'm not to much into, trying to load all old missions versions, if it is a simple fix, then ok.
But I'm certainly not going to implement a full mission converter or specific version loader, my recommendation would then be
to just resave the mission in DCS, but in most cases it will be broken anyway, because DCS seems also to not give to much
about mission compatibility.

from dcs.

wrycu avatar wrycu commented on September 2, 2024

That's fine. I just recently grabbed all of the missions off of the ED site and I'm trying to create a database of them... but only a very small percentage (<10%) actually parsed.

from dcs.

wrycu avatar wrycu commented on September 2, 2024

Looks like it's been fixed. Closing.

from dcs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.