Hi guys,
Endercore provided me with a modified version of his wing teleporting system. The system in the original would check if a wing was damaged and teleport it back to the carrier where the system was installed.
The new modified one does simply teleport all deployed ships nearby the ship the system is installed. The big question is how could the system itself made more fancier, visual more pleasing as it it lacking this right now.
endercore's code:
Spoiler
package data.shipsystems.scripts;
import java.util.List;
import com.fs.starfarer.api.combat.MutableShipStatsAPI;
import com.fs.starfarer.api.plugins.ShipSystemStatsScript;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.CombatEntityAPI;
import data.scripts.plugins.CombatUtils;
import org.lwjgl.util.vector.Vector2f;
import java.util.Random;
/**
*
* @author Ender
*/
public class Fleet_Teleporter implements ShipSystemStatsScript {
private ShipAPI shipsapi;
private ShipAPI final_shipsapi;
private CombatEntityAPI combatEntity;
private CombatEntityAPI currentShip;
private CombatEngineAPI engine;
private MutableShipStatsAPI eachShip;
private boolean hasRun = false;
public void apply(MutableShipStatsAPI stats, String id, State state, float effectLevel) {
CombatUtils combatEngine = new CombatUtils();
engine = combatEngine.getCombatEngine();
if (engine != null && !hasRun) {
if (engine.getShips() != null) {
Random randomNum = new Random();
List ships = engine.getShips(); //get a list of all active ships
List shipList = null;
currentShip = stats.getEntity(); //we need our current ship so that we know who owns it
Vector2f location = currentShip.getLocation();
for (int i = 0; i < ships.size(); i++) { //now we loop through the entire list of ships
shipsapi = (ShipAPI) (ships.get(i)); //assign the current ship to the ShipAPI so we can give it bonuses or penalties
eachShip = shipsapi.getMutableStats(); //now we need something Mutable
combatEntity = eachShip.getEntity(); //we need to assign it as an entity as well so we can see who owns it
//in here, we're checking to find friendly ships
if ((combatEntity.getOwner() == currentShip.getOwner()) && (eachShip != null) && (combatEntity != stats.getEntity())) {
float randomX = (randomNum.nextInt(5) - 2) * 400;
float randomY = (randomNum.nextInt(5) - 2) * 400;
shipsapi.getLocation().x = (location.x + randomX);
shipsapi.getLocation().y = (location.y + randomY);
}
}
hasRun = true;
}
}
}
public void unapply(MutableShipStatsAPI stats, String id) {
//there's nothing to unapply here, so we can leave this block of code empty
hasRun = false;
}
public StatusData getStatusData(int index, State state, float effectLevel) {
if (index == 0) {
return new StatusData("Teleporting fleet to near", false); //display status message to the player
}
return null;
}
}
The ship i had in mind would be this one:
Kind of a "deep diver" or long range Phase ship which could sneak behind enemy lines unharmed, teleport the deployed fleet and make its tactical retreat.
The electric thingy and the shape of the ship reminded me of some kind of portal and i guess some emp arcs spawning around or over the ship would be quite suitable.
Or would it be possible to have a decorative weapons take the part of an animation?
Maybe someone has a clue if one or all or none of the above would be possible to code?