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 ... 8 9 [10] 11 12 ... 706

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

EnderNerdcore

  • Commander
  • ***
  • Posts: 172
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #135 on: January 15, 2013, 07:49:40 PM »

I've just created a system that allows a carrier to teleport a player's most damaged wing to itself. It works great, the only problem is that the fighters don't get the phase teleport animation.

Since I cannot find any code for the phase teleporter or skimmer, I can't see any examples of how to tell the game that it should be playing the phase teleport animations. Is there any way for me to do this, or is it a feature that is currently unmoddable?
Logged

LostInTheWired

  • Lieutenant
  • **
  • Posts: 83
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #136 on: January 15, 2013, 09:30:33 PM »

I've been looking in the files of a mod, trying to figure out why a carrier in it isn't...acting like a carrier (won't rally at Rally Carrier commands).  Is this set anywhere?  It has a launch bay, so if that's how it selects carriers, it's not quite working.
Logged

EnderNerdcore

  • Commander
  • ***
  • Posts: 172
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #137 on: January 15, 2013, 09:53:44 PM »

I've been looking in the files of a mod, trying to figure out why a carrier in it isn't...acting like a carrier (won't rally at Rally Carrier commands).  Is this set anywhere?  It has a launch bay, so if that's how it selects carriers, it's not quite working.
you need to put CARRIER in the 'hint' column in the ships,csv file
Logged

Romeo_One

  • Captain
  • ****
  • Posts: 393
  • "Let me do the german dance for you..."
    • View Profile
    • Rejection - The Fight for Unity
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #138 on: January 17, 2013, 10:13:01 AM »

Is it possible that you can't have more than 4 backgrounds?
Logged

Nekora

  • Ensign
  • *
  • Posts: 28
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #139 on: January 17, 2013, 11:29:13 AM »

Using the new hit effects system is it possible to have a beam weapon bounce to hit another target, like a chain lightning type weapon, or could a projectile weapon do the same?
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 #140 on: January 17, 2013, 12:53:05 PM »

Using the new hit effects system is it possible to have a beam weapon bounce to hit another target, like a chain lightning type weapon, or could a projectile weapon do the same?

Yes, you can do that with projectiles easily. We can't spawn beams in our code yet, but you could make something similar with lightning arcs (since you mentioned chain lightning, that might work better anyway). :)
Logged

Nekora

  • Ensign
  • *
  • Posts: 28
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #141 on: January 17, 2013, 12:57:51 PM »

Yes, you can do that with projectiles easily. We can't spawn beams in our code yet, but you could make something similar with lightning arcs (since you mentioned chain lightning, that might work better anyway). :)

Cool, could you show me an example of this? i started a thread asking for examples here > http://fractalsoftworks.com/forum/index.php?topic=5423.msg84776#msg84776
Logged

Uomoz

  • Admiral
  • *****
  • Posts: 2663
  • 'womo'dz
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #142 on: January 20, 2013, 10:41:25 AM »

Is it possible to get an existing station and set it to a new orbit\location?
Logged

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #143 on: January 20, 2013, 11:30:09 AM »

Im having trouble getting a TractorBeam to work, its for the startreker mod, its suppose to be a borg weapon of doom that feeds on player tears, but right now its feeding on my tears  :'(

Code
package data.scripts.plugins;

import com.fs.starfarer.api.combat.BeamAPI;
import com.fs.starfarer.api.combat.BeamEffectPlugin;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.CombatEntityAPI;
import com.fs.starfarer.api.combat.DamageType;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.util.IntervalUtil;
import java.awt.Color;
import org.lwjgl.util.vector.Vector2f;
import org.lazywizard.lazylib.MathUtils;

public class TractorBeamEffect implements BeamEffectPlugin {

private CombatEntityAPI currentArc = null;
private IntervalUtil fireInterval = new IntervalUtil(0.2f, 0.3f);

public void advance(float amount, CombatEngineAPI engine, BeamAPI beam) {

if (currentArc != null) {
if (!engine.isEntityInPlay(currentArc)) {
currentArc = null;
}//if
}//if

CombatEntityAPI target = beam.getDamageTarget();
if (target != null && target instanceof ShipAPI && (target.getShield() == null || !target.getShield().isWithinArc(beam.getTo()))) {
if (beam.getBrightness() >= 1f) {
fireInterval.advance(amount);
if (fireInterval.intervalElapsed()) {
Vector2f dir = Vector2f.sub(beam.getTo(), beam.getFrom(), new Vector2f());
if (dir.lengthSquared() > 0) dir.normalise();
dir.scale(5f);
Vector2f point = Vector2f.sub(beam.getTo(), dir, new Vector2f());
float emp = beam.getWeapon().getDerivedStats().getBurstDamage() * .667f;
float dam = emp * 0.25f;
engine.spawnEmpArc(beam.getSource(), point, beam.getDamageTarget(), beam.getDamageTarget(),
//engine.spawnEmpArc(beam.getSource(), beam.getFrom(), beam.getSource(), beam.getDamageTarget(),
  DamageType.ENERGY,
  dam, // damage
  emp, // emp
  100000f, // max range
  "tachyon_lance_emp_impact",
  30f, // thickness
  new Color(68,250,50,255),
  new Color(212,255,192,255)
  );
                                                Vector2f velocity, direction;
                                                float distance;

                                                velocity = beam.getDamageTarget().getVelocity();
                                                distance = MathUtils.getDistance(beam.getDamageTarget(), beam.getSource());
                                                // Normalized directional vector
                                                direction = MathUtils.getDirectionalVector(beam.getDamageTarget(), beam.getSource());

                                                float strength = distance * 300f;
                                                velocity.set(velocity.x + (direction.x * strength * amount), velocity.y + (direction.y * strength * 100f));
                                }//if
}//if
}//if
}//advance
}//class

Based on LazyWizard blackhole code and a copy of the tachyon lance vanila weapon effect.

It semi works, it not pulling but it stops a ship from moving, heres a sneak peak:
Spoiler
[close]

I still need to make a "weaker" version of it, based on hull sizes for the other factions, this one should not care what size the ship is, he will pull it in like it was nothing while getting emp dmg on it
« Last Edit: January 20, 2013, 11:59:58 AM by silentstormpt »
Logged

Romeo_One

  • Captain
  • ****
  • Posts: 393
  • "Let me do the german dance for you..."
    • View Profile
    • Rejection - The Fight for Unity
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #144 on: January 20, 2013, 12:17:46 PM »

Mind if I use that "movement stopper" code for Rejection? Because that would totally fit an EW-frigate!
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 #145 on: January 20, 2013, 12:21:50 PM »

Im having trouble getting a TractorBeam to work, its for the startreker mod, its suppose to be a borg weapon of doom that feeds on player tears, but right now its feeding on my tears  :'(

Code
package data.scripts.plugins;

import com.fs.starfarer.api.combat.BeamAPI;
import com.fs.starfarer.api.combat.BeamEffectPlugin;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.CombatEntityAPI;
import com.fs.starfarer.api.combat.DamageType;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.util.IntervalUtil;
import java.awt.Color;
import org.lwjgl.util.vector.Vector2f;
import org.lazywizard.lazylib.MathUtils;

public class TractorBeamEffect implements BeamEffectPlugin {

private CombatEntityAPI currentArc = null;
private IntervalUtil fireInterval = new IntervalUtil(0.2f, 0.3f);

public void advance(float amount, CombatEngineAPI engine, BeamAPI beam) {

if (currentArc != null) {
if (!engine.isEntityInPlay(currentArc)) {
currentArc = null;
}//if
}//if

CombatEntityAPI target = beam.getDamageTarget();
if (target != null && target instanceof ShipAPI && (target.getShield() == null || !target.getShield().isWithinArc(beam.getTo()))) {
if (beam.getBrightness() >= 1f) {
fireInterval.advance(amount);
if (fireInterval.intervalElapsed()) {
Vector2f dir = Vector2f.sub(beam.getTo(), beam.getFrom(), new Vector2f());
if (dir.lengthSquared() > 0) dir.normalise();
dir.scale(5f);
Vector2f point = Vector2f.sub(beam.getTo(), dir, new Vector2f());
float emp = beam.getWeapon().getDerivedStats().getBurstDamage() * .667f;
float dam = emp * 0.25f;
engine.spawnEmpArc(beam.getSource(), point, beam.getDamageTarget(), beam.getDamageTarget(),
//engine.spawnEmpArc(beam.getSource(), beam.getFrom(), beam.getSource(), beam.getDamageTarget(),
  DamageType.ENERGY,
  dam, // damage
  emp, // emp
  100000f, // max range
  "tachyon_lance_emp_impact",
  30f, // thickness
  new Color(68,250,50,255),
  new Color(212,255,192,255)
  );
                                                Vector2f velocity, direction;
                                                float distance;

                                                velocity = beam.getDamageTarget().getVelocity();
                                                distance = MathUtils.getDistance(beam.getDamageTarget(), beam.getSource());
                                                // Normalized directional vector
                                                direction = MathUtils.getDirectionalVector(beam.getDamageTarget(), beam.getSource());

                                                float strength = distance * 300f;
                                                velocity.set(velocity.x + (direction.x * strength * amount), velocity.y + (direction.y * strength * 100f));
                                }//if
}//if
}//if
}//advance
}//class

Based on LazyWizard blackhole code and a copy of the tachyon lance vanila weapon effect.

It semi works, it not pulling but it stops a ship from moving, heres a sneak peak:
Spoiler
[close]

I still need to make a "weaker" version of it, based on hull sizes for the other factions, this one should not care what size the ship is, he will pull it in like it was nothing while getting emp dmg on it

You're probably having problems because you have the pull effect inside of the if (fireInterval.intervalElapsed()) block. That means it will only execute once about every 15 frames - since the velocity change from the black hole code is implemented gradually, this means there will be almost no effect at all.

Code
float strength = distance * 300f;

You might want to change this as well. Strength equals the net change in velocity per second, and with this you'll be pulling a ship in at max speed, probably crushing them against your hull. :)
« Last Edit: January 20, 2013, 12:24:21 PM by LazyWizard »
Logged

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #146 on: January 20, 2013, 12:33:18 PM »

You're probably having problems because you have the pull effect inside of the if (fireInterval.intervalElapsed()) block. That means it will only execute once about every 15 frames - since the velocity change from the black hole code is implemented gradually, this means there will be almost no effect at all.
Code
float strength = distance * 300f;

You might want to change this as well. Strength equals the net change in velocity per second, and with this you'll be pulling a ship in at max speed, probably crushing them against your hull. :)

Yes

and actually its making it spinning instead of crushing into the hull (it doesnt matter if it does do that, we are the borg, we couldnt care less what happens to your puny ships), i had one ship destroyed while under its effect that it literally got falcon punched out of the combat zone while spinning at a astronomical rate

How about setting depending on ship mass:
float strength = distance * (float)Math.abs((beam.getSource().getMass() - beam.getDamageTarget().getMass()));
« Last Edit: January 20, 2013, 12:48:34 PM by silentstormpt »
Logged

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #147 on: January 20, 2013, 12:34:25 PM »

Mind if I use that "movement stopper" code for Rejection? Because that would totally fit an EW-frigate!

Sure, but it needs tuning to actually not roflstomb anything regardless the hull size or velocity it has
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 #148 on: January 20, 2013, 12:39:09 PM »

and actually its making it spinning instead of crushing into the hull (it doesnt matter if it does do that, we are the borg, we couldnt care less what happens to your puny ships), i had one ship destroyed while under its effect that it literally got falcon punched out of the combat zone while spinning at a astronomical rate

Code
velocity.set(velocity.x + (direction.x * strength * amount), velocity.y + (direction.y * strength * 100f));

Why is the y velocity change being multiplied by 100 instead of amount? Since amount will usually be about 0.016, that's a significant difference in power. ;) That might be why it's spinning (the AI trying to compensate for being shoved aside).
Logged

Romeo_One

  • Captain
  • ****
  • Posts: 393
  • "Let me do the german dance for you..."
    • View Profile
    • Rejection - The Fight for Unity
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #149 on: January 20, 2013, 12:41:19 PM »

Goes without saying, will propably have a hefty flux buildup.
Logged
Pages: 1 ... 8 9 [10] 11 12 ... 706