Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 185 186 [187] 188 189 ... 710

Author Topic: Misc modding questions that are too minor to warrant their own thread  (Read 1727188 times)

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2790 on: April 13, 2016, 01:19:51 AM »

Why not? You need just put "1" in number of wings. (I have test, so this is functionnal)

« Last Edit: April 13, 2016, 01:23:03 AM by Snrasha »
Logged
I am pretty bad on english. So, sorry in advance.

Gladiator Society
Add battle options on Com Relay/ Framework for modders for add their own bounty.

Sanguinary Autonomist Defectors A fan-mod of Shadowyard.

SafariJohn

  • Admiral
  • *****
  • Posts: 3023
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2791 on: April 13, 2016, 04:54:46 AM »

Single fighter wings didn't work until recently, and I don't know if Alex did it on purpose. They may become unsupported again in future versions and there are probably bugs with them, so I would be very wary of doing anything with them.
Logged

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2792 on: April 13, 2016, 05:34:25 AM »

Ah ok, i learn a thing today, me. Thank.
Logged
I am pretty bad on english. So, sorry in advance.

Gladiator Society
Add battle options on Com Relay/ Framework for modders for add their own bounty.

Sanguinary Autonomist Defectors A fan-mod of Shadowyard.

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2793 on: April 13, 2016, 02:27:44 PM »

Quote
It's using spawnProjectile. The weapon passed in is the weapon that fired the original missile.
Tested this... and it generates infinite recursion of the original missile.  

I can't get to the sub-projectile at all this way; what you said doesn't make sense unless there's a way to spawnProjectile that allows us to call a specific projectile by name, which doesn't appear to be a thing; passing in a proj ID rather than a wpn ID results in a crash.  

What's wrong here?  Also note the isFromMissile() check, which fails when tested.
Code
			//Can we spawn missiles from this missile?  Do so now.
if(spawnCount > 0 && !missile.isFromMissile() && missile.getElapsed() > 0.5f){
if(MathUtils.getDistanceSquared(missile, target) <= (spawnDistance * spawnDistance)){
Global.getCombatEngine().applyDamage(missile, missile.getLocation(), 10000f, DamageType.HIGH_EXPLOSIVE, 0f, true, false, missile.getSource());
for(int i = 0; i < spawnCount; i++){
MissileAPI newProj = (MissileAPI) Global.getCombatEngine().spawnProjectile(
missile.getSource(),
missile.getWeapon(),
missile.getWeapon().getId(),
missile.getLocation(),
MathUtils.getRandomNumberInRange(0f, 360f),
missile.getVelocity());
newProj.setFromMissile(true);
}
return;
}
}
« Last Edit: April 13, 2016, 02:31:12 PM by xenoargh »
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24127
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2794 on: April 13, 2016, 02:55:31 PM »

Ahh, you're right - I wasn't taking the parameters of the exposed method into account. Hmm. About the only thing you could do to work around this right now would be to create fake "weapons" for the MIRV warheads.

Added another version of the spawnProjectile method, with an extra "projSpecId" parameter.
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2795 on: April 13, 2016, 03:08:21 PM »

Right on, figured it was something like that :)

I'll just leave those alone for now (because otherwise, not really universally compatible w/out kludges) but I have finished building the basic support for them later.
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Histidine

  • Admiral
  • *****
  • Posts: 4688
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2796 on: April 15, 2016, 11:21:15 PM »

@Alex: My problem is that the economy appears to be demanding/consuming many more marines than the other commodities with the same demand type (so there are often almost as many or more agents and saboteurs than marines in stores, even though there should only be 1 agent and 1 saboteur for every 125 marines based on production values). Is there a reason this would occur?

