Author Topic: Empire Script Data  (Read 796 times)

Azalrion

  • Delusional
  • ****
  • Posts: 1325
  • Karma: +147/-1
  • Memory Murderer
    • View Profile
Empire Script Data
« on: April 02, 2013, 01:12:49 PM »
I have a couple of questions about the Empire Script Data (from the regScriptData function).

In empire_ai.as it says you use the empireAITick function but I take it thats not longer true as pirate, remnant and ai all just have a tick function in the registered class?

Also in regards to the script class, I take it it handles loading using the constructor with an XML reader? When that's called have the Objects been recreated or will it be called before they have been loaded (is it called before or after the galaxy is loaded)?
GA - Mod Team
GA Forums

ibanix

  • Newbie
  • *
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Re: Empire Script Data
« Reply #1 on: April 02, 2013, 01:57:44 PM »
Funny, I was just looking at this myself.

I actually want to know how to set variables/effects on empires (including player empires) when they are first created, how do I do that?

Thy Reaper

  • BMS Lead Developer
  • BMS Administrator
  • Hopeless
  • *
  • Posts: 3237
  • Karma: +397/-8
    • View Profile
    • Blind Mind Studios
Re: Empire Script Data
« Reply #2 on: April 02, 2013, 06:30:08 PM »
It looks like the help text in that file wasn't kept up to date with changes. You only need a tick function in the AI for it to work.

registerEmpireData() is called before Objects are created. How each AI is constructed is up to empire_ai.as and the other files it uses.

Azalrion

  • Delusional
  • ****
  • Posts: 1325
  • Karma: +147/-1
  • Memory Murderer
    • View Profile
Re: Empire Script Data
« Reply #3 on: April 02, 2013, 06:38:35 PM »
So when save games are loaded i'll need to ensure that for any "tracked objects" I call getObjectByID outside of the constructor (say during the tick function) since I won't be able to guarantee that the ships have been loaded from the save file at that point?
« Last Edit: April 02, 2013, 06:44:13 PM by Azalrion »
GA - Mod Team
GA Forums

Thy Reaper

  • BMS Lead Developer
  • BMS Administrator
  • Hopeless
  • *
  • Posts: 3237
  • Karma: +397/-8
    • View Profile
    • Blind Mind Studios
Re: Empire Script Data
« Reply #4 on: April 02, 2013, 06:46:08 PM »
Loading is done a bit differently, it reaquires the scripts after objects are loaded. I don't know why it isn't done that way for the initial game setup.

Azalrion

  • Delusional
  • ****
  • Posts: 1325
  • Karma: +147/-1
  • Memory Murderer
    • View Profile
Re: Empire Script Data
« Reply #5 on: April 02, 2013, 06:47:29 PM »
Ah thats great, thanks Reaper.
GA - Mod Team
GA Forums