I'm confused what special action do you want, one that just allows you to fast-kill a selected unit on the playerside?
If so the follow will allow that.
local function ScuttleSelectedUnit()
local sUnits=ScenEdit_SelectedUnits()
local retval;
if (sUnits.units ~=nil) and #sUnits.units > 0 then
if #sUnits.units > 1 then ScenEdit_MsgBox('You have more than one unit selected, please only select one unit.',0); return; end
for k,v in pairs(sUnits.units) do --loop though selected unit table
retval,u = pcall(ScenEdit_GetUnit,{guid=v.guid}); --get the unit.
if (retval and u~=nil) and u.type ~='Group' and u.side == ScenEdit_PlayerSide() then --are we valid and not a group?
if ScenEdit_MsgBox('Are you sure you want to scuttle unit ' .. u.name ..' ?',4) == 'Yes' then
ScenEdit_KillUnit({guid=v.guid});
ScenEdit_MsgBox('The unit has been scuttled!',0);
end
elseif((u~=nil) and u.type =='Group') then --are we valid and also a group?
ScenEdit_MsgBox('You have a group selected, please select an individual unit.',0);
return;
else
ScenEdit_MsgBox('Could not obtain the unit object for the selected unit with guid: ' ..tostring(v.guid), 1);
end
u=nil;
end
else
ScenEdit_MsgBox('Please select one or more units first.', 0);
end
sUnits=nil;
end
ScuttleSelectedUnit()