![]() |
|
OnSpawningEntity - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Plugins (https://forum.cuberite.org/forum-1.html) +--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html) +--- Thread: OnSpawningEntity (/thread-1213.html) |
OnSpawningEntity - tonibm19 - 08-09-2013 I'm trying to make a plugin that makes sure mobs spawn in the right biome. Here's the code. Code: function OnSpawningEntity(World, Entity)I don't get any error in console RE: OnSpawningEntity - NiLSPACE - 08-09-2013 try some debugging like use print(Entity:GetClass())to see what it returns etc. RE: OnSpawningEntity - bearbin - 08-09-2013 Are there named constants for biomes? If so, you should use them. Also, wolves can spawn in tundra and forest AFAIK. RE: OnSpawningEntity - tonibm19 - 08-09-2013 I tried with this: Code: function OnSpawningEntity(World, Entity)Now it work, but when entity is destroyed, you see it, and can't interact with it. It seems entity is removed from server but not from client. Code: Code: function OnSpawnedEntity(World, Entity)RE: OnSpawningEntity - xoft - 08-09-2013 Use the OnSpawningEntity() hook and return true if you don't want the entity to spawn. Also, as Bearbin said, use named constants for biomes: biForest, biTundra etc. Here's a list: biOcean = 0, biPlains = 1, biDesert = 2, biExtremeHills = 3, biForest = 4, biTaiga = 5, biSwampland = 6, biRiver = 7, biHell = 8, // same as Nether biNether = 8, biSky = 9, biFrozenOcean = 10, biFrozenRiver = 11, biIcePlains = 12, biTundra = 12, // same as Ice Plains biIceMountains = 13, biMushroomIsland = 14, biMushroomShore = 15, biBeach = 16, biDesertHills = 17, biForestHills = 18, biTaigaHills = 19, biExtremeHillsEdge = 20, biJungle = 21, biJungleHills = 22, RE: OnSpawningEntity - NiLSPACE - 08-09-2013 But with OnSpawningEntity the entity hasn't spawned yet so he could not get the coords with the cEntity:GetPos() functions. RE: OnSpawningEntity - bearbin - 08-09-2013 It seemed to work in his examples above. RE: OnSpawningEntity - xoft - 08-10-2013 The entity hasn't spawned, but its coords should already be valid. The hook is supposed to make that available, so that plugins may nudge the entity a bit. |