Jump to content

Recommended Posts

Posted (edited)

Hi,

 

I'm having an issue with the following code. It does not (for me) generate an error, but stops executing/get stuck somewhere in these lines.

 

This does not happen when started from the ME, or when I host a server.

It happens when I join a friends server and trigger this code as a client.

Can anyone see anything obvious that I'm not seeing? I know the code works* in SP / started from ME or when I host the MP session myself. So I know there's no "code error". The error has to be more along the lines of "not working in an MP session".

 

 

local units = mist.makeUnitTable({'[g]Russian Ground Assault Group'})

local ref = mist.utils.makeVec3(mist.DBs.missionData.bullseye.blue, 0)

local avgPos = mist.getAvgPos(units)

 

 

local vec = {x = avgPos.x - ref.x, y = avgPos.y - ref.y, z = avgPos.z - ref.z}

local dir = mist.utils.round(mist.utils.toDegree(mist.utils.getDir(vec, ref)), 0)

local dist = mist.utils.get2DDist(avgPos, ref)

local distMetric = mist.utils.round(dist/1000, 0)

local distImperial = mist.utils.round(mist.utils.metersToNM(dist), 0)

 

dir = string.format('%03d', dir)

trigger.action.outText('Search for artillery at bulls ' .. dir .. ' for ' .. distMetric .. 'km/' .. distImperial .. 'nm',20)

Edited by chrisofsweden
SOLVED

GPU: PALIT NVIDIA RTX 3080 10GB | CPU: Intel Core i7-9700K 4,9GHz | RAM: 64GB DDR4 3000MHz
VR: HP Reverb G2 | HOTAS: TM Warthog Throttle and Stick
OS: Windows 10 22H2

Posted (edited)

Yes just pasting / formatting error on forum. That would definitely generate a script error in game :)

As I said, I know the code itself is sound. It works flawlessly when I host an MP server with this mission.

 

Seemingly it is when another connected client "triggers" this code when it does not work.

Edited by chrisofsweden

GPU: PALIT NVIDIA RTX 3080 10GB | CPU: Intel Core i7-9700K 4,9GHz | RAM: 64GB DDR4 3000MHz
VR: HP Reverb G2 | HOTAS: TM Warthog Throttle and Stick
OS: Windows 10 22H2

Posted (edited)
Possibly you have no code defects and are simply encountering one of these http://forums.eagle.ru/showpost.php?p=2494017&postcount=1 client or client group related issues

 

I was thinking this too first, but...

If I'm not mistaken, client / client groups are the unit or group that is occupied by a client in MP. This code right here only gets data from a spawned AI group... :/

 

 

EDIT: You know what maybe you are right after all. Maybe this function in mist iterates though all groups and fails when it cant access client groups!

local units = mist.makeUnitTable({'[g]Russian Ground Assault Group'})

 

EDIT2: This must have been the culprit. Made workaround. Mission file updated on ED User Files. 2.12 is now current version.

Edited by chrisofsweden

GPU: PALIT NVIDIA RTX 3080 10GB | CPU: Intel Core i7-9700K 4,9GHz | RAM: 64GB DDR4 3000MHz
VR: HP Reverb G2 | HOTAS: TM Warthog Throttle and Stick
OS: Windows 10 22H2

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...