Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Pages: 1 ... 35 36 [37] 38 39 ... 706

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

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #540 on: May 26, 2013, 02:19:35 PM »

Right, a missile with a 0 top speed ought to do it.

It still seems to inherit the speed of the launching ship. I have it sat as a phase_charge missile type because I need to have an AoE effect, I'm not sure if there's a missile type or something like that that doesn't inherit velocity and still enables the proximity fuse effect.

As Alex said, you could have an EveryFrameCombatPlugin to strip the inertia. Here's some example code that would allow this (not tested!):
Code
package data.scripts.plugins;

import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.CombatEntityAPI;
import com.fs.starfarer.api.combat.DamagingProjectileAPI;
import com.fs.starfarer.api.combat.EveryFrameCombatPlugin;
import com.fs.starfarer.api.input.InputEventAPI;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.lwjgl.util.vector.Vector2f;

public class RemoveShipInertia implements EveryFrameCombatPlugin
{
    // This is the ID of the projectile you want to remove imparted inertia from
    private static final String PROJECTILE_ID = "insert projectile ID here";
    // Contains the projectiles that have had their inertia stripped
    private Set done = new HashSet();
    // The engine instance for this battle, used to get all projectiles
    private CombatEngineAPI engine;

    @Override
    public void advance(float amount, List<InputEventAPI> events)
    {
        if (engine.isPaused())
        {
            return;
        }

        // Scan all projectiles on the map each frame
        DamagingProjectileAPI tmp;
        for (Iterator iter = engine.getProjectiles().iterator(); iter.hasNext();)
        {
            tmp = (DamagingProjectileAPI) iter.next();
            // Check if this projectile is the proper type and
            // hasn't had its imparted velocity removed yet
            if (PROJECTILE_ID.equals(tmp.getProjectileSpecId())
                    && tmp.getSource() != null && !done.contains(tmp))
            {
                // Subtract the veloctiy imparted by the firing ship
                Vector2f.sub(tmp.getVelocity(), tmp.getSource().getVelocity(),
                        tmp.getVelocity());
                done.add(tmp);
            }
        }

        // Remove all expired projectiles from the 'finished' list
        for (Iterator iter = done.iterator(); iter.hasNext();)
        {
            if (!engine.isEntityInPlay((CombatEntityAPI) iter.next()))
            {
                iter.remove();
            }
        }
    }

    @Override
    public void init(CombatEngineAPI engine)
    {
        this.engine = engine;
        // I'm 99% sure plugins aren't persistent, but just in case...
        done.clear();
    }
}
« Last Edit: May 26, 2013, 02:26:29 PM by LazyWizard »
Logged

Arumac

  • Lieutenant
  • **
  • Posts: 98
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #541 on: June 02, 2013, 05:23:40 PM »

I haven't had the chance to try that script out until tonight. It works perfectly, literally perfectly. Thanks for your time Lazy, I honestly appreciate it.
Logged

ValkyriaL

  • Admiral
  • *****
  • Posts: 2145
  • The Guru of Capital Ships.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #542 on: June 08, 2013, 05:08:16 AM »

Quote
AI Hints for weapons, we could use a few more of those. Myself I could very much use the following, or at least a few of them.
BAD_TRACKING: similar to the STRIKE hint for torpedoes, the weapon has a very poor turn rate so watch where you fire it.

HIGH_FLUX: the weapon uses a lot of flux whenever it fires or builds up flux very rapidly, so don't put it on autofire unless you have the flux to spare.

LOW_AMMO(should be AI integrated): The weapon has a very low ammo count or is running out of ammo, so try to make sure every single shot fired connects with the target.

Quote
We could also use a few more SHIP hints, like the following.

SLOW: The ship in question is very slow or does not maneuver very well, so fly it accordingly

HEAVY: The ship in question has a lot of mass to it, so if you have an opportunity to ram your enemy, do it ;D

WEAK: The ships armor or shields are very weak and perhaps does not have a very impressive armament, so this ship is clearly not designed for slugging with other ships, but rather flanking them and letting others ships do the slugging for you, so do exactly that.

STRONG: This ship has very strong armor or shields and powerful weapons, it's clearly designed to be in your face or be slugging against enemies, use it that way.

BALANCED: This ship has moderate of all the above, Use it for whatever job you need it to do.

