Euflorium: The Eufloria Community
Eufloria => Eufloria Classic => Eufloria Classic Mods => Topic started by: Aino on February 02, 2011, 10:04:24 PM
-
Is there anything that allows you to check if there is enemies on a certain asteroid?
-
Yes there is! :>
For example:
if GetAsteroid(0):GetNumSeedlings(2) > 1 then
-- do something cool!
end
That would check Asteroid ID 0, to see if there are more than 1 seedlings belonging to Empire 2.
:>
(so at least TWO seedlings would be required to activate this If... because it's looking for values greater than 1)
-
if you have
function CheckAttacks()
for i = 0,99 do
local a = GetAsteroid(i)
local b = a.Owner
local c = a.ID
if b == GetEmpire(1) then
if a:GetNumSeedlings(0) > 0 or a:GetNumSeedlings(2) > 0 or a:GetNumSeedlings(3) > 0 then
local timer = GetGameTime() + 0.5
while GetGameTime() < timer do
SetBackdropColor(122,0,0)
coroutine.yield()
end
SetBackdropColor(br,bg,bb)
end
end
end
end
it don't seem to work, any help on fixing the problem? :)
(Trying to add an attack warning for my map, since it is so large :D)
EDIT: maybe the owner thing for "b" should be considered as integer not empire result?
-
You are correct.
if b == GetEmpire(1) then
Should really be this:
if b == 1 then
Bizarelly, a.owner returns a number object, rather than an empire object. If you wanted an empire object instead you would need to use GetEmpire(b).
Hope this helps :> I'll see if I can spot anything else as well.
-
if b == GetEmpire(1) then
Should really be this:
if b == 1 then
Bizarelly, a.owner returns a number object, rather than an empire object. If you wanted an empire object instead you would need to use GetEmpire(b).
Hope this helps :> I'll see if I can spot anything else as well.
Yeah, fixed and working(tried before you posted). Thx, amybe releasing my map soon... Don't know cause my immagination just jumps around atm xD
-
I had that problem too, with "Return to Fluffy Land", which is the first level where I tried some proper scripting. The level got more and more crazy as you went through it (it was linear), as I learned more about the language and tried out all the different commands. I got a taste of what was to come... it bites you and doesn't let go.. :>
Looking forward to seeing your first release! :>
-
I just hope my map wont lag D:
-
Lag can be addressed, too.. :> There's usually some inefficiencies sneak into the algorithm of whatever you are doing, plus there's always options like local variables (which I note you are already using), avoiding expensive operations like math.sqrt (heh, squirt... actually it stands for square root), etc.
Give it some thorough testing when you're done, and if it's too laggy then we can help with that as well.. :>
-
If I want it to have a text flashing in the upper left corner of the screen, how do I do that? (Flashin red and white in a gray box :))
-
There's no support for drawing text, as far as I know. You'd have to carve out the letters yourself using DrawLine commands in function LevelDraw().
If you were going to the trouble of all that, you might as well just make a function that will let you write any series of characters from the whole alphabet. :> It's a project...
-
I'll might do that after my third map, after thinking of it it will be a big project(atleast for me xD)
Edit: I actually did this o.o
(http://4.bp.blogspot.com/-4WiHtkBC4rE/Tc2q7fs6t-I/AAAAAAAAAWo/3y9Ao86X5Hk/s1600/seed_yeah_meme.jpg)
if it is offending: sorry :/