Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 408 409 [410] 411 412 ... 710

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24123
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6135 on: March 05, 2020, 09:12:03 AM »

What happens is mod-load-order dependent (which is in turn alphabetical based on mod name); I always forget if the first or last mod gets priority. I *think* you can "replace" a file provided by a mod, but I could be mistaken.
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6136 on: March 05, 2020, 12:48:50 PM »

I *think* you can "replace" a file provided by a mod, but I could be mistaken.

To confirm: You can't- at least with JSON files. I'm not sure about CSV or custom game files though.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24123
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6137 on: March 05, 2020, 12:50:15 PM »

Ah, ok - thank you for chiming in.
Logged

shoi

  • Admiral
  • *****
  • Posts: 658
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6138 on: March 05, 2020, 05:32:45 PM »

Is there any way to apply/ mimic the phase effect a phase ship has on the body to a decorative turret?
Basically, that glow of the phase coils when activated and then the visual "cooldown" effect where it gets all jittery while fading out.
the "phase coil" for the ship im using is on a deco turret  which moves, so I can't do it the normal way since in certain conditions the glow would be floating in the void. Hope this makes sense.

I thought this effect would be in the phasecloak script, but it seems to be triggered from the ship system file when you use    
#"phaseHighlight":"_glow1",
   #"phaseDiffuse":"_glow2",
« Last Edit: March 05, 2020, 05:34:21 PM by shoi »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24123
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6139 on: March 05, 2020, 08:06:08 PM »

If it's a decorative turret - does the glow of the body render above it? If so then the glow could include whatever stuff it needed to for the turret. Not sure of the render order offhand, though.
Logged

Kirin

  • Ensign
  • *
  • Posts: 3
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6140 on: March 08, 2020, 07:22:42 AM »

is there a way to add anything to the ai core files? like add additional types or just change the ones in the game to be equal but very different, example of alpha cores being able to do management balance better than the others but gamma cores boost production far more but have increased need of resources?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24123
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6141 on: March 08, 2020, 09:36:54 AM »

It's not impossible, but it's pretty complicated and may or may not be doable in a way that plays nice with other mods. You'd have to replace the BaseIndustry class, which means you'd also need to replace all the core industry classes that derive from it, but then industries added by other mods would not be affected, so... I guess for most mods it's "no", but a total conversion would have more freedom with these sorts of thing and could more reasonably do it.
Logged

Kirin

  • Ensign
  • *
  • Posts: 3
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6142 on: March 09, 2020, 02:39:41 AM »

damn, well is there a way to add flags then?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24123
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6143 on: March 09, 2020, 09:07:09 AM »

Hmm, I'm not sure what you mean.
Logged

tomatopaste

  • Captain
  • ****
  • Posts: 306
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6144 on: March 09, 2020, 04:36:09 PM »

Trying to implement a custom drone AI with
Quote
@Override
    public PluginPick<ShipAIPlugin> pickDroneAI(ShipAPI drone, ShipAPI mothership, DroneLauncherShipSystemAPI system) {
        if (DEUCES_DRONE_CORONA_ID.contentEquals(drone.getHullSpec().getBaseHullId())) {
            return new PluginPick<ShipAIPlugin>(new SPE_droneCoronaDroneAI(), CampaignPlugin.PickPriority.MOD_SET);
        }
        return null;
    }

Where the AI script is completely empty
Quote
package data.scripts.ai;

import com.fs.starfarer.api.combat.*;
import org.lazywizard.lazylib.MathUtils;
import org.lazywizard.lazylib.VectorUtils;
import org.lazywizard.lazylib.combat.AIUtils;
import org.lwjgl.util.vector.Vector2f;

import java.util.List;

public class SPE_droneCoronaDroneAI implements ShipAIPlugin {

    //not relevant
    @Override
    public void setDoNotFireDelay(float amount) {
    }

    //called when AI activated on player ship
    @Override
    public void forceCircumstanceEvaluation() {
    }

    @Override
    public void advance(float amount) {
    }

    @Override
    public boolean needsRefit() {
        return false;
    }

    //not relevant
    @Override
    public ShipwideAIFlags getAIFlags() {
        return null;
    }

    //not relevant
    @Override
    public void cancelCurrentManeuver() {
    }

    //not relevant
    @Override
    public ShipAIConfig getConfig() {
        return null;
    }
}

For some reason, this always causes a nullpointer crash
31829 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
   at com.fs.starfarer.combat.systems.N.Ò00000(Unknown Source)
   at com.fs.starfarer.combat.systems.N.advanceImpl(Unknown Source)
   at com.fs.starfarer.combat.systems.F.advance(Unknown Source)
   at com.fs.starfarer.combat.entities.Ship.advance(Unknown Source)
   at com.fs.starfarer.combat.CombatEngine.advanceInner(Unknown Source)
   at com.fs.starfarer.combat.CombatEngine.advance(Unknown Source)
   at com.fs.starfarer.combat.CombatState.traverse(Unknown Source)
   at com.fs.state.AppDriver.begin(Unknown Source)
   at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)


