Damaging a Specific Sensor (Full Version)

All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion



Message


Kushan04 -> Damaging a Specific Sensor (1/31/2020 3:57:27 AM)

I'm trying to destroy a specific sensor on an aircraft. The following bit of code will damage a sensor, but instead of damaging the one specified its damaging a random sensor.

ScenEdit_SetUnitDamage({side='Good Guys', unitname='F-111F Aardvark', components={{'type',type='sensor',comp_name='AN/AVQ-26 [Laser Designator',2}}})


Can anyone please tell me what I'm doing wrong? Thank you in advance!




stilesw -> RE: Damaging a Specific Sensor (1/31/2020 12:17:39 PM)

quote:

ScenEdit_SetUnitDamage({side='Good Guys', unitname='F-111F Aardvark', components={{'type',type='sensor',comp_name='AN/AVQ-26 [Laser Designator',2}}})

Brandon,

I could be wrong but I "think" the online reference may be incorrect. My suggestion would be to remove 'type', as typically it should be just type='sensor'. So I would try removing the highlighted word:

ScenEdit_SetUnitDamage({side='Good Guys', unitname='F-111F Aardvark', components={{'type',type='sensor',comp_name='AN/AVQ-26 [Laser Designator',2}}})

-Wayne




michaelm75au -> RE: Damaging a Specific Sensor (1/31/2020 10:56:55 PM)

quote:

{'type',type='sensor',1}

means change the damage level of a 'sensor' on the unit to 1

