Oh, internet issues prevent me to notify that I have already done it by slightly modifying Player_GetBlueprintCount function.
@Gambit, thanks man, but your code counts all complited buildings, but I needed specific, namely necron generators.
Here is my code (not actually my, 99% of it is relic code):
function Player_HasNumberOfBuildingsType( player, blueprintname ) local CountBlueprints = function(groupCaller, groupID) local blueprintCount = 0 local Counter = function(groupID, itemIndex, itemID) if (groupCaller.GetItemBlueprint(itemID) == blueprintname) then if Entity_IsBuilding(itemID) and Entity_GetBuildingProgress(itemID) >= 1.0 then blueprintCount = blueprintCount + 1 end end return true end groupCaller.ForEachAllOrAny(groupID, true, Counter) return blueprintCount end if( EBP_Exists( blueprintname ) ) then -- count entity blueprints return CountBlueprints( EGroupCaller, Player_GetEntities( player ) ) end error("Invalid blueprint name "..blueprintname ) end