BROADSIDER: This ships weapons are all mounted on its side(s), try to keep its side(s) facing the enemy.
Quote
Ideas?
« Last Edit: June 08, 2013, 05:10:43 AM by ValkyriaL »
Logged

HELMUT

  • Admiral
  • *****
  • Posts: 1363
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #543 on: June 08, 2013, 07:51:30 AM »

Quote
AI Hints for weapons, we could use a few more of those. Myself I could very much use the following, or at least a few of them.
BAD_TRACKING: similar to the STRIKE hint for torpedoes, the weapon has a very poor turn rate so watch where you fire it.

HIGH_FLUX: the weapon uses a lot of flux whenever it fires or builds up flux very rapidly, so don't put it on autofire unless you have the flux to spare.

LOW_AMMO(should be AI integrated): The weapon has a very low ammo count or is running out of ammo, so try to make sure every single shot fired connects with the target.

Quote
We could also use a few more SHIP hints, like the following.

SLOW: The ship in question is very slow or does not maneuver very well, so fly it accordingly

HEAVY: The ship in question has a lot of mass to it, so if you have an opportunity to ram your enemy, do it ;D

WEAK: The ships armor or shields are very weak and perhaps does not have a very impressive armament, so this ship is clearly not designed for slugging with other ships, but rather flanking them and letting others ships do the slugging for you, so do exactly that.

STRONG: This ship has very strong armor or shields and powerful weapons, it's clearly designed to be in your face or be slugging against enemies, use it that way.

BALANCED: This ship has moderate of all the above, Use it for whatever job you need it to do.

BROADSIDER: This ships weapons are all mounted on its side(s), try to keep its side(s) facing the enemy.
Quote
Ideas?

+1, especially for the broadside.
Logged

Vinya

  • Captain
  • ****
  • Posts: 379
  • Vulgar at best...
    • View Profile
    • Mykyria Scifi/Zombie writing blog (Old site)
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #544 on: June 08, 2013, 07:33:39 PM »

Is it possible to make a weapon fire flares, and for the flares to actually work? Always wanted to make a flare turret but was never quite sure where to start/if it was possible.



Also, can missile weapons have recoil sprites? It'd make bay doors way easier if I could just have the door slide off with recoil, rather than animating it.

« Last Edit: June 08, 2013, 07:35:31 PM by Vinya »
Logged
If by "good guys" you mean "elitist regime that suppresses colonial independence and thrives off of an overwhelmingly deep gap in wealth between social classes," then yes.

Uomoz

  • Admiral
  • *****
  • Posts: 2663
  • 'womo'dz
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #545 on: June 09, 2013, 05:08:30 PM »

Any tips how to create a list of a specific class of ships Mothballed in a station?

To start:

List station_ships = station.getCargo().getMothballedShips().getMembersListCopy(); <-- This gets me a complete list of ships

Then I add this to the mix:

for (int i = 0; i < station_ships.size(); i++) {
                                MemberAPI = (FleetMemberAPI)station_ships.get(i);
                                if  (MemberAPI.isCapital()) {
                                Missing the needed line here to create a list of MemberAPI ships with only Capitals in it.
                                }
                            }
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #546 on: June 09, 2013, 09:17:14 PM »

Any tips how to create a list of a specific class of ships Mothballed in a station?

To start:

List station_ships = station.getCargo().getMothballedShips().getMembersListCopy(); <-- This gets me a complete list of ships

Then I add this to the mix:

for (int i = 0; i < station_ships.size(); i++) {
                                MemberAPI = (FleetMemberAPI)station_ships.get(i);
                                if  (MemberAPI.isCapital()) {
                                Missing the needed line here to create a list of MemberAPI ships with only Capitals in it.
                                }
                            }

You'd need to declare the List of capitals outside the for loop, like this:
Code
List capitalShips = new ArrayList();
Then the line you would use in the for loop would be:
Code
 if  (MemberAPI.isCapital()) capitalShips.add(MemberAPI);


Also, you might want to be careful how you name things. It can be very confusing for other people to read your code if you don't follow standard naming conventions.
Logged

Uomoz

  • Admiral
  • *****
  • Posts: 2663
  • 'womo'dz
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #547 on: June 10, 2013, 02:51:04 AM »

I see your point LW, but I never ever read anything about java and when a document talk me about identifiers I have no idea what is talking about.
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #548 on: June 10, 2013, 05:07:17 AM »

No worries, it was just an idle comment. :)
Logged

