Iceblade
Admiral
I seem to be having an annoying problem the Ship_setTarget function.
In my mission, I have some placed ships and some ships that are spawned. To avoid having the player attacked by all of them, I created a randomtarget(shipid) function show here.
I have all enemy fighters have a creation script with this function. The spawned fighters appear to receive follow this function perfectly; however, the already existing fighters ignore the target command. Using prints, I know this function is being called and that the right arguments are being passed to the target function with usually one or two fighters out of four slated to attack me. So I have no clue why this function is not working on pre-existing fighters.
I originally had this function called within the nav creation script with the enemy fighter shipid as the argument, but that obviously wasn't working.
The only thing I can think of is that the shipid is not being passed with quotes.
Edit: I tried the LUA tostring() function, but that didn't fix the issue.
In my mission, I have some placed ships and some ships that are spawned. To avoid having the player attacked by all of them, I created a randomtarget(shipid) function show here.
Code:
function randomtarget(shipid)
x = math.random(1,4);
if(x == 1) then
target = "player";
end
if(x == 2) then
target = "stiletto";
end
if(x == 3) then
target = "maniac";
end
if(x == 4) then
target = "maestro";
end
Ship_setTarget(shipid, target);
end
I have all enemy fighters have a creation script with this function. The spawned fighters appear to receive follow this function perfectly; however, the already existing fighters ignore the target command. Using prints, I know this function is being called and that the right arguments are being passed to the target function with usually one or two fighters out of four slated to attack me. So I have no clue why this function is not working on pre-existing fighters.
I originally had this function called within the nav creation script with the enemy fighter shipid as the argument, but that obviously wasn't working.
The only thing I can think of is that the shipid is not being passed with quotes.
Edit: I tried the LUA tostring() function, but that didn't fix the issue.