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 ... 177 178 [179] 180 181 ... 706

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

kazi

  • Admiral
  • *****
  • Posts: 714
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2670 on: January 23, 2016, 11:01:06 AM »

I believe you can use something like Global.getSector().getPlayerFleet().getCommanderStats() to get at some of the player memory data. The problem with the player memory is it's in a whole bunch of different places, which means you often have to go digging through several different parts of the API to get player-related information.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2671 on: January 23, 2016, 07:02:52 PM »

To get a $global.memoryValue from Java code, I use Global.getSector().getMemoryWithoutUpdate().
To get a $faction.value it's factionAPI.getMemoryWithoutUpdate().
But how do I get a $player.value?

Global.getSector().getCharacterData().getMemory()

(Also, what's the difference between getMemory() and getMemoryWithoutUpdate()?)

getMemory() calls the various updateXXXFacts() methods, whichever are applicable for that memory. A lot of the memory data has an expiration of 0 and so is recomputed on a getMemory() call instead of being saved/kept around all the time.

See: the CoreCampaignPluginImpl.updateXXXFacts() methods; these and any mod-provided ones will be called.

So, generally, if you're only going to write to the memory, you should call getMemoryWithoutUpdate(). If you're going to read from it, it depends on what you want to read, i.e. whether it's something you know sticks around or if it's something recomputed. Also, generally, if you *do* call getMemory(), you want to store the return value in a variable to avoid calling the method multiple times.
Logged

kazi

  • Admiral
  • *****
  • Posts: 714
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2672 on: January 23, 2016, 08:47:48 PM »

So, generally, if you're only going to write to the memory, you should call getMemoryWithoutUpdate(). If you're going to read from it, it depends on what you want to read, i.e. whether it's something you know sticks around or if it's something recomputed. Also, generally, if you *do* call getMemory(), you want to store the return value in a variable to avoid calling the method multiple times.

Interesting, it was never quite clear to me what the difference actually was.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2673 on: January 23, 2016, 10:16:15 PM »

(A corollary to the above: calling getMemory() outside the context of a UI interaction is likely a bad idea, while getMemoryWithoutUpdate() is ok.)
Logged

LB

  • Lieutenant
  • **
  • Posts: 54
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2674 on: January 25, 2016, 04:21:46 PM »

Is it possible to lock a weapon to a specific angle, aside from issuing a setCurrAngle() every frame? Is it possible to restrict the firing arc of weapons dynamically?

Are there any foreseeable issues with doing either of the above from a ship system, rather than a EveryFrameWeaponEffectPlugin?
« Last Edit: January 25, 2016, 09:44:00 PM by LB »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2675 on: January 27, 2016, 01:36:23 PM »

It's not, aside from what you're saying (which, IIRC, would still restrict it to the weapon's normal arc).

Are there any foreseeable issues with doing either of the above from a ship system, rather than a EveryFrameWeaponEffectPlugin?

Should be fine either way.
Logged

Toxcity

  • Admiral
  • *****
  • Posts: 561
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2676 on: February 01, 2016, 04:09:49 PM »

Is there a way to tell if combat is ending?
Logged

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2677 on: February 05, 2016, 09:50:44 AM »

Hi question, a mean for put a decorative weapon like a sprite of ship?

Hum, look this gif and you can understand easy my problem : (Look just engine)

Spoiler
[close]

"renderHints":["RENDER_ADDITIVE"]   is good for that, but he change also color of my object (this thing blu and red)... and i have not find where is list of RENDER...   ( Base of my object  is light green if i put that ><) .
Spoiler
Semi transparent or if i put under a sprite of this object: I have always a green too green.
[close]

Thank you '.'

« Last Edit: February 05, 2016, 10:30:50 AM by Snrasha »
Logged
I am pretty bad on english. So, sorry in advance.

Gladiator Society
Add battle options on Com Relay/ Framework for modders for add their own bounty.

Sanguinary Autonomist Defectors A fan-mod of Shadowyard.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2678 on: February 06, 2016, 08:58:00 AM »

Is there a way to tell if combat is ending?

Hmm, don't think so, at least not super easily. You could check things like "nothing on the field for one side, and no reserves or is in full retreat", and that'd probably do it, though.


@Snarsha: I'm sorry, I don't understand what you're asking. Could you try explaining in a different way?
Logged

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2679 on: February 06, 2016, 09:56:13 AM »

Hum, sorry, i have think a other means.

But small question: If i have a weapon who boost stats, but, if i put more weapon, i do not have more boost, just one.

Spoiler
Quote
        @Override
   public void advance(float amount, CombatEngineAPI engine, WeaponAPI weapon) {
               
      if (engine.isPaused()) return;
               
                ShipAPI ship = weapon.getShip();


                if(weapon.isDisabled()){
                        ship.getMutableStats().getFluxDissipation().unmodifyMult(weapon.getId());
                } else{
                        ship.getMutableStats().getFluxDissipation().modifyMult(weapon.getId(), BOOSTFLUX);
                }
[close]

Logged
I am pretty bad on english. So, sorry in advance.

Gladiator Society
Add battle options on Com Relay/ Framework for modders for add their own bounty.

Sanguinary Autonomist Defectors A fan-mod of Shadowyard.

Tartiflette

  • Admiral
  • *****
  • Posts: 3529
  • MagicLab discord: https://discord.gg/EVQZaD3naU
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2680 on: February 06, 2016, 10:03:55 AM »

That's because all your "boost" weapons have the same ID. Try to set a unique ID per weapon script.
Logged
 

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2681 on: February 06, 2016, 10:04:24 AM »

Right - the weapon id is the id from the spreadsheet, so for multiple copies of the same weapon you get the same id. You probably want to generate a unique id in the constructor for your script and then use that as they modifier key.

(Ninja'ed!)
Logged

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2682 on: February 06, 2016, 10:34:10 AM »

Else, a means for create a hybrid/universal weapon who is not effect (Because this is a type)so per  boost ballistic,missile and energy?


Thank Alex-Admin-God and Tartiflette
« Last Edit: February 07, 2016, 01:12:56 AM by Snrasha »
Logged
I am pretty bad on english. So, sorry in advance.

Gladiator Society
Add battle options on Com Relay/ Framework for modders for add their own bounty.

Sanguinary Autonomist Defectors A fan-mod of Shadowyard.

Cyan Leader

  • Admiral
  • *****
  • Posts: 718
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2683 on: February 10, 2016, 08:41:29 PM »

Can anyone point me to a good tutorial on how to compile the .java files to .class files that Starsector will read?
Logged

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2684 on: February 10, 2016, 11:23:03 PM »

Two methods:
You  can use your shell, i have already use that, but boring. (Ok no, but when you have second method, hum..)

You can use eclipse,netbeans, intelUp. Two lasts have tutoriel in this forum. After, open your project, you can compile your file java in class, this three environment for development java can build also  file.jar (who is read per Starsector, if you put in mod_info.json).
Logged
I am pretty bad on english. So, sorry in advance.

Gladiator Society
Add battle options on Com Relay/ Framework for modders for add their own bounty.

Sanguinary Autonomist Defectors A fan-mod of Shadowyard.
Pages: 1 ... 177 178 [179] 180 181 ... 706