Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 289 290 [291] 292 293 ... 710

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24127
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4350 on: February 21, 2019, 10:16:40 AM »

Well that's unfortunate; I don't see anything in ShipVariantAPI that would let me do what I need to for mirroring weapon sprites.

The closest I can come up with at the moment would be to have two versions of a weapon, one with the sprite pre-mirrored, and swap them out, but that seems like it'd run into all sorts of other issues when you'd have, say, effectively-identical hellbore and hellbore_m weapons that could end up in your cargo holds, for example.  Plus it wouldn't play well with, say, any other mod deciding to do some custom fleet generation, or adding variants that don't have the mirrored versions already correctly set...

If it helps any, I don't -actually- need the ship objects at all; that was just a convenient reference point for finding the things I do need: which are the WeaponSlotAPI and SpriteAPI objects for each of the weapons I'm looking at (potentially) mirroring.  (WeaponSlotAPI has the relative ship coordinates that let me ask "is this gun on the left side of the ship?", and SpriteAPI is what I need to actually do a horizontal flip of the graphics.)

I saw you start the other thread - could you clarify exactly what you're doing, there? I'm unclear by what you mean by mirroring, exactly how you're doing the rendering, etc. Still probably no easy way to expose this, but since I don't quite get the situation, I can't say 100%.


Is there a way to get access to a weapon or projectile's glow/etc colors?
That way, the emp on hit script could just read the weapon/projectile to set the arc color instead of a hardcoded value.

EDIT Right, weapon getSpec does the job for weapon glow color. No way to get anything beyond the projectile spec id, though?

Ah, right - made a note to add ProjectileSpecAPI to the API. Surprised this hasn't come up before, really.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4688
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4351 on: February 23, 2019, 01:59:34 AM »

For NPC markets, is there any gameplay difference between market.setFreePort(true) and adding the free port market condition directly?

I ask because I just found a Nexerelin-related bug where if you call market.setFreePort(true) on a market that already has the free port condition, a second free port condition is added causing all the bonuses/penalties to be doubled.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24127
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4352 on: February 23, 2019, 09:13:33 AM »

Generally, you should only manage free port status using setFreePort() - there's an internal boolean keeping track of whether it's a free port, and these methods keep both that and the presence of the condition in sync.

The bug you're describing could happen if, say, the FreeMarket condition was added manually, and then setFreePort(true) was called. Since the boolean would still be false at that point, that method would assume there's no free port and would add the condition again.

