I'm working on a hullmod that launches a drone from a carrier when a ship that has it gets close, and I just want to decrease the carriers replacement rate as the drone is repairing the ship..if you could help , i'd appreciate it
I think a way you could do this would be to set up a timer under:
@Override
public void advanceInCombat(ShipAPI ship, float amount) {
}
Then to periodically reduce replacement rate you would use something like:
*(outside timer)*
float reduction = 0f;
MutableShipStatsAPI stats = ship.getMutableStats();
*(outside timer)*
*(drone repairing returns true)*
*(inside timer)*
reduction = 10f;
stats.getFighterRefitTimeMult().modifyPercent(id, 100 - reduction);
*(increment timer)*
*(drone repairing returns true)*
reduction = 20f;
stats.getFighterRefitTimeMult().modifyPercent(id, 100 - reduction);
*(increment timer)*
etc, until:
*(drone repairing returns false)*
*(reset replacement rate)*
*(reset timer)*
reduction = 0f;
*(inside timer)*
Hopefully that make sense I'm not sure how well I explained it. Then you can use increments that fit the behavior you would like to see. For instance here I go by 10% with an implied timer of ~5 seconds to create roughly a 2% decay per second.
If you just want a flat decrease while repairing you wouldn't even really need the timer. That would more be like:
while (drone repairing) {
float reduction = 50f;
ship.getMutableStats().getFighterRefitTimeMult().modifyPercent(id, reduction);
}
You might have to play around with the various modifiers to getFighterRefitTimeMult() to see what works the best. For instance to
increase the replacement rate I use:
getFighterRefitTimeMult().modifyMult(id, 1f - REFIT_TIME_PERCENT / 100f);
Hope that helps!
![Smiley :)](https://fractalsoftworks.com/forum/Smileys/default/smiley.gif)