Thread: Random Contacts
View Single Post
  #7  
Old 05-13-2010, 02:48 PM
Nanaki Nanaki is offline
Approved Member
 
Join Date: Mar 2010
Posts: 338
Default

Quote:
Originally Posted by Trucidation View Post
I agree, space is entirely too damn quiet for a war to be going on - this mod sounds freaking awesome but is it still giving you trouble? I noticed that the convoy mod you posted a couple posts back is larger than the fleetmodbeta attachment.
The fleetmodbeta attachment was meant for other people to look at to see if they can fix the issue, unfortunately im just not good enough with Lua to fix it myself. It only comes with the barebones script and does not completely work on its own (it is missing the randomcontact entries for the convoys and fleets). I did complete the work on the location files, but I figure theres no point in distributing a full version of the mod until I (or someone else) figures out how to fix this very serious bug that the mod has.

The issue lies with the GetRandomPortalIndexes function, listed below:
Quote:
function GetRandomPortalIndexes(portalList)
local portalCount = getn(portalList);

if portalCount == 1
then
return {1, 1};
end;

local randomIndex = RAND(portalCount) + 1;
local newPortalIndex = randomIndex;

while (newPortalIndex == randomIndex)
do
randomIndex = RAND(portalCount) + 1; -- RAND is ZERO based
end;
return {randomIndex, newPortalIndex};
end;
The script works fine as long as portalCount does not equal 1. However, if Portalcount equals one, the despawn script for the flight's escorts prematurely triggers, which results in a capital ship's escorts despawning literally milliseconds after they spawn. Thus while this script works perfectly in certain systems (especially with multiple jumpgates), all capital ship spawns that are limited to only one jumpgate will spawn with no escorts whatsoever.

Here is the despawn trigger below:

Quote:
local escort1 = getglobal("flight_randomformation_"..__formation_n umber.."_escort1");
if escort1 ~= null then
local escort1 = getglobal("flight_randomformation_"..__formation_n umber.."_escort1");
local trigger_deleteescort = CreateTrigger();
trigger_deleteescort:AttachEvent(_EVENT_FLIGHTINSI DEOBJECTVOLUME);
trigger_deleteescort:SetObjects(escort1, currentContact[3][portalEndIndex], 120);

trigger_deleteescort:AttachCondition(trigger_delet eescort_Condition);
trigger_deleteescort:AttachAction(trigger_deletees cort_Action);
trigger_deleteescort:Activate();
end;
Quote:
function trigger_deleteescort_Condition()
local myTriggerContext = GetTriggerContext();
local portal = myTriggerContext:GetDestinationObject();
local flight = myTriggerContext:GetFlight();
local pos = flight:GetPosition();

portal:Start(5, 0);
return TRUE;
end;

function trigger_deleteescort_Action()
--SLOG("Action done....");
local myTriggerContext = GetTriggerContext();
local flight = myTriggerContext:GetFlight();
flightelete();
end;
It annoys me because I know what the problem is, but I have not the foggiest idea how to fix it.

Last edited by Nanaki; 05-13-2010 at 07:49 PM.
Reply With Quote