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 ... 43 44 [45] 46 47 ... 706

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

Zaphide

  • Admiral
  • *****
  • Posts: 799
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #660 on: August 12, 2013, 01:32:12 AM »

Does anyone know how to check if a mod is installed, and if so which version?

Currently I am checking if a mod is installed like this (example):
Code
try
{
Global.getSettings().getScriptClassLoader().loadClass("data.scripts.world.HiigaraGen");
return true;
}
catch (ClassNotFoundException ex)
{
return false;
}

which works well, but doesn't get me the version of the mod. Anyone have any ideas? :)
Logged

JosephPierce

  • Ensign
  • *
  • Posts: 1
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #661 on: August 12, 2013, 10:45:27 AM »

ah, i see, okay i guess there is the problem. the frames are numbered in three digits and the number is not at the end of the filename.

What i did:
I took okims mod "ironclad" and tried to mimic his landing led light.

The following files are involved:

D:\Program Files (x86)\Fractal Softworks\Starsector\mods\Thule Legacy\data\scripts\plugins\isHulkCheck.java
Code
package data.scripts.plugins;

import com.fs.starfarer.api.AnimationAPI;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.EveryFrameWeaponEffectPlugin;
import com.fs.starfarer.api.combat.WeaponAPI;
import com.fs.starfarer.api.combat.FluxTrackerAPI;

public class isHulkCheck implements EveryFrameWeaponEffectPlugin
{

 public void advance(float amount, CombatEngineAPI engine, WeaponAPI weapon)
  {
   if (engine.isPaused()) return;

   AnimationAPI animation = weapon.getAnimation();
 
   if (weapon.getShip().isHulk())
    {
    animation.pause();
    }

   else
    {
     animation.play();
    }  

  }

}




D:\Program Files (x86)\Fractal Softworks\Starsector\mods\Thule Legacy\data\weapons\thule_deco_heimdahl.wpn
Code
{
"id":"thule_deco_heimdahl",
"specClass":"projectile",
"type":"DECORATIVE",
"size":"MEDIUM",

"everyFrameEffect":"data.scripts.plugins.isHulkCheck",

"turretSprite":"graphics/TL/weapons/decor/thule_heimdahl_Frame-01.png",
"hardpointSprite":"graphics/TL/weapons/decor/thule_heimdahl_Frame-01.png",

"numFrames":60,
"frameRate":15,
"alwaysAnimate":"true",

"turretOffsets":[0, 0],
"turretAngleOffsets":[0],
"hardpointOffsets":[0, 0],
"hardpointAngleOffsets":[0],

"barrelMode":"ALTERNATING", # or LINKED.  whether barrels fire at the same time or alternate.
"animationType":"MUZZLE_FLASH",  # NONE, GLOW, MUZZLE_FLASH, SMOKE
"muzzleFlashSpec":{"length":0.0,   # only used if animationType = MUZZLE_FLASH
  "spread":10,
  "particleSizeMin":4.0,
  "particleSizeRange":18.0,
  "particleDuration":0.2,
  "particleCount":25,
  "particleColor":[255,150,30,200]},

"projectileSpecId":"thule_barbarossa_shot",  # projectile that will be fired
"fireSoundTwo":"thule_barbarossa",
"fireSoundOne":"thule_barbarossa_overload",
}
[/u]
hello were you able to sort out the problem.. I am facing similar issue with my program files so please help.. Please reply thanks in advance:)
« Last Edit: August 13, 2013, 08:32:01 AM by JosephPierce »
Logged

Cycerin

  • Admiral
  • *****
  • Posts: 1665
  • beyond the infinite void
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #662 on: August 12, 2013, 11:10:52 AM »

It just uses polar coordinates to spawn stuff in an arc.

Spoiler

