Page 1 of 1

Scripting woes

Posted: Sun Feb 22, 2026 12:34 pm
by Schlonz
Hi all,

I'm currently trying to elaborate the scripting for the "Collision Course" scenario,
but I don't get the "unload" command to work.
Does it refer to the carrier or to the passenger?

I have yet to find an existing Lua script which uses "unload".

------------------------------
-- _APCS_73 -- APCs, 3rd pltn Recon Company
do local units = _APCS_73
move_way_point (units, {"15,9","19,13"})

if at (units, "19,13") then
unload (units, "19,13", 100)
end

if are_unloaded (units) then
withdraw (units, "19,12")
end

end

-----------------------------------

Re: Scripting woes

Posted: Sun Feb 22, 2026 4:33 pm
by Jason Petho
Here is a sample of what I did to deal with a mechanized company (transport)

do local units = difference(_1ST_15TH_MECHANIZED_RIFLE_COY_66_B_BTR50_1203,{1204,1205,1206,1207})
if turn >= 2 then
if are_loaded(units) then
move_wary_way_point(units, {"33,21","35,28","31,30", "31,32"}, NODIR, 3, 100, 1)
end
end
if turn >= 6 then
if within(units, "31,32", NODIR, 1, true) then
unload_scatter(units, "31,32", DOWNDIR, 1, 100)
elseif not are_not_carried(units) then
unload_scatter(units, HEXUNKNOWN, DOWNDIR, 1, 100)
end
if are_not_loaded(units) then
move_norush(units, "30,24")
elseif are_not_loaded(units) and within(units, "30,34", NODIR, 2, true) then
defend_scatter(units, "30,24", DOWNDIR, 1, 100, false, DEFEND_WEAK)
elseif are_not_loaded(units) and within(units, "30,34", NODIR, 2, true) and units_within_count("31,30", DOWNDIR, 7, JORDANIAN_SIDE, true ) >= 1 then
defend_scatter(units, "31,20", DOWNDIR, 1, 100, false, DEFEND_WEAK)
end
end
end