Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Corellon

Pages: [1]
1
Scripting / Finding a retrofit order
« on: September 19, 2011, 07:03:48 PM »
Code: [Select]
OrderList orderlists;
bool orderfail  = orderlists.prepare(shipobj);
if(!orderfail)
return false;
Order@ orders = null;
OrderType Otype;
uint OrdCount = orderlists.getOrderCount();
if(OrdCount > 0 )
{
warning("Destory order is > 0");
for (uint ord = 0; ord < OrdCount; ++ord)
{
@orders = orderlists.getOrder(ord);
Otype = orders.getType();
if( Otype == OrdT_Retrofit || Otype == OrdT_Scuttle )
return false;
}
}
Trying to detect if a ship is being scuttled or retrofitted, it used to work in 1.0.9.0 but since 1.1.0.0 orders seem to have been changed? when I run that code it checks the orders, sees the orders but never finds a retrofit or scuttle order even though the ship is being scuttled or retrofited.

What am I doing wrong? code worked great for 1.0.8.2 and I think 1.0.9.0 but now I have to add more null pointer checks (Orderlists.prepare would fail on me for some reason) and it never finds the retrofit or scuttle order

2
Scripting / CTD and reading minidumps
« on: September 08, 2011, 10:39:37 AM »
Could someone with more experience help point me in the right direction as to what is causing my CTD's? nothing I add to my scripts seems to trigger a warning before the crash, log doesn't show anything except for making a minidump so I'm at a loss.

Is there a way to read the minidump to tell what script is causing the crash? Attached is a dump.

I'd love to learn how to read them myself if anyone can give a pointer, I'm thinking it may be a thread safety issue myself but not sure where to look, I haven't even had any problems with the same script before and now it's happening all the time.

3
Modding / [WIP][Proof of Concept]AIR Mod v0.0.2
« on: August 04, 2011, 07:25:37 AM »
In the not so distant future mankind relies so heavily on technology that nothing can be accomplished without the aid of a processor, even toasting bread requires a processor to ensure the optimum temperature and preservation of nutrients.

Wars are no longer fought man to man, squads of self aware robots act to carry out the will of their commanders located safely in remote bunkers. Resources, money, greed or just plain difference of opinion, the reasons were and are still the same, that was until the "others" arrived.

Out of nowhere past Saturn came the first fleet, laying waste to anything in it's way, 60% of the earths population was lost before the invaders could be repulsed, turns out if you strap a jet pack to a bot it will fight just as well in space as on the ground.  Among the wreckage was our first glimpse at FTL travel.

Our planet ravaged by war and orbital bombardment, radiation lethal in the majority of places mankind at last had the one reason it could accept to put aside all differences.... survival...  a world government was formed and plans laid to send what was left of our population on giant arc ships to prime locations recovered from the salvaged ships. 

With the ships ready to launch the decision was made, in hopes of preventing new wars from destroying the new colonies all robotic armies would be terminated and destroyed before we left, after all what good are armies in space now that we have ships?

But disaster always comes in three, the robots now faced with destruction revered to self preservation mode, with the new world government and a unified military the old overrides no longer worked, see we built them too smart... with the government no longer the same and "enemies" in command the orders were deemed counterfeit and ignored....

Our ship managed to launch before the spaceports were stormed, did any other ships make it out? what became of the robots left behind? are the "others" still out there? We don't know yet, we want you to find out...

From the above story I guess you can tell the theme will be A.I. Rebellion which I plan to create a whole new style of play for. 

Some features I want to add in:
Better AI ship designs
Expanded ship systems
and alot more others I won't mention till I can deem them possible, I have big plans though even if it will take time.

First plan I had and is the basis of this proof of concept is a missile launcher subsystem.  right now it's very crude and the GUI still has a few kinks but the idea is that there is a system called "missile launcher" when that's in place a new tab in the same area as carrier settings opens up called "missile loadout".  From there you can select a missile design to use (Has to have a missile hull to show up in the list)... Yes you can design your own missiles... Extra damage? Extra speed? Better armor to survive? Your call.... Missiles right now are just ship(missile) hulls that are spawned and sent off on their way, you can add anything to them like a ship which is why this is still a WIP but eventually will have only missile components which can only be used on missiles and restrict ship components from use... the idea is that missiles and boarding parties will now have to reach the target to cause effect.