for (int i = 0; i < numParticles; i++) {
   float size = range * (float) Math.random() + min;
   float theta = (float) (Math.random() * Math.toRadians(spread) + Math.toRadians(angle - spread/2f));
   float r = (float) (Math.random() * length);
   float x = (float)Math.cos(theta) * r;
   float y = (float)Math.sin(theta) * r;
   Vector2f pos = new Vector2f(point.x + x, point.y + y);
   Vector2f vel = new Vector2f(x + shipVel.x, y + shipVel.y);
   // add particle here, using size/pos/vel
}
"point" is where the flash starts. Also note that it's using the offset from the point as the velocity, too; there's no reason it *has* to be that way, just happens to work fairly well.
[close]

Edit: I should say, there are definitely other ways to approach generating a muzzle flash. This one is pretty simplistic, but generally seems good enough.

Thanks a lot!!! One question, is there a boolean to determine if a weapon is charging? I want to make a reverse muzzle flash animation while the Nevermore's built-in weapon is charging, but I think it could prove somewhat tricky.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #663 on: August 13, 2013, 10:02:00 AM »

Spoiler
Does anyone know how to check if a mod is installed, and if so which version?

Currently I am checking if a mod is installed like this (example):
Code
try
{
Global.getSettings().getScriptClassLoader().loadClass("data.scripts.world.HiigaraGen");
return true;
}
catch (ClassNotFoundException ex)
{
return false;
}

which works well, but doesn't get me the version of the mod. Anyone have any ideas? :)
[close]

There's nothing official, though you might be able to come up with something even more creative :) Made a note on my list - not sure if I'll be able to get to it, though.

One question, is there a boolean to determine if a weapon is charging? I want to make a reverse muzzle flash animation while the Nevermore's built-in weapon is charging, but I think it could prove somewhat tricky.

You could get a pretty good idea using the various WeaponAPI methods (isFiring(), getCooldownRemaining(), etc).
Logged

Ravendarke

  • Captain
  • ****
  • Posts: 276
  • Nemesis
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #664 on: August 13, 2013, 12:45:53 PM »

I think it is possible, but just to make absolutely sure (I need to know while spriting and I donĀ“t want to switch to coding until I finish actual ship sprite).

I need to fire few containers in specific directions after firing weapon (projectile). So basically through everyframe plugin I will check if weapon fired, if so I will spawn few containers floating away from ship (they should explode after a while). It is possible, right?
Logged

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #665 on: August 13, 2013, 12:54:46 PM »

Like cartridges from a gun, yes it possible, you should use a Interval timer to from x to x seconds to make sure its both firing and it doesn't spawn too many "projectiles".
Logged

Ravendarke

  • Captain
  • ****
  • Posts: 276
  • Nemesis
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #666 on: August 13, 2013, 01:43:14 PM »

Like cartridges from a gun, yes it possible, you should use a Interval timer to from x to x seconds to make sure its both firing and it doesn't spawn too many "projectiles".

There is going to be long cooldown, like 15-20 seconds, it should fire 3 cartridges on each side (basically flux pods for cooldown - so I will basicly hardcode 6x cartridges per shop with preset direction and speed)... but now tricky party: Those cartridges ejectors suppose to be animated... it is possible to create them as deco, attach them to ship and then call them through their ID while main weapons fire to start their few frame animations?

And thank you very much for answer.
Logged

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #667 on: August 13, 2013, 02:00:46 PM »

You can play around with animation frames, with a script making it play the animations until it reaches a certain frame, heres a example with a currentCharge being set on the script to avoid overlapping frames:
Code
                    switch (currentCharge)
                    {
                        case 0:
                        {

                            animation.setFrame(0);
                            animation.pause();
                            break;
                        }
                        case 1:
                        {
                            if(animation.getFrame() == 5)
                            {
                                    animation.setFrame(1);
                                    animation.play();
                            }
                            break;
                        }
                        case 2:
                        {
                            if(animation.getFrame() == 10)
                            {
                                animation.setFrame(6);
                                animation.play();
                            }
                            break;
                        }
                        case 3:
                        {
                            if(animation.getFrame() == 15)
                            {
                                animation.setFrame(11);
                                animation.play();
                            }
                            break;
                        }
                        case 4:
                        {
                            if(animation.getFrame() == 20)
                            {
                                animation.setFrame(16);
                                animation.play();
                            }
                            break;
                        }
                    }

