Jump to content

Forums Announcement

Read-Only Mode for Announcements & Changelogs

Dear Survivors, we'd like to inform you that this forum will transition to read-only mode. From now on, it will serve exclusively as a platform for official announcements and changelogs.

For all community discussions, debates, and engagement, we encourage you to join us on our social media platforms: Discord, Twitter/X, Facebook.

Thank you for being a valued part of our community. We look forward to connecting with you on our other channels!

Stay safe out there,
Your DayZ Team

NoBeansForMe

Members
  • Content Count

    38
  • Joined

  • Last visited

Everything posted by NoBeansForMe

  1. NoBeansForMe

    Safe time

    No problem. Glad it worked.
  2. NoBeansForMe

    Safe time

    This code works technically, but it won't show a countdown timer like it does when you leave a trader, but that's for someone else to figure out. Just put it in your servers init.c, at the bottom of the class CustomMission. The client doesn't have to do anything. All you have to do is to set how many minutes you want the user to have god mode (won't take damage). It's set to 2 minutes by default. 10 seconds before the god mode is removed the user will get a warning. I haven't bug tested the code much so I have no idea how well it works with other mods or modifications in effect. I'm no expert at coding, so I'm sure it can be done prettier, but this is what I can give you. class CustomMission: MissionServer { // All the standard code goes here. // Code for god mode upon spawning starts here. Only paste this code into init.c override void InvokeOnConnect(PlayerBase player, PlayerIdentity identity) { super.InvokeOnConnect(player, identity); player.SetAllowDamage(false); // Set in minutes for how long you want the player to have god mode upon spawning into the game. Don't edit anything else unless you know what you are doing. int godModeTimer = 2; int godModeTimerMS = godModeTimer * 60000; string message = "You now have god mode for " + godModeTimer + " minutes."; GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(DisplayMessage, 10000, false, player, message); GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(RemoveGodMode, godModeTimerMS, false, player); int warningTime = godModeTimerMS - 10000; message = "Your god mode will be removed in 10 seconds."; GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(DisplayMessage, warningTime, false, player, message); } void RemoveGodMode(PlayerBase player) { player.SetAllowDamage(true); DisplayMessage(player, "Your god mode has been removed."); } void DisplayMessage(PlayerBase player, string message) { Param1<string> m_MessageParam = new Param1<string>(message); GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, m_MessageParam, true, player.GetIdentity()); } // Code for god mode upon spawning ends here. Don't paste anything else into init.c. };
  3. NoBeansForMe

    init.c issues

    @Racey66 It's really hard to say. I'd make sure the file inclusion works correctly. Remove all code in it and replace it with something that for sure will render an output. Even put in an error in the code to at least get a sign the server is reading the file by getting an error message. Or maybe remove all other inclusions to the rest of the files and only keep CostalSigns.c until you get it working. Then put back the other ones again, one by one even.
  4. NoBeansForMe

    init.c issues

    I haven't modified the weather code in init.c. Are you sure you have the latest one? I always verify my local files when a new version of DayZ is released. I don't really play on my server, I just use it for testing scripts and occasionally some modding. Then I move the things I've created out of the server files into my backups for future usage and restore the server to it's original state. I haven't really noticed what kind of weather I have when I do play a bit on my server. My sessions usually never last very long. Just start it up, test some code and then restart etc.
  5. NoBeansForMe

    init.c issues

    It looks like you have placed the code outside the main() function, just below it. I pasted your init.c into Notepad++ to make it easier to see the structure, and the starting bracket "{" after void main() doesn't seem to have a closing "}" to form a valid section of code for the function, so to speak. I have three closing "}" above the code below in my init.c, and you have four. And I can't find any code inside the main() function that would require that forth ending "}". Remove the one just above the line "// Spawn custom objects here. Here I call the functions in the above included files to have them spawned." and the rest of the code will be inside of the main() function. // Spawn custom objects here. Here I call the functions in the above included files to have them spawned. SpawnBiathlon(); SpawnBlackMarket(); SpawnCostalLights(); SpawnCostalSigns();  SpawnCostalTraders(); SpawnCustomBanking(); SpawnGMLights(); SpawnGMSigns(); SpawnKSigns(); SpawnNEAF(); SpawnPrisonBridge(); SpawnSkaliskyBridge(); SpawnTheMaze(); //GetCEApi().ExportProxyData( "7500 0 7500", 10000 ); // This line populate the new objects with loot, but that's a whole other story how that works. I can't tell if this will solve your errors, there is a lot going on inside your init.c, but it's a good start. I have no way of testing your init.c either, since it includes a lot of code that I don't have. All I can recommend is to replace the code in steps. Don't do it all at once. Start with a working init.c and then move code out to their own files one "section" at a time. That way you will know what code modification broke the server if you suddenly get an error.
  6. NoBeansForMe

    init.c issues

    This is how I add custom objects to init.c First I created a folder called "Scripts" in "dayzOffline.chernarusplus" where I put one file for each area of objects I want to spawn, so I don't mix them up with the other server files. Each file in this folder looks like this: void SpawnTestObjects() { SpawnObject( "Land_Mil_Barracks6", "12133.400391 140.000000 12688.500000", "-157.500000 0.000000 0.000000" ); SpawnObject( "Land_Mil_Barracks6", "12226.900391 140.000000 12649.200195", "-157.500000 0.000000 0.000000" ); ... ... rest of SpawnObject calls goes here ... ... } As you can see I've created a function called SpawnTestObjects to enclose all the calls to the SpawnObject function. This function can be called whatever, as long as it's unique. I name it to reflect the name of the area I want to spawn objects in, like SpawnTraderCamp() or SpawnBarracksOnNEAF(). In this example I called it SpawnTestObjects() and included all your lines without modifying them. I usually name the file the same as the name of the function that creates the actual objects, like SpawnTestObjects.c. Then I include the above file at the top of init.c with the line below: #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\Scripts\\SpawnTestObjects.c" I also put the SpawnObject() code for actually spawning the objects in a separate file as well, hence the inclusion of the file SpawnHelper.c in the code in my complete init.c below. This is of course not necessary. You can keep it in init.c if you want, but I kind of like to not get that file cluttered with custom code. Then further below, at the end of the main() function (it probably can be anywhere within the main function, but this is where I put it) I execute the code for creating my custom objects by calling the function I created to enclose those lines: SpawnTestObjects(); This is my complete init.c file: #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\Scripts\\SpawnHelper.c" // The code for actually spawning the objects. #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\Scripts\\SpawnTraderCamp.c" // Spawn trader objects. #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\Scripts\\SpawnTraderFunfair.c" // Some more trader objects. #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\Scripts\\SpawnTraderPrison.c" // Lots of traders. #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\Scripts\\SpawnBalotaNostalgia.c" // Old tents in Balota. #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\Scripts\\SpawnTestObjects.c" // Racey66's objects up for testing. void main() { //INIT WEATHER BEFORE ECONOMY INIT------------------------ Weather weather = g_Game.GetWeather(); weather.MissionWeather(false); // false = use weather controller from Weather.c weather.GetOvercast().Set( Math.RandomFloatInclusive(0.4, 0.6), 1, 0); weather.GetRain().Set( 0, 0, 1); weather.GetFog().Set( Math.RandomFloatInclusive(0.05, 0.1), 1, 0); //INIT ECONOMY-------------------------------------- Hive ce = CreateHive(); if ( ce ) ce.InitOffline(); //DATE RESET AFTER ECONOMY INIT------------------------- int year, month, day, hour, minute; int reset_month = 9, reset_day = 20; GetGame().GetWorld().GetDate(year, month, day, hour, minute); if ((month == reset_month) && (day < reset_day)) { GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute); } else { if ((month == reset_month + 1) && (day > reset_day)) { GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute); } else { if ((month < reset_month) || (month > reset_month + 1)) { GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute); } } } // Spawn custom objects here. Here I call the functions in the above included files to have them spawned. SpawnTraderCamp(); SpawnTraderFunfair(); SpawnTraderPrison(); SpawnBalotaNostalgia(); SpawnTestObjects(); //GetCEApi().ExportProxyData( "7500 0 7500", 10000 ); // This line populate the new objects with loot, but that's a whole other story how that works. } class CustomMission: MissionServer { ... Rest of this class code here. I only put it in as a reference. ... } Your code seems to work fine. It spawned buildings and tents at the North East Airfield. Also a statue: As for a limit on how many objects you can spawn, I don't know, but it seems unlikely. In total I have 909 lines of custom code calling for an object to be spawned via init.c, and it works just fine. Maybe you have tons more, but I doubt it should matter. Except for effecting server performance after a while if it keeps adding up. But it should at least start. By the way, here is the code I use to spawn objects (SpawnHelper.c): 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); } } I have seen a couple of variants of this code. Not exactly sure what it all does, but this one works for me. Got it from a trader mod I downloaded a while back.
  7. NoBeansForMe

    I need help for trader mod

    Just edit the TraderConfig.txt file in your trader folder on the server. I usually just add a new category for the modded items to an existing trader. Like Base Building stuff to the tools trader: <Trader> Misc Trader // This trader comes as default with the trader mod. <Category> Tools (small) Binoculars, *, 0, 0 CanOpener, *, 0, 0 ChernarusMap, *, 0, 0 CombatKnife, *, 0, 0 Compass, *, 0, 0 ... ... more standard items here ... ... <Category> BaseBuildingPlus // Just add a new category called whatever you want. BBP_Land_Claim_FlagKit, *, 0, 0 BBP_Blueprint, *, 0, 0 BBP_Workbench, *, 0, 0 BBP_T1_WallKit, *, 0, 0 BBP_T1_Wall_HalfKit, *, 0, 0 Obviously adjust the prices to your liking. I have set mine to 0 since I just run a test server. Hopefully the mod creator, or someone in the comment section of the mod, has posted already done trader lists for you to just paste into this file. If not, you're just going to have to add them yourself using the object names most likely posted by the mod creator on the mod page. Here is a description of the three columns following the object name of the modded item. It's straight from the file itself: // Quantity: * means max value; Quantity V means Vehicle; Quantity VNK means Vehicle without Key; Quantity M means Magazine; Quantity W means Weapon; Quantity S means Steak Meat; Quantity K means Key Duplication // Sellvalue: -1 means it can not be sold // Buyvalue: -1 means it can not be bought Vehicles are a bit more work to. Vehicles are added to the vehicle trader in the same file. Well, they can be added to whichever trader I suppose, but that's what I did. <Trader> Vehicles Trader <Category> Vehicles CivilianSedan, VNK, 0, 0 CivilianSedan_Black, VNK, 0, 0 ... ... more standard vehicles ... ... Kubelwagen, VNK, 0, 0 // Modded vehicle Not sure if you *have to* add the vehicle parts for the modded vehicle to the section below, but why not. It's still the same file and just below the section in the above code. <Category> Vehicle Parts HeadlightH7_Box, *, 0, 0 SparkPlug, *, 0, 0 EngineOil, *, 0, 0 ... ... ... Kubelwagen_dver_1_1, *, 0, 0 Kubelwagen_dver_1_2, *, 0, 0 Kubelwagen_dver_2_1, *, 0, 0 Kubelwagen_dver_2_2, *, 0, 0 Kubelwagen_koleso, *, 0, 0 Next you have to add the modded vehicle to the file TraderVehicleParts.txt in the same directory. This file contains sections named the same as the vehicle class name in the previous file, and each section contains the vehicle parts the vehicle will spawn with. Preferably all of them. <VehicleParts> Kubelwagen SparkPlug CarBattery CarRadiator HeadlightH7 HeadlightH7 Kubelwagen_dver_1_1 Kubelwagen_dver_1_2 Kubelwagen_dver_2_1 Kubelwagen_dver_2_2 CanisterGasoline Kubelwagen_koleso Kubelwagen_koleso Kubelwagen_koleso Kubelwagen_koleso Kubelwagen_koleso Just place it below the rest of the standard vehicles. That should be it, unless I missed something. The vehicle should now be available for purchase in the vehicle trader.
  8. NoBeansForMe

    Inventory not accesible!

    No problem! Glad it worked. I hope they fix that bug some day. I use the debug monitor from time to time when I need to get a coordinate to somewhere for whatever reason.
  9. NoBeansForMe

    How to add materials to the first aid kit?

    This code works for me: EntityAI playersFirstAidKit = player.GetInventory().CreateInInventory("FirstAidKit"); playersFirstAidKit.GetInventory().CreateInInventory("BandageDressing"); playersFirstAidKit.GetInventory().CreateInInventory("SalineBagIV"); playersFirstAidKit.GetInventory().CreateInInventory("Epinephrine"); playersFirstAidKit.GetInventory().CreateInInventory("BloodTestKit"); I put it in init.c and I spawned with the first aid kit with the items in it, except for the Epinephrine. I think it's because it won't fit into the first aid kit unless it's turned horizontally, which the object creator doesn't seem to try, so it just didn't put it in there.
  10. I got those same errors in both my servers and the games log files. Didn't even know until I checked after reading your post. Not sure how normal they are. I haven't noticed DayZ being any less stable (or more unstable, perhaps) as of lately, and I play a lot every day.
  11. NoBeansForMe

    Inventory not accesible!

    Have you enabled the debug monitor in the upper right corner? I read somewhere it could cause a similar problem to what you are describing. Try disabling it if you have it enabled. If not, I'm afraid I don't know what could cause it.
  12. NoBeansForMe

    Add Itens To HotBar (shortCut)

    This is how I do it: private EntityAI weapon1; weapon1 = player.GetInventory().CreateInInventory("M4A1"); player.SetQuickBarEntityShortcut(weapon1, 0); The first argument in the last line, "weapon1", refers to the object you want to place in the quickbar. It can be called whatever, as long as you are consistent throughout the code. The second argument, "0", indicates the first quickbar button. Adjust it to your liking. You can keep adding more weapons like this: private EntityAI weapon2; weapon2 = player.GetInventory().CreateInInventory("Glock19"); player.SetQuickBarEntityShortcut(weapon2, 1);
×