v0.0.2 PoC:
Updated Missile launches to (what should be) a threadsafe method, Missile blueprints are to be named "Missile #" IE: "Missile 1", "Missile 102" (without quotes) since I can't think of a way to access a string in a threadsafe way (without maintaining a huge static array) but can work with a number.  (Either this or a fix number of defined names such as: Light Missile, Missile, Heavy Missile, Armored Missile, etc)
Work can continue on now past this hurdle

v0.0.1 PoC:
Missiles implemented roughly, proof of concept that you can store and choose layouts without interfering with carrier functions.
Includes v1 of Smart Gov Mod with minor bug fixes

4
Scripting / importing from another file
« on: August 03, 2011, 07:14:31 AM »
I want to import a function for use from another file, but they are in different directories is that possible?

I notice the imports are: import void test() from "test"

but I want to have one of the gui scripts access a function from the sever script directory

I tired import void test() from "test" and import void test() from "../scripts/server/test"  and "~/Game Data/scripts/server/test" but none worked, is is possible? or are they different?

if not possible can I use #include without conflict? #include just imports the whole file where import is just one function reference?

5
Scripting / ?& Datatype
« on: August 02, 2011, 08:27:43 PM »
in the dictionary function there is a bool get(string&, ?&) const function, what datatype is ?&

can the dictionary store 2 strings? like get("Default design", string)?

Maybe I'm looking in the wrong way but need to find a way to store a use a int or a string to retrieve another string, I think @string[] would work but would use alot of extra memory

6
Scripting / Getting A Hulllayout ID?
« on: July 30, 2011, 03:57:51 PM »
I know you can get a hulllayout by the ID or by the name, but is there a way to find out the ID from the layout? Other the cycling through all the available hulls?

Something like your military outpost is "Outpost design X"

you can get the layout with const HullLayout@ getShipLayout("Outpost design X") but say you knew the layout already is there a way to find out what ID is assigned to it so you can load it with: const HullLayout@ getShipLayout(uint)?

Also what is the purpose of: int metadata?

7
Version 1.6 Released

Star ruler has some complex economic features such as production bonuses for mood and population, and the erudite AI knows how to manage them very well while the stock governors are apathetic following a never changing script.  This mod adds some intelligence to the governors letting them manage their planets to as close to optimum production possible.

What you get with stock is....

Underling: "What do we build next boss? A new city?"
Governor: "You have much to learn young one, we're going to build a mine there"
Underling: "But sir, we already have so many mines and so few people to work them they are running with minimum crews already"
Governor: "Are you questioning me?"
Underling: "No sir!, Just want to learn sir"
Governor: "All you need to know is in here" Holds up a book titled "Planetary governing for dummies"
Underling: (Mental facepalm)

Where with the mod, the governor will consider in multiple factors such as production, needs, export capability, population and decide on the best course of action and in the future when technology changes it will adjust accordingly.

If it's more effective to have a city for a production bonus then a resource producer then it builds the city, if the planet is full then it scraps the producer to build the city (it factors in the loss).
It will adjust production to optimize export so as much as possible is available to the galactic bank, if production is exceeding export capabilities then it will build more ports, if there is no room then it will scrap a city or a producer (whichever is least effective) and build a port.

Your economics level goes up? too much export capability? then it scraps the port to build a city or producer (whichever is better)

I hope I got all the kinks out and dealt with all scenarios, on balanced worlds it won't scrap a city though, I couldn't figure out how to do it without it looping.

Merged and improved on my Automated Defense mod so that planets will now build Military Platforms automatically and rebuild them if destroyed, no more finding worlds lost or undefended from whittling attacks while your occupied elsewhere, will automatically build Military Outposts every X minutes (Configurable and toggleable in the empire window)

