Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Damaging a Specific Sensor

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Damaging a Specific Sensor Page: [1]
Login
Message << Older Topic   Newer Topic >>
Damaging a Specific Sensor - 1/31/2020 3:57:27 AM   
Kushan04


Posts: 683
Joined: 6/29/2005
Status: offline
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!

_____________________________

Post #: 1
RE: Damaging a Specific Sensor - 1/31/2020 12:17:39 PM   
stilesw


Posts: 1497
Joined: 6/26/2014
From: Hansville, WA, USA
Status: offline
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

(in reply to Kushan04)
Post #: 2
RE: Damaging a Specific Sensor - 1/31/2020 10:56:55 PM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
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' } }


< Message edited by michaelm75au -- 1/31/2020 10:58:18 PM >


_____________________________

Michael

(in reply to stilesw)
Post #: 3
RE: Damaging a Specific Sensor - 7/12/2020 4:38:57 PM   
Bashkire

 

Posts: 38
Joined: 2/23/2015
Status: offline
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

(in reply to Kushan04)
Post #: 4
RE: Damaging a Specific Sensor - 7/13/2020 1:09:32 AM   
KnightHawk75

 

Posts: 1450
Joined: 11/15/2018
Status: offline
@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.

(in reply to Bashkire)
Post #: 5
RE: Damaging a Specific Sensor - 7/13/2020 11:28:27 AM   
Bashkire

 

Posts: 38
Joined: 2/23/2015
Status: offline
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.

(in reply to KnightHawk75)
Post #: 6
RE: Damaging a Specific Sensor - 7/13/2020 12:11:29 PM   
KnightHawk75

 

Posts: 1450
Joined: 11/15/2018
Status: offline
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




< Message edited by KnightHawk75 -- 7/13/2020 12:28:37 PM >

(in reply to Bashkire)
Post #: 7
RE: Damaging a Specific Sensor - 7/14/2020 1:25:35 PM   
Bashkire

 

Posts: 38
Joined: 2/23/2015
Status: offline
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

(in reply to KnightHawk75)
Post #: 8
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Damaging a Specific Sensor Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

1.453