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)

Author Topic: What's the "correct" way to programmatically spawn system bounties?  (Read 1688 times)

kazi

  • Admiral
  • *****
  • Posts: 714
    • View Profile

I'm trying to spawn a bounty using the following code:

Code: Java
bounty = sector.getEventManager().primeEvent(new CampaignEventTarget(market), Events.SYSTEM_BOUNTY, null);
bounty.startEvent();

It works, but the bounty literally never ends, and goes on for the length of the game. Which leads me to believe that there is a "correct" way to spawn a bounty programmatically and that this is not it. How do I get the bounties to automatically disappear once they're done.

This code ends the bounty (stops payout and rep gains), but leaves the bounty notification up permanently in the Intel map - so it looks like the bounty is present when in fact it no longer is going on. To make matters worse, bounties never spawn on that market again.

What's the proper way to spawn bounties?
Logged

kazi

  • Admiral
  • *****
  • Posts: 714
    • View Profile
Re: What's the "correct" way to programmatically spawn system bounties?
« Reply #1 on: December 11, 2015, 01:36:39 AM »

Nvm. solved.
Logged

rogerbacon

  • Commander
  • ***
  • Posts: 142
    • View Profile
Re: What's the "correct" way to programmatically spawn system bounties?
« Reply #2 on: December 11, 2015, 07:07:51 AM »

Nvm. solved.
Instead of just saying solved you might want to post the solution. Expand the knowledge base.
Logged

kazi

  • Admiral
  • *****
  • Posts: 714
    • View Profile
Re: What's the "correct" way to programmatically spawn system bounties?
« Reply #3 on: December 11, 2015, 04:46:32 PM »

Heh alright- I was adding bounties during the system generation pass, which appears to have been before the stuff capable of handling bounties had been initialized. Waiting 60 days or so (economy stabilization period), then running the aforesaid code, does work.

This is the version of the code I ended up settling on.
Code: Java
sector.getEventManager().startEvent(new CampaignEventTarget(market), Events.SYSTEM_BOUNTY, null);  
Logged