Files:
 -Smart Gov.zip - 1.1.0.0 compatible version
 -BasicEffects.as - A modified version of the governor selection, not part of the mod but provided for those that want to try (unsupported though it works for me)

Attached to 2nd post , Untested, Unofficial rough-in's (Can anyone that plays GA tell me if the Smart Gov button in the empire window shows up properly?):

 - GA.Zip - Galactic Armory 1.8.1 version rough in(If anyone wants to test), for Orbitalshipyards should select the old shipyard planet governor still.
 - FRB.zip - FRB 2.1.2 version roughed in, highly untested and unofficial, looking for comments (Pretty sure it should work with 2.1.3b as well, can someone let me know?)

8
Suggestions / Combine()
« on: July 14, 2011, 01:55:12 PM »
Maybe I'm using the wrong function but tried using combine to merge 2 strings. 

combine( "Level", f_to_s(level));

and the compiler errors, combine is only overloaded for more then 3 strings, have to use

combine( "Level", f_to_s(level),"");

am I just using the wrong function for 2 strings?

9
Modding / Automated rebuilding of defenses V2
« on: July 10, 2011, 03:16:24 PM »
I got tired of losing planets because of not being warned on attacks (if there is even a scout in the system it fails to warn of incoming fleets) or pirates eventually whittling down a system when I wasn't looking so I made this up.

Small script I made to automatically rebuild defenses that are destroyed, I wanted to make a script that would automatically build around the planet but thought it would be too CPU intensive to have each planet check for stations orbiting it (or rather sort through all objects in each system and count which are orbiting the planet) so settled one something that will just rebuild all the ones that are lost.

in ships.as:

Code: [Select]
bool onOwnerChange(HulledObj@ ship, Empire@ from, Empire@ to) {
if(from.isAI())
return false;
Object@ shipobj = ship.toObject();
Planet@ target = ship.inOrbitAround();
if( @target != null && @from != null )
{
const HullLayout@ shiplayout = ship.getHull();
if( shiplayout.hasSystemWithTag("Station"))
{
Object@ targetobj = target.toObject();
Empire@ Player = getActiveEmpire();
OrderList orderlists;
orderlists.prepare(shipobj);
Order@ orders = orderlists.getOrder(1);
OrderType Otype = orders.getType();
if( Player.ID == from.ID && Otype != OrdT_Retrofit && Otype != OrdT_Scuttle)
targetobj.makeShip(shiplayout.getLatestVersion());
}
}
return false;
}

As far as I can tell a ship is never destroyed without calling on owner change, if it is it happens very rarely, it works from what I've tested but haven't been able to do a all scenarios type test, probably a better way to optimize it too if anyone has suggestions

10
Modding / Global variables
« on: July 10, 2011, 11:32:01 AM »
I want to be able to check the maximum level available of certain structures but I from what I understand the only way to do that would be with the research web.  Using that method is supposedly very slow and would cause a issue if it's accessed for each planet every time.

Is there a global variable? It doesn't have to be realtime, even if it's lagging slightly but a way to store the variable just once and access it as needed? have it updated by a less frequently used script, something similar to a tick say update it every minute or every 5 minutes?

11
Suggestions / StructureEffects.as
« on: July 08, 2011, 09:47:25 AM »
Was going over the scripts trying to figure out if there was a way to get a colony ship to carry cargo to a planet it's colonizing... Interesting enough if you add a shipbay it will spawn the contents around the planet (like defense stations) but cargo is just lost. Also is there a way to limit the number of ships a shipbay can carry (other then building and docking manually)? If you don't use a quantum compressor your limited on scale, you use it and your ships can't move due to too much mass. Either I took 0 defense stations to the planet or took 1500....

Anyways saw this here, thought it should be:

