Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.96a is out! (05/05/23); Blog post: Colony Crises (11/24/23)

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.

Messages - tomatopaste

Pages: 1 ... 16 17 [18] 19 20
256
Per drone, yeah.

Thanks - that works quite well :)

Another question though: how do I get the instance of the statsScript associated with a ship's system?

257
One other thing you want to do that's subtle in its effects:

drone.getAIFlags().setFlag(AIFlags.DRONE_MOTHERSHIP, 20000f, mothership);

If this isn't done, things will work, but enemy AI will be more distracted by the drones than it should be.

Do you mean
Code
ship.getAIFlags().setFlag(ShipwideAIFlags.AIFlags.DRONE_MOTHERSHIP, 20000.0f, (java.lang.Object)this.ship);
or per drone?

258
How do I associate the drone the shipsystems spawns with the mothership, so that when getDroneSource() is called on the drone, it returns the ShipAPI instance of the mothership? basic java, heh

259
If you're implementing your own, then there would be no DroneLauncherShipSystemAPI and no states - whatever you code up has to handle states etc. You would, I think, set the AI to what you need when manually spawning the drone.

I see - oh well, thanks for the help :)

260
I'd suggest using type:"STAT_MOD" since that doesn't do anything and lets your script have full control. The script can be specified via "statsScript".

Thanks for the reply - although I have yet more questions. In my modplugin, I assign the drones their AI with pickDroneAI, which passes DroneLauncherShipSystemAPI. If the ship system is of the STAT_MOD type, won't this break it? Is there a workaround, like using pickShipAI instead? This is important since the drone AI relies on being able to get the current state of the system's orders enum (RECALL, DEPLOY and ATTACK) from the passed DroneLauncherShipSystemAPI.

261
How do I link to a custom shipsystem script in the .system file? My one extends BaseShipSystemScript, and implements DroneLauncherShipSystemAPI, and as far I can tell there is no CUSTOM value for the 'type' key. Thanks!

262
Hmm - I don't think so, no - sorry! I mean, you might try to write a custom version of the drone launcher system from the ground up - basically launching drones/maintaining its own state as needed - but the existing drone launcher system isn't that flexible.
Yikes - well, I might as well go all out. Can I have some info on how the existing system launches drones onto the map? Is it as simple as spawning in the combat entity with a reversed velocity? Do I need to extend BaseShipSystemScript? How does it interface with the systems csv and/or json configuration?

EDIT: Nevermind, I found the obfuscated source so I'll use that as a guideline to implementing my ideas

263
Modding / Re: [0.9.1a] Mobile Star Fortress v0.2.1 - Let them Fight!
« on: March 13, 2020, 04:34:29 AM »
why

264

Can I override this message by getting the status key somehow? Would like to change this text since it is misleading with how I've changed the functionality of this system. Thanks :)

265
Here is my update, . This is working with ~80ish lines of code without any direct manipulation of velocity or location, only shipcommands, showing it is possible  ;D

266
For a drone, I'd suggest directly manipulating the velocity and or/location. You're going to have a tough time getting nice-looking movement otherwise.

Some of what I got up to, it was even worse with terminator-level speed  ;D. Thanks for the help, I'll start looking into that stuff.

267

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!

"param" is for commands that need a mouse location, such as firing a weapon (missiles uses this for target-picking), using a ship system, or raising shields.

That's a bummer. Is there another way that I could increase the accuracy of the ship acceleration then? Does the source (which I am more or less trying to imitate in behaviour) liberally use intervalutil?

268
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]

269
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?

270
Mods / Re: [0.9.1a] Boggled's Terraforming Mod (v4.0.1)
« on: March 09, 2020, 03:09:39 PM »
It's okay, I'm not Anglo myself, so I'm well-equipped to interpret your writing.

That aside... I was just hit with a realization that should've come to me the moment I considered this issue.
Wouldn't the immense depths of a typical water world just crush anything at the bottom into a solid, immovable orb? Could tectonic activity even happen when the lithosphere is being subjected to obscene amounts of pressure from every direction?
I'm not an expert, but that seems unlikely. Even our own little Mariana Trench(11km) is terrifying with how easily it can crush things, so imagine what a world of only water that's 100s of miles deep can do. Even if there were some plate tectonics, I feel like the pressure would be strong enough to keep their effects localized and they would never reach the surface.

What do you think?

This is getting a little off topic, but high water pressure has negligible effect on dampening waves. Instead, it makes it easier to transmit energy.

Pages: 1 ... 16 17 [18] 19 20