HELMUT

  • Admiral
  • *****
  • Posts: 1363
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #549 on: June 12, 2013, 06:14:03 AM »

CSV files, how do they work?

That's not the first time it happen to me. When i edit the CSV file and save it, no problem. But when i re-open the file, some numbers aren't in the right columns. So how do i get my CSV files to stay still and not doing weird stuffs whenever i modify them? I tried with OpenOffice and silentstormpt CSV Editor.

Also, what does "8/6/5/4%" means? I read somewhere that this column is unused, yet i see some mods using it.
Logged

phyrex

  • Admiral
  • *****
  • Posts: 751
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #550 on: June 12, 2013, 11:04:16 AM »

CSV files, how do they work?

That's not the first time it happen to me. When i edit the CSV file and save it, no problem. But when i re-open the file, some numbers aren't in the right columns. So how do i get my CSV files to stay still and not doing weird stuffs whenever i modify them? I tried with OpenOffice and silentstormpt CSV Editor.

Also, what does "8/6/5/4%" means? I read somewhere that this column is unused, yet i see some mods using it.


i have no clue why your csv wont stay still (sounds weird) but i can answer for the 8/6/5/4 thingy, its only a benchmark on flux dissipation that alex did, it is indeed useless and if you see mods that do use it, its most likely because the mod maker is using that column for the same reason alex initially putted it.

dont worry about it, it really is unused as far as mechanical ship stats goes

answer from : personal experience, i asked that very question months ago when i started modding  ;D
Logged

HELMUT

  • Admiral
  • *****
  • Posts: 1363
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #551 on: June 12, 2013, 02:12:54 PM »

Another question. Still on the CSV. Especially the weapon CSV.

How do i put number with decimals? Let's say i want the burst delay of my weapon to be 0,5. But when i put a number with a "," the game register it as a zero and the weapon fire extremely fast.  While using the value 1 it work, but is too slow for my taste.
Logged

ValkyriaL

  • Admiral
  • *****
  • Posts: 2145
  • The Guru of Capital Ships.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #552 on: June 12, 2013, 02:14:49 PM »

you put a dot instead of a comma. ,0.5,
Logged

Silver Silence

  • Admiral
  • *****
  • Posts: 980
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #553 on: June 12, 2013, 04:27:59 PM »

Another question. Still on the CSV. Especially the weapon CSV.

How do i put number with decimals? Let's say i want the burst delay of my weapon to be 0,5. But when i put a number with a "," the game register it as a zero and the weapon fire extremely fast.  While using the value 1 it work, but is too slow for my taste.

Seeing as the CSV is formatted with commas, that would read simply as "0" to the game and the gun would presumably have a fire rate of "2147arblghtoofast"
So do it the normal american way instead of the european way and use a period. I assume you also know how the decimal point works? 0.5 is twice a second, 0.25 is 4 times a second, 0.1 is 10 times a second, yada yada yada.
Logged

Pelly

  • Admiral
  • *****
  • Posts: 757
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #554 on: June 13, 2013, 12:51:33 PM »

Well.....

I have made a Fatal error and have no idea what it is (I have checked the code ect and its correct) The fatal message was:

Fatal: 1
Check  starfarer.log for more info.

Had a look through the logs and could not find anything that was glaringly obvious, this was caused by changing the default text in the settings file to one i made....though when Silent did it in his thread he didn't have any problems....

Heres the Error Log:

 13837 [Thread-8] INFO  com.fs.profiler.Profiler  - ID                     Calls   Duration    Percent
 13837 [Thread-8] INFO  com.fs.profiler.Profiler  - --------------------------------------------------
 13838 [Thread-8] ERROR com.fs.starfarer.combat.String  - java.lang.ArrayIndexOutOfBoundsException: 1
 java.lang.ArrayIndexOutOfBoundsException: 1
   at com.fs.graphics.super.O0OO.o00000(Unknown Source)
   at com.fs.graphics.super.O0OO.o00000(Unknown Source)
   at com.fs.starfarer.loading.H.o00000(Unknown Source)
   at com.fs.super.A.?00000(Unknown Source)
   at com.fs.starfarer.combat.String.o00000(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
   at java.lang.Thread.run(Thread.java:680)
« Last Edit: June 14, 2013, 02:02:06 AM by Pelhamds »
Logged
Pages: 1 ... 35 36 [37] 38 39 ... 706