
I am pretty new to Command (and Lua scripting) and I have a problem using the automatic attack feature as described in the following website:
https://commandlua.github.io/assets/Fun ... ntact.html.
I have an EF2000 equipped with StormShadow cruise missiles and I want to attack an SA-10 Sam.
First I used the "F1" auto attack option from the GUI, which works perfectly as the EF gets into the required range to deploy the StormShadows and fires two of them as required.
Now, when I try to do the same via the event handling approach using a lua script code as an action, it does not work...
My code is
Code: Select all
attacker = UnitY().unit
target = UnitX()
print(attacker)
print(target)
ScenEdit_AttackContact(attacker.guid, target.guid , { mode='0'} )
Am I missing something?>> attacker = UnitY().unit
target = UnitX()
print(attacker)
print(target)
ScenEdit_AttackContact(attacker.guid, target.guid, { mode='0'} )
unit {
type = 'Aircraft',
subtype = '2002',
name = 'EF2000 Eurofighter Typhoon Two-Seater [TF-2000A]',
side = 'B',
guid = 'UCX05P-0HMRG47SPONFV',
class = 'EF2000 Eurofighter Typhoon Two-Seater [TF-2000A]',
proficiency = 'Regular',
latitude = '52,2266238766894',
longitude = '14,5230216468008',
altitude = '10972,8',
heading = '110,7002',
speed = '350',
throttle = 'Loiter',
autodetectable = 'False',
mounts = '4',
magazines = '4',
unitstate = 'Unassigned',
fuelstate = 'None',
weaponstate = 'None',
AllowMultiMission = 'False',
AssignedMissionsQueue = 'table',
}
unit {
type = 'Facility',
subtype = '5001',
name = 'SAM Bn (SA-10a Grumble [S-300PT])',
side = 'R',
guid = 'UCX05P-0HMRG47SPNVVB',
class = 'SAM Bn (SA-10a Grumble [S-300PT])',
proficiency = 'Regular',
latitude = '52,2842667812602',
longitude = '16,2513846369828',
altitude = '102',
heading = '0',
speed = '0',
throttle = 'FullStop',
autodetectable = 'False',
mounts = '8',
magazines = '9',
unitstate = 'Unassigned',
fuelstate = 'None',
weaponstate = 'None',
AllowMultiMission = 'False',
AssignedMissionsQueue = 'table',
}
Thanks for your help...