Author Topic: [SOLVED] Mechanoid colonize ability not working as expected.  (Read 786 times)

Yulgalminakf

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
So, I'm attempting to give the mechanoid colonization ability to someone other than a mechanoid. However, whenever I try this, the ability refuses to auto-cast unless the planet has an OVER population of at least one. I can see no hooks in the main ability to make this happen. I tried modifying the ability so it auto-casts on the list of auto-colonization planets with AutoOrderOnAutoColonizeTarget(), but that still doesn't work. It's as if somewhere buried deep in C++ code (or whatever language this was programmed in) there's a special set of code for this ability that tells it "if planet.currentPopulation > planet.maxPopulation then colonize()". However, I can see nowhere in the code we're allowed to look at where it forces the planet to have an over-population.
« Last Edit: June 23, 2015, 11:51:12 AM by Yulgalminakf »

dalolorn

  • Sentient
  • **
  • Posts: 199
  • Karma: +7/-0
  • ABEM Developer
    • View Profile
Re: Mechanoid colonize ability not working as expected.
« Reply #1 on: June 22, 2015, 04:17:23 AM »
C++ is just the game engine, this is in the region of scripts and coded in AngelScript. I think you should probably look into scripts/definitions/ability_effects.as to figure this out.

A quick glance at the code for the AutoCastAsColonizePopTransfer() hook in that file suggests that you're right:

Code: [Select]
if(abl.obj.population < maxPop + 1.0 - 0.001)
return;

Also, AutoOrderOnAutoColonizeTarget() was designed for Motherships.

Yulgalminakf

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Mechanoid colonize ability not working as expected.
« Reply #2 on: June 23, 2015, 10:58:50 AM »
Yeah, I found that already and now I'm overriding the entire file so I can add a second function that does what I want, Thanks :)
Fixed me problem.
« Last Edit: June 23, 2015, 11:51:26 AM by Yulgalminakf »

dalolorn

  • Sentient
  • **
  • Posts: 199
  • Karma: +7/-0
  • ABEM Developer
    • View Profile
Re: [SOLVED] Mechanoid colonize ability not working as expected.
« Reply #3 on: June 24, 2015, 04:36:29 AM »
Unnecessary and clunky for reasons I noted in the Remnant ship thread. (Except this isn't even a core script, so you REALLY have no excuse beyond ignorance. :P)

Create a new file in scripts/definitions - for example, Yulga_effects.as, and create your hooks in there. To call the hooks you create in Yulga_effects, simply prefix the hook name with Yulga_effects::, like this:

Code: [Select]
Yulga_effects::MyAutoCastAsColonizePopTransfer()

Yulgalminakf

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: [SOLVED] Mechanoid colonize ability not working as expected.
« Reply #4 on: June 27, 2015, 08:57:03 PM »
Oh, that seems a lot easier.