Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 200 201 [202] 203 204 ... 710

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3015 on: January 06, 2017, 10:13:42 PM »

The faction files have a section that refers to lists of ship names, am I correct in assuming that section refers to the weight with which those ship name lists are chosen? If so, does it account for the size of the lists? That is to say, if I was to say double the size of the GENERAL list, for example, and still want each name in that list to appear about as frequently as names from other lists, would I have to double its weight in every single faction file?

Yeah, they're weights. No, it doesn't consider the size of the lists. In your scenario, yeah, you'd need to double the weight everywhere.


From the scope of EveryFrameCombatPlugin.advance() is it possible to tell if a projectile has a specific onHitEffect or that a projectile some sort of tag from the JSON you can inspect/look for?

Hmm. projectile.getWeapon().getId() and hardcode off that? In the next release, weapon specs have tags so you'd be able to getWeapon().getSpec().getTags(), which returns a Set<String>.


Looks like this is still the case, has anyone found a work-around?

Not that I'm aware of, but then I haven't exactly been looking. Sorry for the not-helpful answer :)
Logged

djcian

  • Ensign
  • *
  • Posts: 9
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3016 on: January 13, 2017, 12:02:19 PM »

How would I go about making it so that every ship that is disabled in a battle is not destroyed and can be repaired?  I've tried editing the field repairs reconstruction perk in SkillData.java (FIELD_REPAIRS_DISABLED_REPAIR_PERCENTAGE = 100f) so that there is a 100% chance to repair disabled friendly ships after battle but it seems to only repair one ship per battle.
Logged

King Alfonzo

  • Admiral
  • *****
  • Posts: 683
  • -- D O C T O R --
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3017 on: January 21, 2017, 10:46:42 PM »

Hey all.

I'm currently working on an optional hull mod for a specific ship that increases the burn speed of all the fighters in the fleet by 2 at the cost of drastically increased refit time and just about all the OPs. I've tried looking through the Tow Cable hullmod, but because of complicated mathematical coding that ensures that only the slowest ship gets a buff, and only one ship gets a buff per ship that has the hullmod, I can't pin point the exact line that gives the buff. I've tried quite simply:

Code
        public void apply(FleetMemberAPI member) {
if member.isFighter())
            member.getStats().getMaxBurnLevel().modifyFlat(id, 2);
        }

But that doesn't work, and I've tried copy and pasting the tow cable hullmod and changing the suitability thus:

Code
    private boolean isSuitable(FleetMemberAPI member) {
        if (member.isFighterWing()) return true;
        return false;
    }

But that, too, doesn't work. Can anyone help me out and tell me what line I should be looking at please?

Nick XR

  • Admiral
  • *****
  • Posts: 713
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3018 on: January 22, 2017, 11:12:34 PM »

Given a ShipAPI and a CombatEngineAPI any one have a clue how to get a ships deployment value?  I've tried this horrible code below but it only works sometimes :(

Code: java
List<FleetMemberAPI> allMembers = new ArrayList<>();
allMembers.addAll(engine.getFleetManager(ship.getOwner()).getDeployedCopy());
allMembers.addAll(engine.getFleetManager(ship.getOwner()).getDestroyedCopy());
allMembers.addAll(engine.getFleetManager(ship.getOwner()).getDisabledCopy());
allMembers.addAll(engine.getFleetManager(ship.getOwner()).getReservesCopy());
allMembers.addAll(engine.getFleetManager(ship.getOwner()).getRetreatedCopy());

FleetMemberAPI fm = null; // my kingdom for a lambda
for (FleetMemberAPI fma : allMembers){
    if(fma.getId().equals(ship.getFleetMemberId())){
        fm = fma;
        break;
    }
}

if(fm != null){
    fleetPoints = fm.getFleetPointCost();
}

Edit
Nevermind, the above code might not be pretty but it works fine. PEBKC
« Last Edit: January 22, 2017, 11:27:53 PM by Nick XR »
Logged

gruberscomplete

  • Captain
  • ****
  • Posts: 253
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3019 on: January 26, 2017, 02:24:39 PM »

I am trying to remove copies of ships from markets. However, the ship copies don't get removed from markets, and I don't know what the issue is.



Code
	protected void pruneShips() { // doesn't work
CargoAPI cargo = getCargo();
FleetDataAPI data = cargo.getMothballedShips();

int numSameHulls = 0;
String hullName = "";
String newHullName = "";

for (FleetMemberAPI member : data.getMembersListCopy()) {

// do a ticker, count to 10, then delete all ship copies after that
// assume same hulls one after another

newHullName = member.getHullId();

// if the same hull as the one before it in the market
if (newHullName == hullName) {

numSameHulls++;

if (numSameHulls >= 10) { // delete the copies
data.removeFleetMember(member);
}
}
else { // different hull
numSameHulls = 0;
hullName = newHullName;
}
}
}
Logged
Click here for FREE ships!               Plentysector               Robots With Souls

Nick XR

  • Admiral
  • *****
  • Posts: 713
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3020 on: January 26, 2017, 02:56:35 PM »