(I tried setting agent/saboteur utility to 1 from 3, but testing didn't reveal any effect at least on Jangala; there were reliably about 220 marines and one-tenth that many agents and saboteurs each in both cases)

Another question: Is there a mod plugin method or such that gets called just before/when the game reaches the main menu? I need to call Global.getSector().getAllFactions(), but it crashes if I do this in onApplicationLoad().
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24127
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2797 on: April 16, 2016, 08:11:32 AM »

@Alex: My problem is that the economy appears to be demanding/consuming many more marines than the other commodities with the same demand type (so there are often almost as many or more agents and saboteurs than marines in stores, even though there should only be 1 agent and 1 saboteur for every 125 marines based on production values). Is there a reason this would occur?

(I tried setting agent/saboteur utility to 1 from 3, but testing didn't reveal any effect at least on Jangala; there were reliably about 220 marines and one-tenth that many agents and saboteurs each in both cases)

That's because generally, most of the demand for personnel is non-consuming, so the supply needs to only exceed the consuming demand in order for all demand to be eventually filled.

For example: there's demand for 1000 crew, 10 of which is consuming. If there's a supply of 110 crew, it'll be up to 1000 crew in 10 months.

How this works is going to change, though, so may not be something worth worrying *too* much about long-term. If a quick hack would do the job, I'd go for that instead.

Another question: Is there a mod plugin method or such that gets called just before/when the game reaches the main menu? I need to call Global.getSector().getAllFactions(), but it crashes if I do this in onApplicationLoad().

Global.getSector() isn't going to work outside the campaign, since it returns the campaign engine. (I can't check to see if there are any alternatives to getAllFactions() elsewhere, not in front of the dev computer at the moment...)
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4688
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2798 on: April 24, 2016, 08:11:23 AM »

Is there a way to be notified when a battle between two NPC fleets ends (i.e. one side has been destroyed or is running)? reportBattleFinished() with a check for battle.isDone() seemed like the obvious way, but it seems to always return false...
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24127
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2799 on: April 24, 2016, 09:52:30 AM »

Hmm - looking at it, jeez, that's a mess.

isDone() works right and only returns true when the battle is over, but the reportBattledFinished() doesn't get called when it should there.

Both reportBattleOccurred() and reportBattleFinished() get called twice per autoresolve round - actually scratch that. reportBattleOccurred gets called 3 times (because of a bug), while reportBattleFinished gets called once.

So, technically, the right way to do this is indeed in reportBattleFinished() and then checking isDone(), and then getting snapshots to see who participated in the battle (because by the time it's done, the battle is cleaned up aside from that). But due to bugs, you'll want to check isDone() in reportBattleOccurred, since that's what gets called instead of reportBattleFinished() when it's finished. Fairly sure that should do the job.

(Fixed on my end, but going to keep an eye on it in case this causes something to break. Also only made it call reportBattleOccured() once per auto-round, with a further reportBattleFinished when it's done.)
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4688
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2800 on: April 29, 2016, 06:11:21 AM »

That worked, thanks Alex!

Now: are there any factors other than fleet size that control fleet strategic flight/fight behaviour?

Spoiler
[close]

Both fleets were created with 12 points (10 combat, 2 utility), and the independent fleet has qualityFactor 0.8 to the pirates' 0.35. Indies have two fighter wings with no carrier, but their other hulls are definitely higher-tier. But the independent fleet is fleeing. This seems odd.
« Last Edit: April 29, 2016, 06:14:08 AM by Histidine »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24127
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2801 on: April 29, 2016, 09:52:23 AM »

1) If CR is low, that affects apparent strength. Can't tell whether this is the case for one of the fleets from the screenshot.
2) The evaluation is cached for a few seconds, so if the fleets recently saw each other but changed composition since, that could affect it.
3) Officers can up to double the strength of a ship they command.
4) If the fleet commander is timid or cautious, and the fleet isn't significantly stronger (+25% or more) than the enemy, they'll run.

Probably #4 going on here.


Nearby fleets also factor in, btw - if there's enough friends or enemies nearby, that'll override the above, basically.
Logged

MShadowy

  • Admiral
  • *****
  • Posts: 911
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2802 on: May 01, 2016, 05:58:00 PM »

Well, kind of a strange question perhaps, but it seems a bit necessary to figure out right now; Alex what's the calculation you're using to figure out collision damage?

Currently I'm using this for the Mimir's Lock Drive AI because I like it playing fast and loose with the crashin':

Code
     float areaChange = 1f;
     float aMass = ship.getMass();
     float bMass = tmp.getMass();
     
     if (CollisionUtils.getCollides(ship.getLocation(), shipDir, bash, tmp.getCollisionRadius() * 0.5f + ship.getCollisionRadius() *
                                 0.75f * areaChange)) {
         if (tmp.getOwner() == ship.getOwner()) {
                 bashNum = mag.get(tmp.getHullSize()) * ((bMass / aMass * 900f) * 2f); //The ship values friendly ships more, so the crash value is doubled
         } else {
                 bashNum = mag.get(tmp.getHullSize()) * ((bMass / aMass * 900f) * 0.75f);
         }
     }

However, this has resulted in a propensity for banging into things, which has caused a lot people to get annoyed with the AI. A more accurate collision damage model seems like it's probably a good idea, all things considered.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24127
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2803 on: May 01, 2016, 07:11:41 PM »

It's... complicated. Just throw in something low that's based on the total mass of the two ships, and you can't go too far wrong. As long as the numbers are sort of in line with vanilla, I don't think it's going to be noticeable.
Logged

Gorgonson

  • Lieutenant
  • **
  • Posts: 50
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2804 on: May 16, 2016, 05:18:09 AM »

I have a question about Spread Decay interacting with Minimum / Maximum Spread.
Smartypants had the idea for a weapon that became more accurate the longer it was fired.

I wasn't sure how to set default accuracy of the weapon to a very low amount - so I figured I'd set Spread Decay to a negative value.  It worked, though the only problem was that the accuracy continually degrades, ignoring the bounds set by Maximum Spread.  Another issue arose when I set the Spread Per Shot to a negative amount.  This did successfully cause each shot to narrow the accuracy of the weapon, but this seemed to begin from an arbitrary number that I can't find.

I'll explain:  The simulation begins with perfect accuracy.  Each second, the cone widens by a few degrees.  Eventually the cone expands to a semicircle, then to a complete circle, totally ignoring the supposed bounds of the spread.  When I fire, the cone immediately snaps to around 10 degrees, then rapidly shrinks as the negative Spread Per Shot is applied from the weapon.

What can I do to fix the accuracy cone within the bounds of Maximum Spread, and why does the accuracy cone suddenly snap to around ten degrees, as opposed to slowly tightening from it's current position?

I really appreciate any advice or feedback you can provide.
Logged
Pages: 1 ... 185 186 [187] 188 189 ... 710