tyoud 0 Posted July 2, 2019 Hi, I'm using @BuilderItems mod http://steamcommunity.com/sharedfiles/filedetails/?id=1565871491 and mods like BalotaApocalypticCity http://steamcommunity.com/sharedfiles/filedetails/?id=1718292668 ## Why do you care ? ## If you ever wanted DayZ to look like a looted, clapped out world, way way way past the point of no return, where cities are not sanctuaries, they are totally trashed, zombies roam, garbage everywhere, shocking sights, looks like houses have been emptied, and the towns are basically unbelievable ruins, then these are the mods for you! * small problem, the DayZ server has some kind of object limit and if you load all the mods, you run into it. ### How does this work and what's the Problem ### Some objects which you should be able to walk through, like bushes, you can't They're getting spawned in and I can't seem to find a way to spawn them so that they don't block your way. Even better would be if the bushes spawned in as bushes you could walk through, cut down, and make noise when you run through them. But then I would want water wells to work, and maybe other things... So either that, or a way to load the objects as just "no collision" type objects. Sounds easy? Maybe it is, but I've tried coding what I can. How can I spawn objects and make it so a player can run right through them. It's okay if they can't interact at all with the object, since then I could use that for more things, ##### in general, the "Apocalyptic City" mods, what they do is they have a .c file of their own (they're not truly a "mod" that part is just server side, so it's kind of a mod) and in that file is typically a special function that is just a long list of things like, example here's some plants at Solnichy at the north end of town, near the gas station sign. SpawnObject("bldr_plnt_c_Vaccinium_tall", "13468.420898 6.248019 6293.973633", "0.000000 0.000000 -0.000000"); SpawnObject("bldr_plnt_c_Vaccinium_tall", "13459.809570 6.278163 6295.364258", "0.000000 0.000000 -0.000000"); SpawnObject("bldr_plnt_c_Vaccinium_tall", "13457.499023 6.430161 6303.888672", "0.000000 0.000000 -0.000000"); SpawnObject("bldr_plnt_c_Lolium", "13465.001953 6.472421 6306.389160", "0.000000 0.000000 -0.000000"); SpawnObject("bldr_plnt_c_Lolium", "13461.926758 6.509012 6308.400879", "0.000000 0.000000 -0.000000"); SpawnObject("bldr_plnt_c_Lolium", "13460.630859 6.580079 6312.842285", "0.000000 0.000000 -0.000000"); SpawnObject("bldr_plnt_c_Lolium", "13469.335938 6.583668 6313.066895", "0.000000 0.000000 -0.000000"); And the spawned objects code gets put into init.c above main, and right before the end of main, you call the function over in a different .c file: SolnichyApocalipticCity(); SpawnObject() is a function they made up, and they made a couple of versions of it depending on the instructions you read for any given "Apocalyptic mod", you seem to be able to use either one, as they both seem somewhat similar in effect: void SpawnObject( string type, vector position, vector orientation ) { auto obj = GetGame().CreateObject( type, position ); obj.SetPosition( position ); obj.SetOrientation( orientation ); //Force collision update vector roll = obj.GetOrientation(); roll [ 2 ] = roll [ 2 ] - 1; obj.SetOrientation( roll ); roll [ 2 ] = roll [ 2 ] + 1; obj.SetOrientation( roll ); } #or use this one: ## void SpawnObject(string objectName, vector position, vector orientation) { Object obj; obj = Object.Cast(GetGame().CreateObject(objectName, "0 0 0")); obj.SetPosition(position); obj.SetOrientation(orientation); // Force update collisions if (obj.CanAffectPathgraph()) { obj.SetAffectPathgraph(true, false); GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(GetGame().UpdatePathgraphRegionByObject, 100, false, obj); } } ########################## Now what is the problem? The problem is that you can't run through bushes! They block you like a solid object, like a rock. And it's kind of off-putting. I'm trying to fix it, here's my kludge - what I'm looking for is some way to spawn an object and NOT collide with it, and I'm just not having any luck. void SpawnObject( string type, vector position, vector orientation ) { //Force collision update // (kind of borrow this code below...) // vector roll = obj.GetOrientation(); // roll [ 2 ] = roll [ 2 ] - 1; // obj.SetOrientation( roll ); // roll [ 2 ] = roll [ 2 ] + 1; // obj.SetOrientation( roll ); // Force update collisions // .... unless this is a shrub or something // code adapted from the Prison Island No Wrecks addon instructions file // this lets you run through shrubs switch(type) { // wild attempt to make bushes you can run through // http://lystic.net/dayzwiki/dd/d41/_core_2_inherited_2_plant_8c_source.html // // the main problem with standard BuilderItems was that these plants block your movement // but minor second problem, they are not really bushes you can cut down and interact with like a normal bush // // we want to make it so we don't collide with these when we run around // the key idea is that BushSoft as an object type extends other types like Plants in some way // and those things are bushes, so maybe we can run through them and cut them down? // case "DEBUG-try-not-to-collide": // PLACEHOLDER case "bldr_plnt_b_betulaHumilis_1s": // little golden bush, about a 1m high, 2m wide, you should be able to run through it - but you collide case "bldr_plnt_b_corylusAvellana_1f": // gold and rust colored shrub, about 1.5m high, 2m wide - still collides case "bldr_plnt_p_heracleum": // definitely yarrow - green on bottom, white top, 1m tall - no collision case "bldr_plnt_c_Vaccinium_tall": // very tiny scrubby little almost black plants, less than .5m tall auto BushSoft bush_obj = GetGame().CreateObject( type, position ); bush_obj.SetPosition( position ); bush_obj.SetOrientation( orientation ); if (bush_obj.CanAffectPathgraph()) { bush_obj.SetAffectPathgraph(false, false); GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(GetGame().UpdatePathgraphRegionByObject, 100, false, obj); } break; // if this weird object, then rotate it to help you find it case "DEBUG-rotate-this-strange-object": // PLACEHOLDER // auto obj = GetGame().CreateObject( type, position ); // obj.SetPosition( position ); // obj.SetOrientation( orientation ); // vector roll = obj.GetOrientation(); // roll [ 2 ] = roll [ 2 ] - 1; // obj.SetOrientation( roll ); // roll [ 2 ] = roll [ 2 ] + 1; // obj.SetOrientation( roll ); break; // collide with all other things for now default: auto obj = GetGame().CreateObject( type, position ); obj.SetPosition( position ); obj.SetOrientation( orientation ); if (obj.CanAffectPathgraph()) { obj.SetAffectPathgraph(true, false); GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(GetGame().UpdatePathgraphRegionByObject, 100, false, obj); } break; } } Share this post Link to post Share on other sites
tyoud 0 Posted July 2, 2019 I got the idea for trying to spawn a bush not as a generic object but as a "BushSoft" in the hope that IsBush() would return true and you could run through the object and things like that. I saw this code for spawning a vehicle and I noticed it was an EntityAI instead of just a normal game object, so that gave me the idea: case "offroad": { SendMessageToPlayer(player, "[Offroad] Vehicled spawned"); EntityAI v; v = GetGame().CreateObject( "OffroadHatchback", player.GetPosition() + "1.5 0 1.5"); v.GetInventory().CreateAttachment("SparkPlug"); v.GetInventory().CreateAttachment("EngineBelt"); v.GetInventory().CreateAttachment("CarBattery"); v.GetInventory().CreateAttachment("HatchbackHood"); v.GetInventory().CreateAttachment("HatchbackTrunk"); v.GetInventory().CreateAttachment("HatchbackDoors_CoDriver"); v.GetInventory().CreateAttachment("HatchbackWheel"); v.GetInventory().CreateAttachment("HatchbackWheel"); v.GetInventory().CreateAttachment("HatchbackWheel"); v.GetInventory().CreateAttachment("HatchbackWheel"); v.GetInventory().CreateAttachment("HatchbackWheel"); // spare break; } Is there some kind of object type which can give me an object you can run through? Like the object is a mirage. So when I spawn it, this works? Thanks Share this post Link to post Share on other sites