I can set 4 different rotations on the decorative animation, you can use a timer to get "the right time" to change the animations
Logged

Ravendarke

  • Captain
  • ****
  • Posts: 276
  • Nemesis
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #668 on: August 13, 2013, 02:10:18 PM »

Yeah but it is possible to start animation for different sprite? I mean if it is possible to start animation of some deco while weapon is firing (so basically link deco to weapon). I can, ofc, create weapon sprite big enough to cover main weapon and those cartridges ejectors, but due to ship size and distance between those it would be kinda overkill.
« Last Edit: August 13, 2013, 02:13:43 PM by Ravendarke »
Logged

Vayra

  • Admiral
  • *****
  • Posts: 627
  • jangala delenda est
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #669 on: August 14, 2013, 12:21:30 AM »

Quick question: Can anyone tell me what the "proper" dimensions for weapon sprites are? If they're too big they just seem to not show up in game, but I can't determine any kind of rhyme nor reason to it... i.e. one 68 x 72 weapon sprite will show up and a different one will not despite both being .PNGs with transparent backgrounds and the same dimensions (and hell, only slightly dissimilar actual images). Is there a certain aspect ratio they have to keep to? A certain maximum dimensions?
Logged
Kadur Remnant: http://fractalsoftworks.com/forum/index.php?topic=6649
Vayra's Sector: http://fractalsoftworks.com/forum/index.php?topic=16058
Vayra's Ship Pack: http://fractalsoftworks.com/forum/index.php?topic=16059

im gonna push jangala into the sun i swear to god im gonna do it

Gotcha!

  • Admiral
  • *****
  • Posts: 1124
    • View Profile
    • Welcome to New Hiigara
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #670 on: August 14, 2013, 04:09:17 AM »

I don't think there's a max to them. I created a ridiculously large beam weapon (101x368) and it showed up fine.
Maybe you can post the images here?
Logged
  

Sproginator

  • Admiral
  • *****
  • Posts: 3592
  • Forum Ancient
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #671 on: August 14, 2013, 05:22:21 AM »

Sounds stupid, but did you assign the right images? And did you mount the weapon :)
Logged
A person who's never made a mistake, never tried anything new
- Albert Einstein

As long as we don't quit, we haven't failed
- Jamie Fristrom (Programmer for Spiderman2 & Lead Developer for Energy Hook)

Vayra

  • Admiral
  • *****
  • Posts: 627
  • jangala delenda est
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #672 on: August 14, 2013, 01:06:23 PM »

Yeah, the same images have been assigned forever, and I haven't renamed them or moved them out of the directory -- doing that causes a crash, so it's easy to catch. I haven't messed with the .variant or .wpn files either. Plus anyway, I can see that they're mounted in the ship refit window (they show up in text under "weapons". The sprite itself just randomly seems to go AWOL sometimes when I edit it.

I'm testing this by loading starsector after every change and going to Missions, so it's not a matter of needing to reload the save either :(

I'll post a screenshot and the weapon sprites in a little bit, I don't have them here.
Logged
Kadur Remnant: http://fractalsoftworks.com/forum/index.php?topic=6649
Vayra's Sector: http://fractalsoftworks.com/forum/index.php?topic=16058
Vayra's Ship Pack: http://fractalsoftworks.com/forum/index.php?topic=16059

im gonna push jangala into the sun i swear to god im gonna do it

Ravendarke

  • Captain
  • ****
  • Posts: 276
  • Nemesis
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #673 on: August 14, 2013, 01:12:37 PM »

May I suggest that you should post whole mod?
Logged

Sproginator

  • Admiral
  • *****
  • Posts: 3592
  • Forum Ancient
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #674 on: August 14, 2013, 01:34:31 PM »

Yeah, Send me the mod in a PM, I'll take a look and get it fixed pal
Logged
A person who's never made a mistake, never tried anything new
- Albert Einstein

As long as we don't quit, we haven't failed
- Jamie Fristrom (Programmer for Spiderman2 & Lead Developer for Energy Hook)
Pages: 1 ... 43 44 [45] 46 47 ... 706