Jump to content

Vintagebob

Vintarian
  • Posts

    13
  • Joined

  • Last visited

Everything posted by Vintagebob

  1. I tested it, and it worked very well at me. Maybe the mistake is not in this code, but in the mod at its own. Can you send me the whole mod folder please? thx
  2. And instant an other problem, hehe, I make a mod, that includes corals to the game, but i cant spawn fishes in the corals! I think, because the corals are rare blocks and the vintagestory-mob-spawning system (maybe) picks out every tick a random block, the chance, that it picks a coral is very very low... even if i turn the spawn rate of the fishes to 1000 000, they do not spawn! Can someone help me, pls? : D
  3. Hello, Is there a way to make, that an entity goes to a specific block? For example that a pig goes to an oak planks block? I looked at the default AiTask getOutOfWater, bud i understood nothing xD. Maybe some of you can explain me what the code in this AiTask does, or you can say me, how i can do this in an easier way
  4. Thats much more difficult, because i can't change the spawn rate of the drifter in the code, i only can make, that when the drifter wants to spawn, there is a chance, that he nontheless isnt spawning. Sorry, that I can not help you here.
  5. Hello, im not a code wizard but something i can code too . Here is the codefile. It makes, that only the third part of the drifters, which spawn above the Y-Position 100, really spawn. You can open the file with the normal text-editor or a better programm and change the properties. Its written down there, where you must change. Dont forget to create a "src" folder next to the assets folder, change your modtype to "code" and change the drifterclass to th class "EntityDrifter". I've tested the mod out and even if you spawn a drifter with the spawnitem, there is a chance, that he does'nt spawn. In fact, the naturally spawning and the spawning with the item is the same. I hope i could help you, and sorry for my writing mistakes, im not english Class1.cs
  6. I asked this allready, but in the wrong forum, now again in the Modding questions Hello, im programming a Vintage Story mod and want do add hydrothermal vents to the game. The block itself works perfectly, but i can't generate these vents under the water :(. ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Here is my programm code in the .cs file: using System; using Vintagestory.API.Common; using Vintagestory.API.Common.Entities; using Vintagestory.API.MathTools; namespace omniummod { public class Omniummod : ModSystem { public override void Start(ICoreAPI api) { base.Start(api); api.RegisterBlockClass("hydrothermal_vent", typeof(hydrothermal_vent)); } } public class hydrothermal_vent : Block { Random random = new Random(); Block[] blocks; public override bool TryPlaceBlockForWorldGen(IBlockAccessor blockAccessor, BlockPos pos, BlockFacing onBlockFace, LCGRandom worldGenRand) { BlockPos belowPos = pos.DownCopy(); Block block = blockAccessor.GetBlock(belowPos); if (block.LiquidCode != "water") return false; int depth = 1; while (depth < 100) { belowPos.Down(); block = blockAccessor.GetBlock(belowPos); if (block.Fertility >= 0) { belowPos.Up(); PlaceVent(blockAccessor, belowPos, depth); return true; } else { if (!block.IsLiquid()) return false; } depth++; } return false; } private void PlaceVent(IBlockAccessor blockAccessor, BlockPos pos, int depth) { int height = Math.Min(depth - 1, 1 + random.Next(3) + random.Next(3)); AssetLocation assetl = new AssetLocation("omniummod", "blocktypes/deepwaterblocks/hydrothermal_vent"); blockAccessor.SetBlock(blockAccessor.GetBlock(assetl).BlockId, pos); } } } (some parts I copied from the Seaweed class ) ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Here is the .json file of the hydrothermal vent, if the problem ist not in the code but in the block: { code: "hydrothermal_vent", entityClass: "hydrothermal_vent", creativeinventory: { "general": ["*"] }, blockmaterial: "Stone", drawtype: "json", shape: { base: "block/deepwaterblocks/hydrothermal_vent*", }, storageFlags: 257, lightAbsorption: 0, sidesolid: { all: "false" }, sideopaque: { all: "false" }, resistance: 2.0, sounds: { "place": "game:block/stone", "walk": "game:block/stone" }, particleProperties: [ { hsvaColor: [{ avg: 0, var: 1 }, { avg: 0, var: 1 }, { avg: 0, var: 1 }, { avg: 0, var: 1 }], gravityEffect: { avg: -0.02, var: 0.01 }, posOffset: [ { avg: 0, var: 0.1 }, { avg: 0.5, var: 0.1 }, { avg: 0, var: 0.1 }], velocity: [ { avg: 0, var: 0.25 }, { avg: 0.1, var: 0.1 }, { avg: 0, var: 0.25 }], quantity: { avg: 1, var: 1 }, size: { avg: 5, var: 1 }, sizeEvolve: { transform: "quadratic", factor: 0.5 }, lifeLength: { avg: 3, var: 1 }, vertexFlags: 128 } ], guiTransform: { rotation: { x: -22.6, y: -145, z: 0 } }, tpHandTransform: { translation: { x: -2.1, y: -1.4, z: -1.5 }, rotation: { x: 0, y: 17, z: -88 } }, groundTransform: { translation: { x: 0, y: 0, z: 0 }, rotation: { x: -58, y: -45, z: 0 }, origin: { x: 0.5, y: 0, z: 0.5 }, scale: 1.5 } } ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- And here is the .json worldgen file, where I make the hydrothermal vent - blockpatch: { chanceMultiplier: { dist: "uniform", avg: 2.5, var: 2 }, patches: [ { comment: "Large patches of hydrothermal vent", blockCodes: ["hydrothermal_vent"], quantity: { avg: 25, var: 15 }, offsetX: { avg: 0, var: 12 }, offsetZ: { avg: 0, var: 12 }, chance: 1, minWaterDepth: 1, placement: "UnderWater" }, ] } its copied from the Seaweed blockpatch... ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- I hope someone will be able to help me and thank you in advance
  7. Yes, if you safe your mod there, it has to be .zip-compressed. Its right to safe it in this folder, but to programm mods you can also use this path: "folder, were your vintage story.exe is installed/Mods" . In this folder the mod can be normal, not .zipp-ed. Hopefully it will work now.
  8. I dont know, were the problem is, in my oppinion all is right, but can you say, were do you safe you mod to test it? In wich folder? And maybe it is, because bth is writte down in capital letters, and this is not so good in vintage story. And can you say me speciffically, wat doesnt work?
  9. Hello, im programming a Vintage Story mod and want do add hydrothermal vents to the game. The block itself works perfectly, but i can't generate these vents under the water :(. ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Here is my programm code in the .cs file: using System; using Vintagestory.API.Common; using Vintagestory.API.Common.Entities; using Vintagestory.API.MathTools; namespace omniummod { public class Omniummod : ModSystem { public override void Start(ICoreAPI api) { base.Start(api); api.RegisterBlockClass("hydrothermal_vent", typeof(hydrothermal_vent)); } } public class hydrothermal_vent : Block { Random random = new Random(); Block[] blocks; public override bool TryPlaceBlockForWorldGen(IBlockAccessor blockAccessor, BlockPos pos, BlockFacing onBlockFace, LCGRandom worldGenRand) { BlockPos belowPos = pos.DownCopy(); Block block = blockAccessor.GetBlock(belowPos); if (block.LiquidCode != "water") return false; int depth = 1; while (depth < 100) { belowPos.Down(); block = blockAccessor.GetBlock(belowPos); if (block.Fertility >= 0) { belowPos.Up(); PlaceVent(blockAccessor, belowPos, depth); return true; } else { if (!block.IsLiquid()) return false; } depth++; } return false; } private void PlaceVent(IBlockAccessor blockAccessor, BlockPos pos, int depth) { int height = Math.Min(depth - 1, 1 + random.Next(3) + random.Next(3)); AssetLocation assetl = new AssetLocation("omniummod", "blocktypes/deepwaterblocks/hydrothermal_vent"); blockAccessor.SetBlock(blockAccessor.GetBlock(assetl).BlockId, pos); } } } (some parts I copied from the Seaweed class ) ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Here is the .json file of the hydrothermal vent, if the problem ist not in the code but in the block: { code: "hydrothermal_vent", entityClass: "hydrothermal_vent", creativeinventory: { "general": ["*"] }, blockmaterial: "Stone", drawtype: "json", shape: { base: "block/deepwaterblocks/hydrothermal_vent*", }, storageFlags: 257, lightAbsorption: 0, sidesolid: { all: "false" }, sideopaque: { all: "false" }, resistance: 2.0, sounds: { "place": "game:block/stone", "walk": "game:block/stone" }, particleProperties: [ { hsvaColor: [{ avg: 0, var: 1 }, { avg: 0, var: 1 }, { avg: 0, var: 1 }, { avg: 0, var: 1 }], gravityEffect: { avg: -0.02, var: 0.01 }, posOffset: [ { avg: 0, var: 0.1 }, { avg: 0.5, var: 0.1 }, { avg: 0, var: 0.1 }], velocity: [ { avg: 0, var: 0.25 }, { avg: 0.1, var: 0.1 }, { avg: 0, var: 0.25 }], quantity: { avg: 1, var: 1 }, size: { avg: 5, var: 1 }, sizeEvolve: { transform: "quadratic", factor: 0.5 }, lifeLength: { avg: 3, var: 1 }, vertexFlags: 128 } ], guiTransform: { rotation: { x: -22.6, y: -145, z: 0 } }, tpHandTransform: { translation: { x: -2.1, y: -1.4, z: -1.5 }, rotation: { x: 0, y: 17, z: -88 } }, groundTransform: { translation: { x: 0, y: 0, z: 0 }, rotation: { x: -58, y: -45, z: 0 }, origin: { x: 0.5, y: 0, z: 0.5 }, scale: 1.5 } } ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- And here is the .json worldgen file, where I make the hydrothermal vent - blockpatch: { chanceMultiplier: { dist: "uniform", avg: 2.5, var: 2 }, patches: [ { comment: "Large patches of hydrothermal vent", blockCodes: ["hydrothermal_vent"], quantity: { avg: 25, var: 15 }, offsetX: { avg: 0, var: 12 }, offsetZ: { avg: 0, var: 12 }, chance: 1, minWaterDepth: 1, placement: "UnderWater" }, ] } its copied from the Seaweed blockpatch... ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- I hope someone will be able to help me and thank you in advance
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.