TheOttoman
Posts: 139
Joined: 12/14/2017 Status: offline
|
I have a big Lua script to set up a scenario that among other things, adds ports, creates a ferry mission to that port, creates some units, and then adds those units to the mission. I've included the script for troubleshooting. The germane portion of my issue is this. I create the mission using this script: ports = {"Port of Singapore","Port of Batu Ampar","Port of Jakarta"...} <- I've created the facilities earlier in the script
for i, nameofport in ipairs(ports) do
ScenEdit_AddMission('Commercial','Transit to '..nameofport,'Ferry',{destination=nameofport})
end
and then
-- [[Commercial Container Vessel - Panamax]]
ccvpname = {"[VTM] M/V Vinalines Queen","[VTM] M/V Hai Nam 89","[VTM] M/V Vinalines Sunrise","[VTM] M/V Vinalines Brave","[VTM] M/V Inlaco Express"}
for i, name in ipairs(ccvpname) do
RandomNumber()
RandomPort()
ScenEdit_AddUnit({type="ship",unitname=name,side="Commercial",dbid="2028",base=PortName})
RandomNumber()
ScenEdit_AssignUnitToMission(name,'Transit to '..PortName)
end RandomNumber is a 1,24 random number generator, and RandomPort assigns the variable PortName to a specific port based on the number randomly generated.. When I run this in Lua, I get the message in the game message window "[VTM] M/V Vinalines Queen is not an aircraft and cannot be added to a Ferry mission" or something similar for each ship it tries to process. However.... if I go into the Mission Editor (F11), I see all of the missions created as expected, and I see all of the ships as unassigned units, and I can manually assign them to any of the missions. Am I doing something wrong in the Lua script?
Attachment (1)
< Message edited by Dimitris -- 12/12/2018 6:05:34 AM >
|