(There's also a bug - which IIRC you brought to my attention - where calling setFreePort(true) on a market without a spaceport will result in the condition self-removing but the boolean flag being set to true, which would make a subsequent call to setFreePort(true) fail even after a spaceport is constructed. That bug is fixed.)
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4353 on: February 23, 2019, 11:10:49 AM »


Has anything changes with hiring officers?? I know admins were added but that is a separate rule. I'm getting index out of bounds when I call "CallEvent $ome_eventRef printSkills $id" but nothing in my code changes that to my knowledge, I just have custom rules that call it for my factions officers.


Figured this one out. It wasn't that script, it was a couple scripts in subsequent rule entries that weren't passing in $id (must have changed from .8 to .9)

To be safe, I also added in each relevant rule relating to admins, and I can hire faction officers and admins normally now.


In .9, however, that same transaction is done when a player simply docks at a market in the market description text. So I am wondering if that is just a separate ruleset that those missions now require, and if so, is the old way in .8 and its related rules now deprecated in favor of the new system.

Unless I'm missing something, that seems incorrect. Bar delivery missions end on market interaction, but procurement missions - which involve a specific person - iirc still require getting in touch via the comm directory.

Ok, so I dug into this a little more and as it turns out there are some exceptions and I'm not sure what causes them. I'm going to post some screenshots to show you what I mean.

Most procurement missions that are generated in intel (as opposed to a bar mission) do generate an NPC with a quest marker in the commboard of the mission delivery market, but not all. I think it may be based on the commodity requested, but I'm honestly not sure.

All bar event missions seem to operate on market interface though, and never on the commboard interface.

Images in spoiler
Spoiler
[close]

I'm going to keep investigating why these types of mission don't seem to be returnable on faction planets.

I will say that though I haven't completely confirmed this yet, I notice it happening the most on stations. Some stations are set to orbit entities like a Gate, rather than a planet or the star at the center. Would that potentially cause problems?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24127
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4354 on: February 23, 2019, 12:50:24 PM »

I'm going to keep investigating why these types of mission don't seem to be returnable on faction planets.

I will say that though I haven't completely confirmed this yet, I notice it happening the most on stations. Some stations are set to orbit entities like a Gate, rather than a planet or the star at the center. Would that potentially cause problems?

If you haven't already, I'd suggest looking at ProcurementMissionIntel.java. Taking a look myself just now, it doesn't look possible - a PersonAPI for the "contact" is created when the intel is created, and is then added to the comm directory first thing in missionAccepted().
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4355 on: February 23, 2019, 02:32:46 PM »

If you haven't already, I'd suggest looking at ProcurementMissionIntel.java. Taking a look myself just now, it doesn't look possible - a PersonAPI for the "contact" is created when the intel is created, and is then added to the comm directory first thing in missionAccepted().

edit* I will look in that source file too and see what I can find

Sure, I definitely get what you are saying, but that doesn't mean the interface for the turn-in script is triggered at the commboard level upon specific interaction with that PersonAPI. You can call the PersonAPI during inital market interaction with the MarketAPI just as easily, right?

I removed all mods and just ran umodded Starsector for examples of what I am talking about.

Here are screens of both types of intel-spawned procurement missions occurring without any mods running:

Spoiler
[close]

As you can see, though both missions are accepted the same way through the intel UI, the first procurement mission is turned in through the commboard via the PersonAPI. I couldn't turn it in at the time because it was from pirates and my transponder was on.

The second mission for the Independents is turned in upon docking with the market.

That has to be a different script, and I believe it is that script that is failing for faction markets. There has to be something set in the initial script that determines which turn in interface is used, unless it is just randomly chosen in Rules based on two rule sets that operate off the same trigger. That seems unlikely, though, since the triggers for market interaction and commboard interaction would be different I'd imagine. I can't honestly see if there is still a PersonAPI generated as the contact- because it never lets me get to the commboard in this case. It is noteworthy that a quest marker is still present. The traditional commboard PersonAPI missions seem to work fine in the mod, however, and bugged missions do not have a PersonAPI with a quest marker and no quest marker shows on the market either.

I also now know it doesn't matter what commodity it is. Here is another unmodded example of Heavy Armaments that is turned in at the commboard level instead of the market level:

Spoiler
[close]
« Last Edit: February 23, 2019, 02:36:05 PM by Morrokain »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24127
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4356 on: February 23, 2019, 10:31:02 PM »

Ahh I finally see what you're talking about - I'm sorry, it wasn't really clicking.

This code in ProcurmentMissionIntel will make it so that the contact will initiate comms when you dock with a market:

if (contactWillInitiateComms) {
   contact.incrWantsToContactReasons();
}

What was confusing me is that this contact is still in the comm directory, and you can still turn in via the comm directory if you refuse the connection, so this isn't a case of the contact *not* being in the comm directory.

There's a 50% chance the procurement contact NPC will try to get in touch.

The rule commands you want to look for, then, are:

NPCWantsComms -> which returns whether any NPC on the colony (not in the comm directory, but added via market.addPerson(), which ProcurementMissionIntel does) wants to contact the player

PickCommsNPC -> which picks, and sets as the active person, one of the NPCs that wants to contact the player

... I'm not sure if this is actually helpful, but hopefully this'll at least point you towards what to look at.
Logged

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4357 on: February 25, 2019, 05:00:10 AM »

Hi, after have add a third bar on my player HUD, i search to add it on the top right of the player ship.

Spoiler
[close]

If i have the zoom who go to 0.5 to 2 for frigate/destroyer and 0.75 to 2.25 for cruiser/capital
I do not found what they use for have the constant offset for these ships. They do not seems to depends of the width/height of the sprite or the collision radius.
What value you use for put the flux/hull bar on the topright of the player ship?(Except the zoom)

I search to apply that also on the target of the player ship, but, i suppose than they will be pretty simple, if i do already for the player ship.



Thank you.
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.

Histidine

  • Admiral
  • *****
  • Posts: 4688
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4358 on: February 25, 2019, 05:05:48 AM »

Is there a way to have a rules interaction dialog refresh its memory map?

Specific issue: After a market is captured by the player in Nexerelin, the memory references still point to the old faction, so the check $faction.id != player for whether to display the "Consider your military options" option returns true.
I'm thinking of hacking it by making it also check for a "was this market just captured?" memory value, but I'm wondering if there's a better way.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24127
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4359 on: February 25, 2019, 09:19:55 AM »

Hi, after have add a third bar on my player HUD, i search to add it on the top right of the player ship.

Spoiler
[close]

If i have the zoom who go to 0.5 to 2 for frigate/destroyer and 0.75 to 2.25 for cruiser/capital
I do not found what they use for have the constant offset for these ships. They do not seems to depends of the width/height of the sprite or the collision radius.
What value you use for put the flux/hull bar on the topright of the player ship?(Except the zoom)

I search to apply that also on the target of the player ship, but, i suppose than they will be pretty simple, if i do already for the player ship.



Thank you.

It's... dynamic and fairly complicated. Might be too much to try to emulate - especially when you consider that these will move relative to the ship to stay on-screen as the ship moves off-screen. It's based on the shield radius, though.


Is there a way to have a rules interaction dialog refresh its memory map?

Specific issue: After a market is captured by the player in Nexerelin, the memory references still point to the old faction, so the check $faction.id != player for whether to display the "Consider your military options" option returns true.
I'm thinking of hacking it by making it also check for a "was this market just captured?" memory value, but I'm wondering if there's a better way.

There's an UpdateMemory command, which should do it. If you need to do it in code, you could also do:

((RuleBasedDialog) dialog.getPlugin()).updateMemory();

Which is what UpdateMemory does.
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4360 on: February 25, 2019, 10:16:39 AM »

Ahh I finally see what you're talking about - I'm sorry, it wasn't really clicking.

This code in ProcurmentMissionIntel will make it so that the contact will initiate comms when you dock with a market:

if (contactWillInitiateComms) {
   contact.incrWantsToContactReasons();
}

What was confusing me is that this contact is still in the comm directory, and you can still turn in via the comm directory if you refuse the connection, so this isn't a case of the contact *not* being in the comm directory.

There's a 50% chance the procurement contact NPC will try to get in touch.

The rule commands you want to look for, then, are:

NPCWantsComms -> which returns whether any NPC on the colony (not in the comm directory, but added via market.addPerson(), which ProcurementMissionIntel does) wants to contact the player

PickCommsNPC -> which picks, and sets as the active person, one of the NPCs that wants to contact the player

... I'm not sure if this is actually helpful, but hopefully this'll at least point you towards what to look at.

Thanks yeah that was helpful! My own rules regarding the MarketPostOpen trigger also had a weight of 1000 under the "faction.id ==" condition so I'm pretty sure I was overriding the rule for NPCs wanting to speak with you at the market level.

That still doesn't explain how the NPC wasn't there though.

I am going to try and reproduce that now.
Logged

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4361 on: February 25, 2019, 10:32:45 AM »

Hi, after have add a third bar on my player HUD, i search to add it on the top right of the player ship.

Spoiler
[close]

If i have the zoom who go to 0.5 to 2 for frigate/destroyer and 0.75 to 2.25 for cruiser/capital
I do not found what they use for have the constant offset for these ships. They do not seems to depends of the width/height of the sprite or the collision radius.
What value you use for put the flux/hull bar on the topright of the player ship?(Except the zoom)

I search to apply that also on the target of the player ship, but, i suppose than they will be pretty simple, if i do already for the player ship.



Thank you.

It's... dynamic and fairly complicated. Might be too much to try to emulate - especially when you consider that these will move relative to the ship to stay on-screen as the ship moves off-screen. It's based on the shield radius, though.


Ok, thank, i will do try to add a another HUD, so. Just need to try some thing, for get a correct
Spoiler
[close]
On my idea, this is like that.
« Last Edit: February 25, 2019, 10:35:11 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.

Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 430
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4362 on: February 25, 2019, 10:52:52 AM »


I use OpenGL to make a mask come true and render it in renderInWorldCoords, but it seems the damage number renders before BaseEveryFrameCombatPlugin ???
could the render order be changed?
My main scripts:
Spoiler
Code: java
public void render() {
            SpriteAPI mask = Global.getSettings().getSprite("holyGrail", "mask");
            SpriteAPI spin = Global.getSettings().getSprite("holyGrail", "spin");
            SpriteAPI spin2 = Global.getSettings().getSprite("holyGrail", "spin");
            Vector2f loc = ship.getLocation();
            Vector2f computePosition = anchorSlot.computePosition(ship);
            Vector2f spinPosition = MathUtils.getPointOnCircumference(computePosition, 60f, ship.getFacing());
            mask.setAngle(ship.getFacing() - 90f);
            float rotate1 = ship.getFacing() - 90f + spinRotation;
            float rotate2 = ship.getFacing() - 90f - spinRotation;

            float w = ship.getCollisionRadius() * 2f;
            float h = w;


            GL11.glColorMask(false, false, false, true);

            GL11.glPushMatrix();
            GL11.glTranslatef(loc.x, loc.y, 0);
            Misc.renderQuadAlpha(0 - w / 2f - 1f, 0 - h / 2f - 1f, w + 2f, h + 2f, Misc.zeroColor, 0f);
            GL11.glPopMatrix();

            spin.setAngle(rotate1);
            spin.renderAtCenter(spinPosition.x, spinPosition.y);

            mask.setBlendFunc(GL11.GL_ZERO, GL11.GL_ONE_MINUS_SRC_ALPHA);
            mask.renderAtCenter(computePosition.x, computePosition.y);

            GL11.glColorMask(true, true, true, false);
            spin.setBlendFunc(GL11.GL_DST_ALPHA, GL11.GL_ONE_MINUS_DST_ALPHA);
            spin.setAngle(rotate1);
            spin.setColor(new Color(100, 100, 100));
            spin.renderAtCenter(spinPosition.x, spinPosition.y);


            GL11.glColorMask(false, false, false, true);

            GL11.glPushMatrix();
            GL11.glTranslatef(loc.x, loc.y, 0);
            Misc.renderQuadAlpha(0 - w / 2f - 1f, 0 - h / 2f - 1f, w + 2f, h + 2f, Misc.zeroColor, 0f);
            GL11.glPopMatrix();

            spin2.setAngle(rotate2);
            spin2.renderAtCenter(spinPosition.x, spinPosition.y);

            mask.setBlendFunc(GL11.GL_ZERO, GL11.GL_ONE_MINUS_SRC_ALPHA);
            mask.renderAtCenter(computePosition.x, computePosition.y);

            GL11.glColorMask(true, true, true, false);
            spin2.setBlendFunc(GL11.GL_DST_ALPHA, GL11.GL_ONE_MINUS_DST_ALPHA);
            spin2.setAngle(rotate2);
            spin2.renderAtCenter(spinPosition.x, spinPosition.y);
        }
[close]
« Last Edit: February 25, 2019, 11:00:11 AM by Alex »
Logged
My mods


Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4363 on: February 25, 2019, 12:22:06 PM »

Ok, so Intel Procurement missions seem fine from a few test runs.

Bar missions, however, are not.

It seems to find the market in the description U.I just fine, and points to the correct system. No NPC is generated at that market, however, and a quest market doesn't appear either.

Spoiler
[close]

Are these also handled in ProcurementMissionIntel? Or are bar events separate?


EDIT*

Well, they work if the destination market is a non-faction market. It is probably another case of me overriding MarketPostOpen unintentionally, so I'll have to find the entry for bar mission turn ins in Rules.

As it turns out, bar procurement missions don't generate a quest marker or npc ever. They just complete when you dock at the market.
« Last Edit: February 25, 2019, 12:50:49 PM by Morrokain »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24127
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4364 on: February 25, 2019, 12:57:48 PM »

I use OpenGL to make a mask come true and render it in renderInWorldCoords, but it seems the damage number renders before BaseEveryFrameCombatPlugin ???
could the render order be changed?

(Edited your post to add code=java to make it more readable, btw.)

You know, I might as well make it possible - I think a lot of mods might get some use out of this, and it's already doable in the campaign.

Added support for rendering at different layers in combat using a custom combat entity
   Added to CombatEngineAPI:
      void removeObject(Object object);
   void addLayeredRenderingPlugin(CombatLayeredRenderingPlugin plugin);
   Added CombatLayeredRenderingPlugin interface:
      public void init();
      public void cleanup();
      public boolean isExpired();
      public void advance(float amount);
      public EnumSet<CombatEngineLayers> getActiveLayers();
      public float getRenderRadius();
      public void render(CombatEngineLayers layer, ViewportAPI viewport);
   Added BaseCombatLayeredRenderingPlugin
   Added CombatEngineLayers enum


In action:
https://twitter.com/amosolov/status/1100136541576413189

Ok, so Intel Procurement missions seem fine from a few test runs.

Bar missions, however, are not.

It seems to find the market in the description U.I just fine, and points to the correct system. No NPC is generated at that market, however, and a quest market doesn't appear either.

Are these also handled in ProcurementMissionIntel? Or are bar events separate?


EDIT*

Well, they work if the destination market is a non-faction market. It is probably another case of me overriding MarketPostOpen unintentionally, so I'll have to find the entry for bar mission turn ins in Rules.

As it turns out, bar procurement missions don't generate a quest marker or npc ever. They just complete when you dock at the market.

Right, yes, bar missions are entirely separate. You can search for "delivery" in rules.csv - or for some of the text - should let you find the relevant rules pretty quick.
Logged
Pages: 1 ... 289 290 [291] 292 293 ... 710