Eufloria > Eufloria Classic Mods

【Need Help!】How to get a certain seedling?

(1/3) > >>

Breakord:
How to get a certain seedling(as an object or something),and its attributes(posx, posy, en, st, sp)?
I've been struglling for several days and found nothing...

Thanks for any help!

sillytuna:
This classic or HD? Can't on HD, don't know if you can on classic...

Breakord:
sorry..classic 2.07 for PC

Pilchard123:
I think you can, but I can't remember how...

Aino:

--- Quote from: Pilchard123 on January 31, 2013, 02:44:28 AM ---I think you can, but I can't remember how...

--- End quote ---

You can, it has been done. I just don't remember where the topic is.
We'll just need to wait until either Alex comes along and wants to answer, or sillytuna finds the energy to open up the source and find the piece of codes.

EDIT:

Here: http://www.euflorium.com/index.php?topic=1395.msg10045#msg10045
Mihhaelo actually managed to use the system, but I think you'll have to experiement around for yourself, 'cause I don't think many others know how to fiddle around with the seedlings.

Good Luck :)

EDIT 2:

I'd guess this piece is responsible for finding the seedling:

--- Code: ---GetAsteroid(ID):Seedlings(2)[Number]
--- End code ---

A way to scan an asteroid would be:

--- Code: ---seedlings = {}
for i = 0, GetAsteroid(ID):GetNumSeedlings()-1 do
seedlings.link = GetAsteroid(ID):Seedling(2)[i];
end
--- End code ---

Using this simple code we might be able to extend it:


--- Code: ---function LevelSetup()

--Adding seedlings and doing globals and stuff...

--This array is the seedling array, each individual seedling is stored on this from 1 to 4000.
Seedlings = {};
NumberofAsteroids = [INSERT INT HERE, AND REMOVE THE BRACKETS];

end

function LevelLogic()

--A tick is a displayed frame, because of the VSync it's capped to 60 on most frames.

--Could use gameTime for this, but I felt like using ticks, probably a nice idea to use ticks to prevent heavy lags. Less ticks means longer time before it is executed.
gameTime = GetGameTime();
lastUpdate = 0;

while GameRunning() do

--Check that the game is not paused.
if (gameTime < GetGameTime()) then
gameTime = GetGameTime();
lastUpdate = lastUpdate + 1;

--Check if 60 ticks have passed
if (lastUpdate > 60) then
lastUpdate = 0;

--If 60 ticks have passed run a for loop through all the asteroids and do as following:
for roid = 0, NumberofAsteroids do
--Run another for loop through all the seedlings on the asteroid.
for i = 0, GetAsteroid(roid):GetNumSeedlings()-1 do
--Register the seedling, most important part
local Seed = GetAsteroid(roid):Seedling(2)[i];

--Set up while loop vars.
local count = 0;
local valid = true;

--Execute a while loop, becaus ewe got no idea how many seedlings are in the list currently. Could have kept a track, but I want to use some new methods than boring for loops :)
while Seedlings[count] ~= nil and valid do

--Here we check the seedling we scanned
if (Seedlings[count] == Seed) then
--If it's already on the list, set valid to false.
valid = false;
--This will stop the while loop and make it junp to the next seedling, or asteroid.
end

--Add another to the var Count, making it compare the scanned seedling with a new one.
count = count + 1;

--Notice how the while loop has no coroutine, this is because it's got a fair end. It won't take up much time and freeze the game because the game has no posibility to do other things (which is what an "endless" while loop normally does).
end

--Check if valid is still true
if valid then
--Still valid, which means this seedling doesn't exist on the list
Seedlings.link = Seed;
end
end

end
end
end
coroutine.yield();
end
end
--- End code ---

For the first time, I introduce you to my very first comments! I hope they help you use this :)

This code will check each second(if the game keeps up) for any new seedling across the board. If any new seedling is found it will be added. I think you'll need to find a way to remove them yourself, and then this code might not work anymore. I haven't tested this code either, but it will be a good framework for your project I hope :)

Navigation

[0] Message Index

[#] Next page

Go to full version