Category | Editor |
Created | 09.04.2017 07:34 |
Brandt Sarver (Unknown) | 09.04.2017 07:43 |
---|---|
I edited the base map of gold crest it was all working fine, i would work on the map the put it in the game then take it out and work on it in GE and then put it back in the game to test it out and so on, but the last time i did it and tried to start a new save game its gets stuck on the loading screen, i dont know whats wrong, the scripts show a couple errors how do i fix this problem, i dont know how to do scripts more or less fix them. please help i worked hard on this map. |
Andy .... (Unknown) | 10.04.2017 04:54 |
---|---|
You will need to post the log errors for us to be able to help :-) |
Brandt Sarver (Unknown) | 10.04.2017 23:26 |
---|---|
local sceneRoot = getChildAt(getRootNode(), 0); local terrainNode = getChild(sceneRoot, "terrain"); if terrainNode ~= 0 then local terrainDetailHeightId = getTerrainDetailByName(terrainNode, "terrainDetailHeight"); if terrainDetailHeightId ~= 0 then local terrainHalfSize = getTerrainSize(terrainNode)*0.5; local densitySize = getDensityMapSize(terrainDetailHeightId); local collisionMap = createBitVectorMap("CollisionMap"); loadBitVectorMapNew(collisionMap, densitySize, densitySize, 2, false); print("Generating collision map"); updateTerrainCollisionMap(collisionMap, terrainNode, "tipCol", 0, 524288, -terrainHalfSize, -terrainHalfSize, terrainHalfSize, terrainHalfSize); local filename = getSceneFilename(); filename = filename..".colMap.grle"; print("Saving collision map to "..filename); saveBitVectorMapToFile(collisionMap, filename); else print("Error: Failed to find terrain detail height node"); end else print("Error: Failed to find terrain node"); end This is the first one local bitMapSize = 16384 local node = getSelection(0) if node == 0 or getUserAttribute(node, "onCreate") ~= "FieldDefinition.onCreate" then print("Error: Please select fieldDefinitions root!") return end local terrainNode = 0 local numChildren = getNumOfChildren(getChildAt(getRootNode(), 0)) for i=0, numChildren-1 do local t = getChildAt(getChildAt(getRootNode(), 0), i) if getHasClassId(t, ClassIds.TERRAIN_TRANSFORM_GROUP) then terrainNode = t break; end end if terrainNode == 0 then print("Error: terrain not found!") return end local terrainSize = getTerrainSize(terrainNode) function convertWorldToFieldOwnershipPosition(x,z) return math.floor(bitMapSize * (x+terrainSize*0.5) / terrainSize), math.floor(bitMapSize * (z+terrainSize*0.5) / terrainSize) end function pixelToHa(area) local pixelToSqm = terrainSize/bitMapSize return (area*pixelToSqm*pixelToSqm) / 10000; end for i=0, getNumOfChildren(node)-1 do local field = getChildAt(node, i) if getUserAttribute(field, "fieldArea") ~= nil then local sumPixel = 0 local dimensions = getChild(field, "fieldDimensions") local bitVector = createBitVectorMap("field") loadBitVectorMapNew(bitVector, bitMapSize, bitMapSize, 1, true) for j=0, getNumOfChildren(dimensions)-1 do local dimension = getChildAt(dimensions, j) local width = dimension local start = getChildAt(width, 0) local height = getChildAt(width, 1) local x,_,z = getWorldTranslation(start) local widthX,_,widthZ = getWorldTranslation(width) local heightX,_,heightZ = getWorldTranslation(height) local x,z = convertWorldToFieldOwnershipPosition(x,z) local widthX,widthZ = convertWorldToFieldOwnershipPosition(widthX,widthZ) local heightX,heightZ = convertWorldToFieldOwnershipPosition(heightX,heightZ) sumPixel = sumPixel + setBitVectorMapParallelogram(bitVector, x, z, widthX-x, widthZ-z, heightX-x, heightZ-z, 0, 1, 0) end print(string.format("%s : %.3f ha", getName(field), pixelToHa(sumPixel))) local ha = pixelToHa(sumPixel) setUserAttribute(field, "fieldArea", "Float", ha) delete(bitVector); end end print("Successfully set fieldArea attributes!") this is the 2nd one function toggleRenderFieldAreas_drawCallback() local r,g,b,a = 0,0.1,1,0.4; local fieldsNode = g_renderFieldAreasDrawFieldDefinition; local terrain = getChild(getChildAt(getRootNode(), 0), "terrain"); if terrain ~= 0 and fieldsNode ~= nil then local numFields = getNumOfChildren(fieldsNode); for i=0, numFields-1 do local fieldNode = getChildAt(fieldsNode, i); local dimensionsNode = getChild(fieldNode, "fieldDimensions"); if dimensionsNode ~= 0 then local numDimensions = getNumOfChildren(dimensionsNode); for d=0, numDimensions-1 do local dimNode = getChildAt(dimensionsNode, d); if getNumOfChildren(dimNode) >= 2 then local dimNode1 = getChildAt(dimNode, 0); local dimNode2 = getChildAt(dimNode, 1); local x,y,z = getWorldTranslation(dimNode); local x1,y1,z1 = getWorldTranslation(dimNode1); local x2,y2,z2 = getWorldTranslation(dimNode2); local x3,y3,z3 = x+x2-x1, y+y2-y1, z+z2-z1; if terrain ~= 0 then y = getTerrainHeightAtWorldPos(terrain, x,y,z); y1 = getTerrainHeightAtWorldPos(terrain, x1,y1,z1); y2 = getTerrainHeightAtWorldPos(terrain, x2,y2,z2); y3 = getTerrainHeightAtWorldPos(terrain, x3,y3,z3); end drawDebugTriangle(x,y,z, x1,y1,z1, x2,y2,z2, r,g,b,a, false); drawDebugTriangle(x,y,z, x2,y2,z2, x3,y3,z3, r,g,b,a, false); drawDebugTriangle(x,y,z, x2,y2,z2, x1,y1,z1, r,g,b,a, false); drawDebugTriangle(x,y,z, x3,y3,z3, x2,y2,z2, r,g,b,a, false); --drawDebugLine end end end end end end if g_renderFieldAreasDrawCallback ~= nil then removeDrawListener(g_renderFieldAreasDrawCallback); g_renderFieldAreasDrawCallback = nil; g_renderFieldAreasDrawFieldDefinition = nil else local node = getSelection(0) if node == 0 or getUserAttribute(node, "onCreate") ~= "FieldDefinition.onCreate" then print("Error: Please select fieldDefinitions root!") return end g_renderFieldAreasDrawFieldDefinition = node; g_renderFieldAreasDrawCallback = addDrawListener("toggleRenderFieldAreas_drawCallback"); end this is the 3rd |
Emil Drefers (Unknown) | 12.04.2017 06:54 |
---|---|
Hi, the actual error messages might help to find the reason for your problems. Cheers, Emil |
Note: Log in to post. Create a new account here.