void ChangeResearchOwner(Event@ evt, Empire@ from, Empire@ to, float Amount) {
if (from.isValid() && to.isValid())
{
      from.modResearchRate(-1.f * Amount);
      to.modResearchRate(Amount);
}

void ChangeResearchOwner(Event@ evt, Empire@ from, Empire@ to, float Amount) {
   if (from.isValid())
      from.modResearchRate(-1.f * Amount);
   if (to.isValid())
      to.modResearchRate(Amount);
}

Otherwise I suppose it's possible to have the drain but it not go anywhere (Say a existing treaty with a dead empire? I don't know)

Also at a loss, doesn't look like it's exposed but are the planetary queues exposed? would like to change the retrofit and remove rates, find right now structures are removed or retrofitted too slowely.

12
Strategy / Hauling...
« on: June 25, 2011, 08:15:28 PM »
Maybe I'm missing something but I've never been able to get a trade route setup properly to supply a dry dock or shipyard planet.

Either I continually have to issue "supply once" orders or they just shuffle resources around, grabbing from one planet, taking to the next, grabbing form there taking to the drydock loading from the drydock and taking to the planet, rinse and repeat.

Is there a way to just tell the haulers to supply single point? grab from anywhere else but only supply a single object? also is there a way to insure a unit with a cargo bay (such as a dry dock) doesn't get overloaded with excess adv parts or elecs? Say where a design is 80% metal but the drydock starts collecting 80% parts or elecs?

13
Help & Support / Orbital Defenses
« on: June 24, 2011, 01:59:44 AM »
Not sure if this is by intent or a quirk but I always thought that stations should only orbit stationary bodies, with the exception of planets with planetary thrusters.

But found out that they will orbit ships as well, at least large ships... build a scale 1mil orbital factory and the stations retrofited and started orbiting the factory, when it started crossing the galaxy the stations came along with it.

Is that by intent? Personally think they should only orbit planets myself.

14
Bug Reports / [1.0.7.8] Game not responding hovering over planet
« on: June 23, 2011, 12:44:05 PM »
Started to notice this on 1.0.7.6 but thought it was just the machine itself but it's happened since then on multiple machines with different (other then OS Win 7 64bit) configurations. 

