Euflorium: The Eufloria Community

Eufloria => Eufloria Classic => Eufloria Classic Mods => Topic started by: Aino on February 06, 2011, 10:16:57 PM

Title: GraceTimer on custom empires?
Post by: Aino on February 06, 2011, 10:16:57 PM
Does this work:
Code: [Select]
GetEmpire(caiid).GraceTimer=(99999)
Because I think it doesn't, my AI plants flowers and doesn't follow it's rules, but I don't want the other AI to be frozen. So is there any correction?
Title: Re: GraceTimer on custom empires?
Post by: Pilchard123 on February 07, 2011, 01:22:56 AM
I think that you have to apply it to an asteroid.

SetGraceTime(float gracetime)    Sets the grace time for the current owner of the asteroid - stops the owner's AI from doing anything with the asteroid while the grace timer is still above 0.

Globals.AI.GraceTimer (int)    may also have some effect.
Title: Re: GraceTimer on custom empires?
Post by: Aino on February 07, 2011, 01:37:12 AM
SetGraceTime(float gracetime) will go to normal number after the roid is captured?

Scenario:
If Empire 2 owns the roid and the gracetime is set to an inf+++ number and when Empire 3 captures it then gracetimer goes back to normal, or will it stay the same?
Title: Re: GraceTimer on custom empires?
Post by: Pilchard123 on February 07, 2011, 02:38:41 AM
Ehh...No idea. You could always use OnAsteroidTaken() to reset it when it is captured.

Something like this:
Code: [Select]
function OnAsteroidTaken(id, owner)
     if id = 5 and owner ~= 1 then
          GetAsteroid(5):SetGraceTimer(600)
     end
end

That (I think) would set the Gracetime of Asteroid 5 to 600 seconds, unless the conquerer was the player. Whether the conquered AI will then start attacking it again, I don't know.

Globals.AI.GraceTimer=(9999999999999999999) would set the GraceTime of EVERY AI to such a ridiculously high number as to be infinite, and stop the game playing the AI at all. Math.huge is the Lua equivalent of infinity.
Title: Re: GraceTimer on custom empires?
Post by: Aino on February 07, 2011, 02:46:53 AM
Ok, so if I want to leave my AI to have gracetime to be a ridicilously high number(99999), what is then the normal gracetime for the normal ai?
Title: Re: GraceTimer on custom empires?
Post by: annikk.exe on February 07, 2011, 04:12:40 PM
Gracetimer is simply "how long should the default AI be switched off for?"

If you want them to become active as soon as an asteroid is taken, do it like this:

Code: [Select]
function OnAsteroidTaken(id, owner)

if owner == 2 then
-- default AI
GetAsteroid(id):SetGraceTime(0)
elseif owner == 3 then
-- my AI
GetAsteroid(id):SetGraceTime(99999)
end

end