What's wrong here?
« Last Edit: March 09, 2020, 04:39:22 PM by tomatopaste »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24123
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6145 on: March 09, 2020, 04:48:17 PM »

Probably because your getAIFlags() and getConfig() methods are returning null; other stuff using this probably assumes that's not allowed.
Logged

Kirin

  • Ensign
  • *
  • Posts: 3
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6146 on: March 10, 2020, 02:14:10 AM »

by add flags I mean add more flags from the selectable ones when you start a colony, like how I can add new commander images.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4688
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6147 on: March 10, 2020, 04:26:26 AM »

by add flags I mean add more flags from the selectable ones when you start a colony, like how I can add new commander images.
There are a number of flag packs on the forum that you can inspect, e.g. Player Faction Flag Pack and Historical Flags
Logged

Stormy Fairweather

  • Commander
  • ***
  • Posts: 233
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6148 on: March 10, 2020, 01:50:40 PM »

there an easy way to have your portrait appear next to your flagship the way other officers do?
Logged

tomatopaste

  • Captain
  • ****
  • Posts: 306
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6149 on: March 10, 2020, 04:06:43 PM »

Thanks for the help earlier, I'm currently fine-tuning the drone movement, and I was wondering how the param of Ship.giveCommand(..., param, ...) works. I've only been setting the param as null, but the API mentions param - Generally a Vector2f with a "mouse" location. See ShipCommand.java for details., but as far as I can see ShipCommand.java doesn't have any comment on a mouse location. Does this mean that I can choose to make the e.g. accelerate command act in a certain direction instead of cardinally? The code below shows what I have. This is quite innacurate as the drones only move diagonally or straight, which causes them to overshoot, correct, then fly around amusingly. Thanks!
Spoiler
Code
//MOVE TO TARGET LOCATION
        float angleFromDroneToTargetLocation = VectorUtils.getAngleStrict(drone.getLocation(), movementTargetLocationOnShip);
        float angleRelativeToDrone = MathUtils.getShortestRotation(drone.getFacing(), angleFromDroneToTargetLocation);
        float distanceToTargetLocation = MathUtils.getDistance(drone.getLocation(), movementTargetLocationOnShip);

        //do large movement if over distance threshold
        if (distanceToTargetLocation >= roamRange) {
            //accelerate forwards or backwards
            if (90f > angleRelativeToDrone && angleRelativeToDrone > -90f) { //between 90 and -90 is an acute angle therefore in front
                drone.giveCommand(ShipCommand.ACCELERATE, null, 0);
                drone.giveCommand(ShipCommand.ACCELERATE, null, 0);
                drone.giveCommand(ShipCommand.ACCELERATE, null, 0);
            } else { //falls between 90 to 180 or -90 to -180, which should be obtuse and thus relatively behind
                drone.giveCommand(ShipCommand.ACCELERATE_BACKWARDS, null, 0);
            }

            //strafe left or right
            if (180f > angleRelativeToDrone && angleRelativeToDrone > 0f) { //between 0 and 180 (i.e. left)
                drone.giveCommand(ShipCommand.STRAFE_LEFT, null, 0);
            } else { //between 0 and -180 (i.e. right)
                drone.giveCommand(ShipCommand.STRAFE_RIGHT, null, 0);
            }
        } else {
            snapTo(ship, 0.1f, drone, movementTargetLocationOnShip);
        }

        //some fine tuning and deceleration
        if (distanceToTargetLocation <= roamRange * 2f) {
            drone.giveCommand(ShipCommand.DECELERATE, null, 0);

            if (tracker.intervalElapsed()) {
                //decelerate if close to target location or attempt to reverse thrust
                if (distanceToTargetLocation <= roamRange) {
                    drone.giveCommand(ShipCommand.DECELERATE, null, 0);
                    if (drone.getEngineController().isStrafingRight()) {
                        drone.giveCommand(ShipCommand.STRAFE_LEFT, null, 0);
                    }
                    if (drone.getEngineController().isStrafingLeft()) {
                        drone.giveCommand(ShipCommand.STRAFE_RIGHT, null, 0);
                    }
                    if (drone.getEngineController().isAccelerating()) {
                        drone.giveCommand(ShipCommand.ACCELERATE_BACKWARDS, null, 0);
                    }
                    if (drone.getEngineController().isAcceleratingBackwards()) {
                        drone.giveCommand(ShipCommand.ACCELERATE, null, 0);
                    }
                }
            }
        }
[close]
« Last Edit: March 10, 2020, 04:17:15 PM by tomatopaste »
Logged
Pages: 1 ... 408 409 [410] 411 412 ... 710