Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Selected Unit (?contact) Damaged

 
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 >> Selected Unit (?contact) Damaged Page: [1]
Login
Message << Older Topic   Newer Topic >>
Selected Unit (?contact) Damaged - 1/18/2022 1:18:00 PM   
Parel803

 

Posts: 579
Joined: 10/10/2019
From: Netherlands
Status: offline
Good afternoon,
Tried to get damage on a selected unit. Used the exampl from KH on
https://www.matrixgames.com/forums/tm.asp?m=4900919&mpage=1&key=ScenEdit%5FSelectedUnits�
Thanks for that. Didn't try it on a contact yet, next on the list.

I got it working in a special action except the message. Which I wanna make a message box. Since this is made with trial&error (instead of knowledge of it all) I'm sure It can be doen better, if someone sees stuuff to change it is much appriciated.

local sUnits=ScenEdit_SelectedUnits(); --get the list.
-- compile a list of all units and contacts.
local myTempTable = {}
if(sUnits.units ~=nil) then --validate it
for k,v in pairs(sUnits.units) do
table.insert(myTempTable,{name= v.name,guid = v.guid})
end
end
if(sUnits.contacts ~=nil) then
for k,v in pairs(sUnits.contacts) do
table.insert(myTempTable,{name= v.name,guid = v.guid})
end
end
sUnits = nil; --don't need it anymore.

--now process the combined table of units and contacts.
if(#myTempTable > 0) then --if our temptable has more than 0 entries.
local u;
for k,v in pairs(myTempTable) do --loop though selected unit table
u = VP_GetUnit({guid=v.guid}); --get the unit via guid or contact guid. just used for example.
if((u ~=nil) and (u.type=='Ship')) then --only attempt for aircraft or ships.
ScenEdit_SetUnitDamage({guid=u.guid, fires=1, flood=1})
else
print("No Unit selected");
end
end
u = nil; --clear before iterate
end --end for
myTempTable = nil;

I left the notes made by KH in.
Best regards GJ
Post #: 1
RE: Selected Unit (?contact) Damaged - 1/18/2022 9:06:23 PM   
KnightHawk75

 

Posts: 1450
Joined: 11/15/2018
Status: offline
Do you want is asked per-selected-unit

or

one firelevel used for the whole selection.

See attached (tested).


Attachment (1)

(in reply to Parel803)
Post #: 2
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Selected Unit (?contact) Damaged 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.279