To damage a specific component, you need to supply the actual component GUID (you can't go by name as there could be multiple sensors with same name).
quote:

{'16a883a2-8e7f-4313-aae7-0af644c16337',1}

means change the damage level of the component '16a883a2-8e7f-4313-aae7-0af644c16337' on the unit to 1

Sample
quote:

specific SRBOC showing light damage
Line 38: { [1] = { type = 'Mount', damage = Light, guid = 'ddbe1ca7-c298-45f9-b1f3-ade1d4d1f45c', status = Damaged, name = 'Mk36 SRBOC', dbid = 565 }, [2] = { status = Damaged, damage = Light, name = 'CIC' } }

Set damage for specific SRBOC to medium
Line 60: local a = ScenEdit_SetUnitDamage({name='AOE 421 Sagami', guid='004aa55d-d553-428d-a727-26853737c8f4',components={ {'ddbe1ca7-c298-45f9-b1f3-ade1d4d1f45c','Medium'},{'CIC','Light'} },flood=1})

Results in damage to specific component only
Line 64: { [1] = { comp_status = Operational, comp_dbid = 1175, comp_guid = '04beaf43-9750-41f9-aa20-13f3d23c5cb1', comp_type = 'Sensor', comp_name = 'J/OPS-16C' }, [2] = { comp_status = Operational, comp_dbid = 0, comp_guid = '73121410-96b8-40ad-a555-5c3346ef723e', comp_type = 'Sensor', comp_name = 'Mk1 Eyeball' }, [3] = { comp_status = Operational, comp_dbid = 565, comp_guid = '4e0c45b0-2ebf-4244-8b32-fabedb359a7d', comp_type = 'Mount', comp_name = 'Mk36 SRBOC' }, [4] = { comp_status = Damaged, comp_damage = Medium, comp_dbid = 565, comp_guid = 'ddbe1ca7-c298-45f9-b1f3-ade1d4d1f45c', comp_type = 'Mount', comp_name = 'Mk36 SRBOC' }, [5] = { comp_status = Operational, comp_dbid = 565, comp_guid = 'bca76fa9-a511-41ec-a410-a07014d9d393', comp_type = 'Mount', comp_name = 'Mk36 SRBOC' }, [6] = { comp_status = Operational, comp_dbid = 565, comp_guid = '864d0d3f-a11e-4f5d-a22a-65771d38c5d1', comp_type = 'Mount', comp_name = 'Mk36 SRBOC' }, [7] = { comp_status = Operational, comp_dbid = 72, comp_guid = '248b48...
Line 65: { [1] = { type = 'Mount', damage = Medium, guid = 'ddbe1ca7-c298-45f9-b1f3-ade1d4d1f45c', status = Damaged, name = 'Mk36 SRBOC', dbid = 565 }, [2] = { status = Damaged, damage = Light, name = 'CIC' } }




Bashkire -> RE: Damaging a Specific Sensor (7/12/2020 4:38:57 PM)

Sorry to necro a thread, but could you help me with the syntax for damaging some components? I'm trying to use GUIDs, but it doess't seem to be working as intended.

Currently I have tried the following 2 types of code:

ScenEdit_SetUnitDamage({side="NATO", unitname="[L 14] HMS Albion [LPD]", fires=1, components={{"6G4KQB-0HM16BU5RNE4P", 2}}});

ScenEdit_SetUnitDamage({side="NATO", unitname="[L 14] HMS Albion [LPD]", fires=1, components={{"6G4KQB-0HM16BU5RNE4Q", 2}}});

ScenEdit_SetUnitDamage({side="NATO", unitname="[L 14] HMS Albion [LPD]", fires=1, components={{"6G4KQB-0HM16BU5RNE4R", 2}}});

and
ScenEdit_SetUnitDamage({side = "NATO", unitname='[L 14] HMS Albion [LPD]', components={ {'6G4KQB-0HM16BU5RNE4P','Medium'}},fires=1})

ScenEdit_SetUnitDamage({side = "NATO", unitname='[L 14] HMS Albion [LPD]', components={ {'6G4KQB-0HM16BU5RNE4Q','Medium'}},fires=1})

ScenEdit_SetUnitDamage({side = "NATO", unitname='[L 14] HMS Albion [LPD]', components={ {'6G4KQB-0HM16BU5RNE4R','Medium'}},fires=1})


Both methods cause fires, but the landing pads stay mysteriously undamaged




KnightHawk75 -> RE: Damaging a Specific Sensor (7/13/2020 1:09:32 AM)

@Bashkire

ScenEdit_SetUnitDamage({unitname='6g4kqb-0hlt9ge7br1es', fires=1,components={ {'6g4kqb-0hlv7lnpvs53a','Medium'}}})
ScenEdit_SetUnitDamage({unitname='6g4kqb-0hlt9ge7br1es', fires=1,components={ {'6g4kqb-0hlv7lnpvs53b','Medium'}}})

Worked fine on the sample scene you posted, damaged both pads and put the ship on fire.




Bashkire -> RE: Damaging a Specific Sensor (7/13/2020 11:28:27 AM)

You again! People are going to start talking!

Cheers. That's working wonderfully. Where are you getting the references for those components, though? If I "print (unit.components)" then I get a lot of GUIDs but none of them are the strings you've mentioned above.

It would just be good to know so I can use this code for future reference.




KnightHawk75 -> RE: Damaging a Specific Sensor (7/13/2020 12:11:29 PM)

I pulled them from the same list of unit.components from the ship in the scene you posted in the other thread.
Obviously if you're not using that scene the guids are likely different but I used it as a sample available to both of us for demonstration purposes.

The following may help you narrow down the 'printed' list to just the helicopter pads though, instead of just dumping everything.

local unit = SE_GetUnit({side="NATO", name="[L 14] HMS Albion [LPD]"});
for k,v in pairs(unit.components) do
  if v.comp_name:find('Pad') ~=nil then  --if the name includes the string 'Pad' do the following..
    print(v.comp_name .. ':  ' .. v.comp_guid)  -- dump just the name and the guid to output
    -- could just optionally do the damage right now too...
    --ScenEdit_SetUnitDamage({unitname=unit.guid, fires=1,components={ {v.comp_guid,'Medium'}}}) 
  end
end






Bashkire -> RE: Damaging a Specific Sensor (7/14/2020 1:25:35 PM)

Ah, no I see what I was doing. I was referencing an HMS Albion from my test mission rather than the actual one I'm working on so the GUIDs were different.

Cheers for showing me where I was going wrong! :D




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
3.812012