I am trying to remove copies of ships from markets. However, the ship copies don't get removed from markets, and I don't know what the issue is.



Code
	protected void pruneShips() { // doesn't work
CargoAPI cargo = getCargo();
FleetDataAPI data = cargo.getMothballedShips();

int numSameHulls = 0;
String hullName = "";
String newHullName = "";

for (FleetMemberAPI member : data.getMembersListCopy()) {

// do a ticker, count to 10, then delete all ship copies after that
// assume same hulls one after another

newHullName = member.getHullId();

// if the same hull as the one before it in the market
if (newHullName == hullName) {

numSameHulls++;

if (numSameHulls >= 10) { // delete the copies
data.removeFleetMember(member);
}
}
else { // different hull
numSameHulls = 0;
hullName = newHullName;
}
}
}

Is  data.getMembersListCopy()  guarenteed to be ordered by HullId (have you verified that removeFleetMember is being called)?  Also the pointer equality test for the strings is probably not what you want, they might be interned and it's OK, but it's not guaranteed from the interface and a proper .equals() call should firstly test for pointer equality.
« Last Edit: January 26, 2017, 09:15:38 PM by Nick XR »
Logged

gruberscomplete

  • Captain
  • ****
  • Posts: 253
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3021 on: January 26, 2017, 03:31:22 PM »

nvm I figured out another way to get it to work
« Last Edit: January 26, 2017, 04:32:09 PM by gruberscomplete »
Logged
Click here for FREE ships!               Plentysector               Robots With Souls

Nick XR

  • Admiral
  • *****
  • Posts: 713
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3022 on: January 28, 2017, 10:54:55 AM »

I'm trying to get a ship in my fleet to fire different weapons from their weapon groups, I'm using the method:

Code: java
        ShipAPI.giveCommand(ShipCommand.FIRE, someVectorFarInFrontOfShip, weaponGroupIndex);

But no matter what the value of weaponGroupIndex, group 0 always fires.  (I've even tried the deprecated USE_SELECTED_GROUP with no luck).

Am I doing something wrong here?

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3023 on: January 28, 2017, 11:08:15 PM »

The weaponGroupIndex parameter only applies to the command to select a weapon group. The FIRE command always fires the currently selected group.
Logged

Tartiflette

  • Admiral
  • *****
  • Posts: 3529
  • MagicLab discord: https://discord.gg/EVQZaD3naU
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3024 on: January 29, 2017, 01:03:46 AM »

Btw, could we get a way to prevent (or force) specific weapons from firing? I have a system that is supposed to prevent just the large slots from firing, but despite my best efforts using remaining cooldowns, ammo and such shenanigans, continuous beams can still fire.

Pleeeeease???  :)
Logged
 

Nick XR

  • Admiral
  • *****
  • Posts: 713
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3025 on: January 29, 2017, 10:37:59 AM »

The weaponGroupIndex parameter only applies to the command to select a weapon group. The FIRE command always fires the currently selected group.

Ah got it now.  I think I tried it earlier but messed something else up.  Here's the code in case others are interested:

Code: java
// tell it which weapon group to fire  
ShipAPI.giveCommand(ShipCommand.SELECT_GROUP, null, weaponGroupIndex);

// fire the selected weapon group
ShipAPI.giveCommand(ShipCommand.FIRE, someVectorFarInFrontOfShip, weaponGroupIndex);

Tartiflette

  • Admiral
  • *****
  • Posts: 3529
  • MagicLab discord: https://discord.gg/EVQZaD3naU
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3026 on: January 31, 2017, 01:58:57 AM »

Btw, could we get a way to prevent (or force) specific weapons from firing? I have a system that is supposed to prevent just the large slots from firing, but despite my best efforts using remaining cooldowns, ammo and such shenanigans, continuous beams can still fire.

Pleeeeease???  :)
Actually, just a weapon.disable(boolean permanent, boolean RepairParticles) would be enough, having giant blue sparkles is the issue with the current disable command.
Logged
 

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3027 on: January 31, 2017, 11:04:30 AM »

Probably not the right thread for it, but let me add it to the (long) list.

(Hmm - one could re-imagine the system as actually disabling the weapons. That seems kind of cool!)
Logged

Tartiflette

  • Admiral
  • *****
  • Posts: 3529
  • MagicLab discord: https://discord.gg/EVQZaD3naU
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3028 on: January 31, 2017, 07:05:10 PM »

To add some context, the system I'm talking about is the Nemean Lion's system, that closes the armor to shroud the front weapons from damage, but also prevent them from firing. I'd like to keep the other weapons firing, but for now it's not perfect.

Logged
 

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3029 on: January 31, 2017, 07:40:27 PM »

Ah, got it. Added to WeaponGroupAPI:

WeaponAPI removeWeapon(int index);
void addWeaponAPI(WeaponAPI weapon);

That seems like that should do it, right? Assuming you'd remove the weapons from the group and add them back in depending on the state of the system.

... could get weird if a weapon was firing at the time of removal, though. Hmm.

Made a note to take a closer look later.
Logged
Pages: 1 ... 200 201 [202] 203 204 ... 710