Author Topic: Crash on New Game when using own mod  (Read 977 times)

WarpObscura

  • Newbie
  • *
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Crash on New Game when using own mod
« on: August 26, 2012, 06:39:59 AM »
I have a personal mod I'm trying to make. Recently I added some new Traits, along with code in Planets.as, Economy.as and Traits.as. After I did so...

What was witnessed:
Game crash on New Game.

What was expected:
New Game window should have opened.

Reproduction Steps:
  • Acquire mod, put in mods folder.
  • Click New Game.

Extra Files:
As attached (log already using verbose mode)

WarpObscura

  • Newbie
  • *
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Crash on New Game when using own mod
« Reply #1 on: August 27, 2012, 07:26:33 AM »
Okay, I manually went into last_setup.xml and set it back to standard game. Turns out that the thing still crashes when I try to select my mod. Did some renaming of mod files and it turns out that the crash only occurs when the changed traits.xml is present.

As for the log files, the crash occurs in between loading colours and the shipset icons. Not at traits.xml. What gives?

EDIT: Okay, going one-by-one over the added traits, this was the one that borked it up:
Code: [Select]
<trait id="greenpeace" name="Environmentalism" desc="Mining rate decreased to 66%, Ore consumption decreased to 40%." flavor="Past experiences with climate change and disasters caused by excessive mining have caused your people to become conservative resource users. Ore usage is decreased, but so is mining rate." cost="-1">
<conflict id="eusocial" /> <conflict id="capitalism" />
<hook type="alter" func="Traits::increaseMiningRate" arg0="0.66" />
<tag id="green_mining" /> <!-- Implemented in Economy.as -->
</trait>
Before you ask, I've already added the conflict ids in eusocial and capitalism and edited Economy.as appropriately. What's going on?
« Last Edit: August 27, 2012, 08:24:07 AM by WarpObscura »

Thy Reaper

  • BMS Lead Developer
  • BMS Administrator
  • Hopeless
  • *
  • Posts: 3237
  • Karma: +397/-8
    • View Profile
    • Blind Mind Studios
Re: Crash on New Game when using own mod
« Reply #2 on: August 27, 2012, 12:15:26 PM »
I've noticed in the past that the xml loader occasionally crashes when it parses comments. Try removing the <!-- Implemented in Economy.as --> and see if it works.

WarpObscura

  • Newbie
  • *
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Crash on New Game when using own mod
« Reply #3 on: August 28, 2012, 10:45:37 PM »
It didn't help.  :(

WarpObscura

  • Newbie
  • *
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Crash on New Game when using own mod
« Reply #4 on: August 30, 2012, 05:45:10 AM »
Okay, tried to remove the <conflict /> tags and it was okay. Is there something wrong with those?

GGLucas

  • Dr. Evil
  • BMS Staff
  • Delusional
  • *
  • Posts: 1877
  • Karma: +300/-6
    • View Profile
Re: Crash on New Game when using own mod
« Reply #5 on: August 30, 2012, 02:25:09 PM »
In the rar of your mod, you have this in traits:

Code: [Select]
<trait id="capitalism" name="#RT_CAPITALISM_NAME" desc="#RT_CAPITALISM_DESC" flavor="#RT_CAPITALISM_FLAVOR" cost="1">
<conflict id="eusocial" /> <conflict id="
greenpeace" /> <hook type="alter" func="Traits::increaseMiningRate" arg0="1.5" />

Note the line break in id="greenpeace". No trait "\ngreenpeace" exists (it should tell you this, rather than crash, obviously, but eh, null safety is overrated ;)). Put the conflict on one line and it'll work.

WarpObscura

  • Newbie
  • *
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Crash on New Game when using own mod
« Reply #6 on: August 31, 2012, 08:45:00 AM »
Wow, that was a really Derpy mistake I made.  :-[

Thanks! It works!