Community Forum

FruitUtil.registerFruitType -> g_currentMission.fruits?

Forum Overview >> Scripting

CategoryScripting
Created06.05.2012 22:53


Thomas G. (gotchTOM) 06.05.2012 22:58
Hello,

i have a little problem with the mod-fruitTypes that are added to the game by the FruitUtil.registerFruitType.

Can it be that these fruitTypes are not stored in the table "g_currentMission.fruits"?

If i print the content of the table "g_currentMission.fruits" by using the following lines:

for i=1, table.getn(g_currentMission.fruits) do
if g_currentMission.fruits[i] ~= nil then
print(tostring(g_i18n:getText(FruitUtil.fruitIndexToDesc[i].name)));
end;
end;
print ("Anzahl vorhandener Fruchtarten in 'g_currentMission.fruits': "..tostring(table.getn(g_currentMission.fruits)));



i get the following result:

Weizen
Gerste
Raps
K├Ârnermais
Gras
Missing dryGrass in l10n_de.xml
Anzahl vorhandener Fruchtarten in 'g_currentMission.fruits': 6

The fruitType "greenwheat" that is added to the map is not listed.

if they are not stored in this table, in what table they are stored?


thanks in advance


D. Ecker (Decker_MMIV) 28.05.2012 19:19
Did you make sure, that your code which prints outs the fruits array, was run _after_ the "greenwheat" have been registered?

Try to put in a print statement, when the extra fruit(s) are registered. Then you will know if your code runs before or after.


Note: Log in to post. Create a new account here.