Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: Faction Relations and The Intel UI  (Read 1559 times)

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Faction Relations and The Intel UI
« on: June 03, 2015, 09:03:18 PM »

Basically, I want to:

1.  Change one Faction's relationship with another Faction.
2.  Have that relationship change be shown in the Intel screen and the Message UI, with a custom String <reason for the change in relationship>.

i.e., "<Faction> relations with <Faction> have gone <up/down> by <amount> due to <insert reason here> and are now <string indicator of current rep level>".

I need a generic method to do this that I can call in various places, like:

public void changeRelationship(FactionAPI factionOne, FactionAPI factionTwo, float delta, String reasonForChange){}

Right now, I am having a lot of trouble seeing how this system works under the hood; it's really very confusing how the game talks to the Intel system.  Any help on this would be appreciated.
« Last Edit: June 03, 2015, 09:05:05 PM by xenoargh »
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Faction Relations and The Intel UI
« Reply #1 on: June 05, 2015, 12:20:02 PM »

Hmm. So, the backend part of it - changing the relationship - you're going to want to do through FactionAPI.adjustRelationship().

For the intel/message UI, the basic flow you want is this:

1. Call Global.getSector().reportEventStage(). This requires that you a) have an event reference handy to call this from (i.e. you're probably going to want to do this from an event) and b) have a corresponding report in reports.csv, which will be used to create the message. This initiates the message being sent process; the player will receive it at some future point.

2. Pass in an OnMessageDeliveryScript implementation to reportEventStage(); probably best to do so by extending a BaseOnMessageDeliveryScript - see CustomsInspectionEvent for some examples. This lets you get a callback when the player finally receives the message, if they ever do.

3. In the beforeDelivery method of the script, you'll want to do two things - show a message in the message list UI in the campaign screen, and add some text to the "assessement" potion of the message itself, that you see in the "inbox" UI. For that, take a look at CoreReputationPlugin.addAdjustmentMessage() - it's a different use case (i.e. one faction is always the player), but it composes and puts those messages in the message list, assessment section, and interaction dialog text panel, whichever is appropriate for the params passed in.


Let me know if this makes sense; will be happy to answer in more detail where needed.
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Faction Relations and The Intel UI
« Reply #2 on: June 05, 2015, 01:21:27 PM »

That's making sense; thanks for taking the time to delineate between the implementation steps, I kept getting hung up on "what is message" and "what is event" in terms of the flow. 

I'll take a look at this and see whether I can get this feature implemented :)
Logged
Please check out my SS projects :)
Xeno's Mod Pack