Euflorium: The Eufloria Community
Eufloria => Eufloria Classic => Eufloria Classic Mods => Topic started by: Aino on February 05, 2011, 04:30:35 AM
-
I'm making my map, I use some the shorten asteroids function of mine, but when I am going to plant a flower it wont allow me because of:
attempt to call method 'Plant' (a string value)
Why won't it work, I checked the Lua scripting in Eufloria - reference (http://www.dyson-game.com/smf/index.php?topic=212.0) and it says Plant(Structure tree) which says to me I should use the variable the tree is(or am I wrong??), usually used as s = a:AddDysonTree() or something...
-
Can you post the code you're using?
-
I think I figured it out, but here's the code:
function AddTree(roidnumber, treetype, treelevel)
if roidnumber == -1 then
roidnumber = roidnumb-1
end
if treetype == "dys" or treetype == "dyson" then
temptree = roid[roidnumber]:AddDysonTree()
elseif treetype == "def" or treetype == "defense" then
temptree = roid[roidnumber]:AddDefenseTree()
end
if treelevel > 0 and treelevel < 5 then
for treelevel = 1, treelevel do
temptree:LevelUp()
end
elseif treelevel == 5 then
for treelevel = 1, 4 do
temptree:LevelUp()
end
tempflower = temptree:AddFlower()
tempflower:GrowToMax()
tempflower:Pluck()
tempflower:Plant(temptree)
end
end
I was doing it to a defense tree, that may solve it?
So I might do something like this:
elseif treelevel == 5 then
for treelevel = 1, 4 do
temptree:LevelUp()
end
tempflower = temptree:AddFlower()
tempflower:GrowToMax()
tempflower:Pluck()
if treetype == "dys" or treetype == "dyson" then
tempflower:Plant(temptree)
end
end
??
-
I ran into similar problems when building IAIv2, and had to ask Alex for help. It's not obvious!
tree = nil
flower = nil
-- flower check !
tree = checkedroid:GetRandomDysonTree()
if tree ~= nil then
flower = tree:GetSuperSeedling()
end
if checkedroid.owner > 1 and flower ~= nil then
flower:Pluck()
end
flower = checkedroid:GetFlower(checkedroid.owner)
if checkedroid.owner > 1 and flower ~= nil then
flower:PlantOnRandomDysonTree()
end
"GetSuperSeedling" actually returns a flower. :P
Also the "Plant" command is "Plant on random dyson tree"