Closed techdr1ve closed 2 years ago
It is literally impossible for me to figure out the problem without more context. Full sample of what you are passing to whichever function is apparently buggy.
I'm sorry to post only the one line b4, hopefully this above give you a clear picture of my error. Let me know how else I can explain it.
Ok, so it is erroring on your code. I guess the obvious question is if there is a unit in the mission actually named "POW1"? Otherwise yeah it would error because you are using getPoint() on a nil object. Whenever you are getting an object it is a good idea to verify it actually exists before trying to do anything to it.
local u = Unit.getByName("POW1")
if u then
POW1MARKER.pos = u:getPoint()
else
myLog:msg("POW1 didnt exist")
end
I see what you're saying, yea definitely have POW1 in the unit name. Good idea to verify it exists as well I agree. POW1 is group name as well and have tried it without putting POW1 as the group name as well. Still errors.
Is it possible to verify that putting a string name in this function works on your end? u = Unit.getByName("UnitName")
Then I'll know if it's just me or it's a DCS or DCS to MIST issue at that point.
This is actually a different issue than what I thought ... really it's marker.pos that cannot receive a point(). I'll open up another issue for it.
Here are more details, I used the two latest versions of MIST, can't get it to work. Was working a long time (it's a CSAR POW Mod for DCS that I added using MIST)
Line that Errors out:
POW1MARKER.pos = Unit.getByName("NameOfUnit"):getPoint() -- This is the line that errored out, used to work or POW1MARKER.pos = Group.getByName("NameOfUnit"):getPoint() -- This is the line that errored out, used to work
I narrowed my error to this last line above either of the two.
Error from dcs.log: 2022-08-14 04:56:46.250 ERROR SCRIPTING: Error while handling event [string "C:\Users\username\AppData\Local\Temp\DCS.openbeta\/~mis00003EE0.lua"]:1060: attempt to index a nil value
Full Code Sample:
dcs.log file messages: 2022-08-14 04:56:46.250 INFO SCRIPTING: PRISONLOG|1056: D1 2022-08-14 04:56:46.250 ERROR SCRIPTING: Error while handling event [string "C:\Users\username\AppData\Local\Temp\DCS.openbeta\/~mis00003EE0.lua"]:1060: attempt to index a nil value