Not sure what extra information I can impart other then when you hover the mouse over a planet while something is being built that after the construction reaches 100% (usually if not always after it's finished and disappeared) there is the odd time the game just freezes and becomes unresponsive requiring a task kill.

Only seems to happen when hovering the mouse over the planet to watch the "tool tip" style progress report, length of hover doesn't seem to matter, I've had it freeze if I just happen to mouse over at the same time as it reached 100% and disappeared and I've had it freeze when I've watched it for a while.

Most times you can watch several items build and nothing happens but it's a risk as sometimes it just hangs.  It's almost always (If not always I can't recall any other instances) just after the item reaches 100% and disappears from the tip, can't recall a time it's frozen while still displaying 100% or less, only when its' removed from the list. Perhaps a constructor or pointer? Seems more prone when the governor is doing the building then when i have things queued up, perhaps governor adding something and invalidating the "tool tip"?

Wish I could provide more info, happy to answer any questions I could.

15
Bug Reports / [Fixed] Remnant Gates - Multiplayer
« on: June 20, 2011, 12:44:25 PM »
Using the gates does not seem to send the translation over to the other players in multiplayer.

Host uses gate from system unexplored by connected client
Planet warped in appears in the host system under the clients race
Client only sees that the planet being dead and uncontrollable but still in original system
Client can't manipulate planet, build, colonize or issue orders.

16
Modding / GUI Mod - Build on All
« on: June 17, 2011, 01:06:45 PM »
Whipped this up this morning, after the right click menu is available to us finally figured I can do what I've always wanted, make a "Build on All" function.

Instead of building on the best planet, it will build the layout on ALL planets that you own in the system(s), great for mass defense production as I like to have a number of orbital platforms around each planet.

build_on_best.as was modded: Added
Code: [Select]
void buildOnAll(System@ system, const HullLayout@ layout, int buildCount) {
if(system is null || layout is null || buildCount < 1)
return;

Empire@ emp = getActiveEmpire();

SysObjList objList;
objList.prepare(system);

for(uint i = 0, mc = objList.childCount; i < mc; ++i)
{
Object@ cObj = objList.getChild(i);
Planet@ cPlanet = cObj.toPlanet();
if(cPlanet is null || @cObj.getOwner() != @emp)
continue;
for(int z = 0; z < buildCount; ++z)
{
cObj.makeShip(layout);
}
}
objList.prepare(null);
}

void buildOnAll(const System@[] &in systems, const HullLayout@ layout, int buildCount) {
uint systemCount = systems.length();
if(systemCount == 0 || buildCount < 1 || layout is null)
return;
for(uint i = 0; i < systemCount; ++i)
if(systems[i] is null)
die("Null System@ when building across systems");

Object@ pl = null;

Empire@ emp = getActiveEmpire();

SysObjList objList;

for(uint f = 0; f < systemCount; ++f)
{
objList.prepare(systems[f]);
for(uint i = 0, mc = objList.childCount; i < mc; ++i)
{
Object@ cObj = objList.getChild(i);
Planet@ cPlanet = cObj.toPlanet();
if(cPlanet is null || @cObj.getOwner() != @emp)
continue;
for(int z = 0; z < buildCount; ++z)
{
cObj.makeShip(layout);
}
}
}
objList.prepare(null);
}
context_menu.as was modded: Added
Code: [Select]
class BuildShipAllMenu : ContextCallbackManager {
GuiContextMenu@ menu;
SortedBlueprintList layouts;

void init(GuiContextMenu@ Menu) {
@menu = Menu;

layouts.update(getActiveEmpire(), true);
uint cnt = layouts.length();
for (uint i = 0; i < cnt; ++i) {
menu.addItem(layouts.getText(i), 0, true, false, false);
}
}

GuiContextMenu@ getMenu() {
return menu;
}

void add(ContextCallback@ cb) {
// Not supported
}

void call(uint i, Object@ clicked) {
// Get the correct layout
const HullLayout@ lay = layouts.getLayout(i);

if (lay is null)
return;

System@ sys = clicked;
@sys = clicked.getCurrentSystem();

// Get amount to build
uint amount = shiftKey ? 5 : 1;

// Build the correct way
if (ctrlKey)
multiBuildAll(sys, lay);
else
buildOnAll(sys, lay, amount);
}
};

Changed:
Code: [Select]
void addShipsMenu(GuiContextMenu@ menu, Object@ from, Object@ to) {
// Check we clicked something sensible
if (to is null)
return;

// Check if this is a system we're ordering
System@ sys = to;
if (to.toStar() !is null)
@sys = to.getCurrentSystem();

// Can only construct on owned objects
if (sys is null) {
if (to.getOwner() !is getActiveEmpire())
return;

// Check that it has construction capabilities
if (!canConstruct(to))
return;
}
else {
// We need planets in here to construct
if (!sys.hasPlanets(getActiveEmpire()))
return;
}

// Add manage queue item
if (sys is null) {
addItem(menu, localize("#RM_ManageQueue"), manageQueue);
}

// Create the callback
BuildShipMenu@ cb = BuildShipMenu();
BuildShipAllMenu@ cball = BuildShipAllMenu();

// Get the correct text to use
string@ text;
if (sys !is null)
{
@text = localize("#RM_BuildShipsBest");
// Add ships menu
GuiContextMenu@ buildShips = addSubMenu(menu, text, cb);
GuiContextMenu@ buildShips2 = addSubMenu(menu, "Build on All", cball);

}
else
{
@text = localize("#RM_BuildShips");
// Add ships menu
GuiContextMenu@ buildShips = addSubMenu(menu, text, cb);

}
\include\dialog.as was modded: Added
Code: [Select]
void multiBuildAll(System@ buildAt, const HullLayout@ ship) {
clearMultiBuild();
@_di_curSys = buildAt;
@_di_buildShip = ship;

addEntryDialog(localize("#PL_QUEUE_AMOUNT"), ship.getName()+" "+localize("#PL_QUANTITY")+":",
    "1", localize("#PL_BUILD"), @doMultiBuildAll);
}
void doMultiBuildAll(EntryDialog@ dialog, string@ amount) {
int buildCount = s_to_i(amount);

if(@_di_curSys != null && @_di_buildShip != null) {
buildOnAll(_di_curSys, _di_buildShip, buildCount);
}
}

the other 2 in the include were included because if referenced in dialog.as they have to be in the mod folder game won't revert to base if not found.

17
Bug Reports / [1.0.7.6] Stations orbiting the star.
« on: June 11, 2011, 07:57:30 AM »
If you make a drydock type station and decide to retrofit a existing station on the drydock it completes and jumps over and starts orbiting the sun instead, same thing too sometimes when you order the drydock to make more stations.

I could understand if a ship with a dry dock tried to build a station in the middle of nowhere, but why not have it jump to the nearest planet rather then the star (that way it should always at least go back where it started)

18
Scripting / Auto Retro fit
« on: June 11, 2011, 07:54:13 AM »
Looking to mod the Auto retrofit script, when I build defense stations they only retrofit on worlds that have a shipyard, planets that don't have one won't auto retrofit the stations (my guess is the stations have to get to a planet that does have shipyard, if it can't move it won't do anything).

Is this script exposed? I can't find it anywhere on how to mod in a function check for immobile defenses to rebuild where they are instead of doing nothing.

19
Scripting / Import/Export Bank
« on: May 28, 2011, 02:28:33 PM »
Looking to modify the script for the exporting to the Galactic Bank so that planets so that some planets will hold more then 50% in their storage before exporting (such as for shipyard planets so they have a surplus available)

 float getResourceWeight(State@ state, float freeCargoSpace, float tradeToPct) {
   if(abs(state.max) < 0.01f)
      return 0.f;
   float pct = (state.val + state.inCargo)   / (state.max + state.inCargo + freeCargoSpace);
   if(pct > 0.5f)
      return (1.f/tradeToPct) * (pct - tradeToPct);
   else if(pct < 0.5f)
      return (-1.f/tradeToPct) * (tradeToPct - pct);
   else
      return 0;
}

That seems to control the decision of how much to trade right? But have 2 questions:
1 - why is state.incargo in both the sides of the equation? Am I understanding it wrong but isn't incargo how much you have of that stored? so shouldn't it be production + cargo / max + free cargo? or am I understanding state.incargo wrong?

2- if(pct > 0.5f) shouldn't that be if(pct > tradeToPct ) to remove the hard coded 50% otherwise wouldn't changing tradeToPct in the main function act funny?

20
Help & Support / Planet Buster Pirates??????
« on: May 20, 2011, 11:45:20 AM »
No idea how this happened, I've made a few changes to the governor in a mod but nothing else so don't see how it could affect the pirates....

Started a new round and the first wave of pirates (I've only been playing long enough to colonize 5 planets) arrived..... Built some defense stations and figured I'd be ok.... Station got built then exploded.... Thinking I'm ok maybe screwed up the blueprint, checked looked fine another built and gone in a second.

Look at the pirate ships.... 4.07P HP.... The pirates have 1000x more HP then a star.... Couple seconds later guess they got sick of me building platforms so popped the planet in a single shot.....

Are there any console commands to see the game settings? or anything else that might be the cause?

Attached are the mod files I used too, "Begining to Envision the New" or Ben to be short.

21
Bug Reports / [1.0.7.4] BasicEffects.as does not load in mod?
« on: April 28, 2011, 10:39:42 AM »
Trying to mod a small change that overides:

void StandardTakeover(Planet@ plt, Empire@ owner, float makeStructures)

To take account colony type when building extra buildings supplied by the colonizer (No sense having a farm on a res world first off, or a new colony where a metal miner or extra space port would likely do more good at first)

The problem I ran into is that no matter the change I make the script does not take effect, when I replace the stock file with the included file it works perfectly fine, when I delete the stock file and try to just use the mod file the game goes wonky.  Unless I replace the stock file (in the gamedata/scripts/server folder, not the mod's folder) the changes do not take effect

22
Help & Support / Computers and Boarding
« on: April 24, 2011, 11:44:37 AM »
I'm not sure if this was discussed or not, I've found related topics but nothing addressing this issue itself, not sure if it's a bug or a feature either (so not sure if it belongs in the modding or bug report section)

What happened is after I got computers I started building a bunch of crewless ships, those quickly got taken over by boarding parties (which the AI loves to spam) after reading the forums found out that crewless does not mean unboardable so started adding internal defenses to the ships, to my surprise my ships were still taken over, increase the defenses and nothing if a invader ship got close my ship was taken over...

so I poked around in the data files and found a situation which I can't quite figure out (logically not code wise)
Code: [Select]
void BoardTick(Event@ evt, float troops) {
Empire@ owner = evt.obj.getOwner();
if(owner is null || owner.isValid() == false) {
evt.state = ESC_DISABLE;
return;
}

Object@ target = evt.target;
State@ crew = target.getState(strCrew);

Empire@ otherOwner = target.getOwner();
if(otherOwner is owner) {
target.repair(evt.time * troops * troopRepair);
return;
}

if(crew.val <= 0) {
takeOver(target, owner);
}
else {
// Troops are killed taking out boarding defenses
HulledObj@ targ = target;
float tickTroops = troops * evt.time;

if (targ !is null) {
uint sysCnt = targ.getSubSystemCount();

for (uint i = 0; i < sysCnt; ++i) {
SysRef@ ref = targ.getSubSystem(i);

if (ref.system.type.hasTag(strBoardingDefense)) {
tickTroops = targ.damageSystem(ref, evt.obj, tickTroops);

if (tickTroops <= 0.f)
return;
}
}
}

// Remaining troops kill crew
float strength = troops / crew.val;
strength = pow(strength, 1.2f);

crew.val -= troopDamage * strength * tickTroops;

if(crew.val <= 0) {
takeOver(target, owner);

if (shigatsu)
target.playSound("boardingparty_41");
}
}
}

According to that it explains why it was all happening, but not the logic behind it... If you have a computer and no crew
Code: [Select]
if(crew.val <= 0) {
takeOver(target, owner);
}
is always true so no matter the defenses you ship has it's taken over, a single light craft with a .25 boarding party with a strength of 5 can take over a scale 1000 ship with defenses of over 5.2k

I understand the balance issues of using a computer and why it can still be taken over by a boarding party (I agree that realistically in a computer controlled ship there would be no lifesupport or even access space to board into but for balance purposes it should be treated the same as a crew controlled ship) but I can't find the balance or logic in a computer controlled ship always losing a boarding fight no matter the defenses so after looking at the code it looks like the first crew check is redundant and removed it and was left with:

Code: [Select]
void BoardTick(Event@ evt, float troops) {
Empire@ owner = evt.obj.getOwner();
if(owner is null || owner.isValid() == false) {
evt.state = ESC_DISABLE;
return;
}

Object@ target = evt.target;
State@ crew = target.getState(strCrew);

Empire@ otherOwner = target.getOwner();
if(otherOwner is owner) {
target.repair(evt.time * troops * troopRepair);
return;
}


// Troops are killed taking out boarding defenses
HulledObj@ targ = target;
float tickTroops = troops * evt.time;

if (targ !is null) {
uint sysCnt = targ.getSubSystemCount();

for (uint i = 0; i < sysCnt; ++i) {
SysRef@ ref = targ.getSubSystem(i);

if (ref.system.type.hasTag(strBoardingDefense)) {
tickTroops = targ.damageSystem(ref, evt.obj, tickTroops);

if (tickTroops <= 0.f)
return;
}
}
}

// Remaining troops kill crew
float strength = troops / crew.val;
strength = pow(strength, 1.2f);

crew.val -= troopDamage * strength * tickTroops;

if(crew.val <= 0) {
takeOver(target, owner);

if (shigatsu)
target.playSound("boardingparty_41");
}
}

At least that way it seems the ship isn't being taken over immediately and only if enough boarding troops make it aboard. Does that make sense to anyone else?

Pages: [1]