ZombieCooKie 10 Posted December 27, 2018 (edited) Because of the bug I decidet to spawn ready-to-drive cars on my server, so the players keep playing. There are four cars that spawn on every serverstart. If there is a car from previous start then it gets deleted before the new spawn. Just place this code at the end of the void main() in your init.c ref array<Object> nearest_objects = new array<Object>; ref array<CargoBase> proxy_cargos = new array<CargoBase>; int c_count; int c_count2; Car c_ada; TVectorArray c_positions = { "13292.6 5.99211 3987.3", "1844.24 5.71016 2121.89", "1980.96 258.426 7397.11", "12179.8 95.2326 13774.4", }; for (c_count2=0; c_count2 < c_positions.Count(); c_count2++) { GetGame().GetObjectsAtPosition ( c_positions[c_count2], 10, nearest_objects, proxy_cargos ); for (c_count = 0; c_count < nearest_objects.Count(); c_count++) { if (nearest_objects.Get(c_count).IsKindOf("CarScript")) { c_ada = Car.Cast(nearest_objects[c_count]); GetGame().ObjectDelete(c_ada); } } c_ada = Car.Cast(GetGame().CreateObject( "OffroadHatchback", c_positions[c_count2], false, true, true )); c_ada.GetInventory().CreateAttachment("HatchbackHood"); c_ada.GetInventory().CreateAttachment("HatchbackTrunk"); c_ada.GetInventory().CreateAttachment("HatchbackDoors_CoDriver"); c_ada.GetInventory().CreateAttachment("HatchbackWheel"); c_ada.GetInventory().CreateAttachment("HatchbackWheel"); c_ada.GetInventory().CreateAttachment("HatchbackWheel"); c_ada.GetInventory().CreateAttachment("HatchbackWheel"); c_ada.GetInventory().CreateAttachment("SparkPlug"); c_ada.GetInventory().CreateAttachment("EngineBelt"); c_ada.GetInventory().CreateAttachment("CarRadiator"); c_ada.GetInventory().CreateAttachment("CarBattery"); c_ada.Fill( CarFluid.FUEL, c_ada.GetFluidCapacity( CarFluid.FUEL ) ); c_ada.Fill( CarFluid.OIL, c_ada.GetFluidCapacity( CarFluid.OIL ) ); c_ada.Fill( CarFluid.BRAKE, c_ada.GetFluidCapacity( CarFluid.BRAKE ) ); c_ada.Fill( CarFluid.COOLANT, c_ada.GetFluidCapacity( CarFluid.COOLANT ) ); } The positions are Cernaya Polana, Myshkino, Kamenka and the houses on the street near Krutoy Cap. You can edit the positions in the code. Hope that helps to keep players playing. Edited December 27, 2018 by ZombieCooKie 1 Share this post Link to post Share on other sites
choppinbroccoli 10 Posted December 27, 2018 Thanks for this, I will try this out Share this post Link to post Share on other sites
ZombieCooKie 10 Posted December 27, 2018 Edited because forgot the radiator Share this post Link to post Share on other sites
NTX_Nitrix 6 Posted December 27, 2018 Just put the height of the vehicles at 0.0, I have 40 vehicles, find, repair and drive. Share this post Link to post Share on other sites
ZombieCooKie 10 Posted December 27, 2018 (edited) Maybe the height can be 0.0. The coordinates in the code are verified to work. Never change a running system :) Edited December 27, 2018 by ZombieCooKie Share this post Link to post Share on other sites
NTX_Nitrix 6 Posted December 28, 2018 (edited) What do you mean that the coordinates are verified to work? these? <event name = "VehicleOffroadHatchback"> <pos x = "10967.148438" z = "5494.307616" a = "125.181313" /> <pos x = "11534.269531" z = "5014.221679" a = "150.176453" /> <pos x = "12896.135743" z = "4453.044923" a = "334.011871" /> <pos x = "9585.212891" z = "13396.000976" a = "87.996712" /> <pos x = "14034.884766" z = "14716.9209" a = "325.213226" /> </ event> It seems that all do not work because many vehicles are underground also tested without mods. Personally I prefer that the vehicles are on the ground what to put fixed vehicles There are 80 spawn for random Hatchback is better than putting vehicles in fixed locations but this is just my opinion and what the server is supposed to do. Edited December 28, 2018 by NTX_Nitrix Share this post Link to post Share on other sites
choppinbroccoli 10 Posted December 28, 2018 3 hours ago, NTX_Nitrix said: What do you mean that the coordinates are verified to work? these? <event name = "VehicleOffroadHatchback"> <pos x = "10967.148438" z = "5494.307616" a = "125.181313" /> <pos x = "11534.269531" z = "5014.221679" a = "150.176453" /> <pos x = "12896.135743" z = "4453.044923" a = "334.011871" /> <pos x = "9585.212891" z = "13396.000976" a = "87.996712" /> <pos x = "14034.884766" z = "14716.9209" a = "325.213226" /> </ event> It seems that all do not work because many vehicles are underground also tested without mods. Personally I prefer that the vehicles are on the ground what to put fixed vehicles There are 80 spawn for random hatback is better than putting vehicles in fixed locations but this is just my opinion and what the server is supposed to do. Guess there is no fix for vehicles until devs fix them is the way I take this Share this post Link to post Share on other sites
g4borg 74 Posted January 2, 2019 (edited) My main problem with this is, that the cars spawned like this disappear, once they get driven by players. I mean it is a neat way to have one-way cars. Also what is the last boolean in .CreateObject( "OffroadHatchback", c_positions[c_count2], false, true, true ) doing? It is not documented. Also, for anyone having the issue of exploding double cars, this script needs to run a bit delayed to OnInit. Edited January 2, 2019 by g4borg Share this post Link to post Share on other sites
ChawDinky 7 Posted January 2, 2019 6 hours ago, g4borg said: My main problem with this is, that the cars spawned like this disappear, once they get driven by players. I mean it is a neat way to have one-way cars. Also what is the last boolean in .CreateObject( "OffroadHatchback", c_positions[c_count2], false, true, true ) doing? It is not documented. Also, for anyone having the issue of exploding double cars, this script needs to run a bit delayed to OnInit. Cars despawn because you need to go into types.xml and change the lifetime of the Hatchbackoffroad to 388000 Share this post Link to post Share on other sites
g4borg 74 Posted January 2, 2019 3 hours ago, ChawDinky said: Cars despawn because you need to go into types.xml and change the lifetime of the Hatchbackoffroad to 388000 thanx. you know what unit lifetime has? seconds? Share this post Link to post Share on other sites
ut marsian 2 Posted January 5, 2019 Well, I don't get it, but ... Would it be possible to iterate all existing vehicles and correct the position ("On ground") ? ( At the moment my "Ready to Run" vehicles also stuck in ground. With the effect, if you drive close to them, they explode and are ruined ). Share this post Link to post Share on other sites
NTX_Nitrix 6 Posted January 6, 2019 On 5/1/2019 at 6:41 AM, ut marsian said: Well, I don't get it, but ... Would it be possible to iterate all existing vehicles and correct the position ("On ground") ? ( At the moment my "Ready to Run" vehicles also stuck in ground. With the effect, if you drive close to them, they explode and are ruined ). If it is possible to move to the position of the vehicles in your spawn. Use Admin tool Positions: Spoiler <pos x="10967.148438" z="5494.307616" a="125.181313" /> <pos x="11534.269531" z="5014.221679" a="150.176453" /> <pos x="12896.135743" z="4453.044923" a="334.011871" /> <pos x="9585.212891" z="13396.000976" a="87.996712" /> <pos x="14034.884766" z="14716.9209" a="325.213226" /> <pos x="5219.459472" z="4219.182129" a="244.063538" /> <pos x="6495.133788" z="6181.312989" a="243.51564" /> <pos x="9582.772461" z="14758.739259" a="300.422516" /> <pos x="14025.90918" z="14266.795897" a="125.318275" /> <pos x="5230.886719" z="5497.956544" a="296.108276" /> <pos x="10793.807616" z="12470.28125" a="233.928436" /> <pos x="9899.779298" z="10340.83496" a="89.845657" /> <pos x="5968.523927" z="5654.93457" a="35.883495" /> <pos x="12423.814453" z="14895.0459" a="318.569672" /> <pos x="5837.734376" z="4882.799315" a="91.831573" /> <pos x="1232.160644" z="3874.00464" a="283.576447" /> <pos x="13078.68457" z="13125.545897" a="119.771378" /> <pos x="9943.828126" z="15292.68164" a="86.079254" /> <pos x="11442.866211" z="11363.060548" a="315.967407" /> <pos x="10081.315429" z="13299.858399" a="269.811951" /> <pos x="10539.982422" z="9701.252931" a="333.49826" /> <pos x="4391.032227" z="4581.519532" a="306.036804" /> <pos x="3259.710204" z="3863.399658" a="190.716599" /> <pos x="9123.927733" z="3773.643066" a="185.718582" /> <pos x="6754.291993" z="5595.911133" a="14.551986" /> <pos x="9684.398436" z="6776.42334" a="232.90126" /> <pos x="8344.581055" z="5456.51465" a="323.157806" /> <pos x="11683.108398" z="6677.018556" a="264.94986" /> <pos x="10441.624023" z="14488.532228" a="286.72644" /> <pos x="189.897583" z="2375.636962" a="107.718956" /> <pos x="4360.540529" z="3932.849854" a="34.99324" /> <pos x="6769.606445" z="14154.241212" a="291.862488" /> <pos x="3980.731934" z="14886.438475" a="127.715065" /> <pos x="6361.454102" z="15022.159178" a="115.183197" /> <pos x="5204.208985" z="14966.819335" a="84.298775" /> <pos x="8554.221679" z="15004.344726" a="179.007706" /> <pos x="7517.759767" z="13479.624023" a="58.002476" /> <pos x="4441.248047" z="15221.948241" a="96.556686" /> <pos x="5803.525878" z="14339.296876" a="263.717285" /> <pos x="9210.220702" z="14566.439452" a="180.239838" /> <pos x="2516.460448" z="12860.817382" a="165.926819" /> <pos x="1246.00525" z="12014.671875" a="52.113224" /> <pos x="1172.970093" z="10002.191406" a="81.38839" /> <pos x="3202.115966" z="13738.081056" a="279.741516" /> <pos x="188.869401" z="12533.565429" a="65.946167" /> <pos x="173.83841" z="10408.898436" a="116.552834" /> <pos x="2616.408202" z="15173.467773" a="181.678299" /> <pos x="6714.455078" z="14366.298829" a="320.41861" /> <pos x="5731.217286" z="13565.435546" a="83.203102" /> <pos x="698.044921" z="5655.839845" a="264.607483" /> <pos x="3374.655518" z="6438.325194" a="112.786423" /> <pos x="731.093262" z="4614.77881" a="316.994659" /> <pos x="401.609376" z="5180.114746" a="27.802856" /> <pos x="266.369963" z="3771.34082" a="201.605942" /> <pos x="8365.695312" z="10536.150392" a="286.315674" /> <pos x="222.509995" z="7532.833985" a="342.811523" /> <pos x="7842.441894" z="11571.214843" a="127.920494" /> <pos x="9172.4834" z="11041.203125" a="38.554192" /> <pos x="8838.80957" z="12048.776366" a="160.6539" /> <pos x="6900.140136" z="9867.984376" a="287.274323" /> <pos x="5261.272462" z="12629.513672" a="40.197708" /> <pos x="1204.618531" z="8719.435547" a="8.286052" /> <pos x="352.201264" z="9433.963867" a="7.121856" /> <pos x="294.966553" z="8558.888673" a="322.541534" /> <pos x="1039.427247" z="6697.102538" a="100.939415" /> <pos x="8095.777344" z="9324.056642" a="337.538574" /> <pos x="1567.00769" z="8987.469727" a="262.347626" /> <pos x="5866.774903" z="11511.595702" a="87.037987" /> <pos x="5709.894044" z="8665.878906" a="37.937878" /> <pos x="7217.253906" z="11325.613282" a="312.201019" /> <pos x="1245.506593" z="7909.728515" a="68.411476" /> <pos x="2038.860597" z="7310.690919" a="4.314205" /> <pos x="2511.67163" z="11006.207031" a="214.685638" /> <pos x="3056.927002" z="7785.317384" a="304.05191" /> <pos x="9074.924805" z="8018.091307" a="118.675713" /> <pos x="4802.537108" z="6823.164062" a="181.380966" /> <pos x="4706.666016" z="6311.534179" a="80.943275" /> <pos x="2797.501708" z="9871.407227" a="213.315994" /> <pos x="3688.735597" z="8255.378907" a="17.46236" /> <pos x="7183.526854" z="7541.604005" a="250.295166" /> <pos x="1218.171874" z="6215.999023" a="181.061844" /> You can change the height a = "4.314205" to a = "0.0" But the vehicles will not be placed on the ground You have to destroy the vehicles to generate a new spawn. It is possible that some vehicle reappears under the ground. In my case of 40 vehicles only 2 appeared under the ground. Share this post Link to post Share on other sites