Advertisement
Faddy1994

my init.c

Sep 18th, 2019
580
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Spawn helper function
  2. void SpawnObject( string type, vector position, vector orientation )
  3. {
  4.     auto obj = GetGame().CreateObject( type, position );
  5.     obj.SetPosition( position );
  6.     obj.SetOrientation( orientation );
  7.     obj.SetOrientation( obj.GetOrientation() ); //Collision fix
  8.     obj.Update();
  9.     obj.SetAffectPathgraph( true, false );
  10.     if( obj.CanAffectPathgraph() ) GetGame().GetCallQueue( CALL_CATEGORY_SYSTEM ).CallLater( GetGame().UpdatePathgraphRegionByObject, 100, false, obj );
  11. }
  12.  
  13.  
  14.     #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\prisonship.c"
  15.     #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\island01.c"
  16.     #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\island02.c"
  17.     #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\container.c"
  18.     #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\islandmili.c"
  19.     #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\caves.c"
  20.  
  21.  
  22. void main()
  23. {
  24.     //INIT WEATHER BEFORE ECONOMY INIT------------------------
  25.     Weather weather = g_Game.GetWeather();
  26.  
  27.     weather.MissionWeather(false);    // false = use weather controller from Weather.c
  28.  
  29.     weather.GetOvercast().Set( Math.RandomFloatInclusive(0.4, 0.6), 1, 0);
  30.     weather.GetRain().Set( 0, 0, 1);
  31.     weather.GetFog().Set( Math.RandomFloatInclusive(0.05, 0.1), 1, 0);
  32.  
  33.     //INIT ECONOMY--------------------------------------
  34.     Hive ce = CreateHive();
  35.     if ( ce )
  36.         ce.InitOffline();
  37.    
  38.     //Notification Server
  39.     GetNotificationSystem().CreateNotification_Old("Hello", "Welcome to the server", ARGB(255, 255, 255, 255), 15);
  40.  
  41.     //Your custom spawned objects ATM IN GREENMT
  42.     SpawnObject( "DC_BankingATM", "3701.592529 402.000000 5995.256836", "-31.990705 0.000000 0.000000" );
  43.     SpawnObject( "DC_BankingATMRed", "3702.300537 402.000000 5995.728027", "-31.990705 0.000000 0.000000" );
  44.     SpawnObject( "DC_BankingATMDarkGreen", "3703.015137 402.000000 5996.205078", "-31.990705 0.000000 0.000000" );
  45.     SpawnObject( "DC_BankingATMDarkBlue", "3703.701904 402.000000 5996.666992", "-31.990705 0.000000 0.000000" );
  46.    
  47.     //spawned objects ATM IN Kumyrna
  48.     SpawnObject( "DC_BankingATM", "8361.131836 292.019104 5991.822266", "10.000004 0.000000 0.000000" );
  49.     SpawnObject( "DC_BankingATMYellow", "8361.958984 292.022705 5991.670898", "10.000004 0.000000 0.000000" );
  50.     SpawnObject( "DC_BankingATMGray", "8363.551758 292.024048 5991.381836", "10.000004 0.000000 0.000000" );
  51.     SpawnObject( "DC_BankingATMDarkBlue", "8362.740234 292.024811 5991.526855", "10.000004 0.000000 0.000000" );
  52.    
  53.    
  54.     //Add Island
  55.     prisonship();
  56.     island01();
  57.     island02();
  58.     container();
  59.     islandmili();
  60.     caves();
  61.  
  62.    
  63.     //GetTesting().ExportProxyData( "2250000 0 7500", 2250000 );  //Center of map, radius of how far to go out and find buildings.
  64.    
  65.    
  66.     //DATE RESET AFTER ECONOMY INIT-------------------------
  67.     int year, month, day, hour, minute;
  68.     int reset_month = 9, reset_day = 20;
  69.     GetGame().GetWorld().GetDate(year, month, day, hour, minute);
  70.  
  71.     if ((month == reset_month) && (day < reset_day))
  72.     {
  73.         GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  74.     }
  75.     else
  76.     {
  77.         if ((month == reset_month + 1) && (day > reset_day))
  78.         {
  79.             GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  80.         }
  81.         else
  82.         {
  83.             if ((month < reset_month) || (month > reset_month + 1))
  84.             {
  85.                 GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  86.             }
  87.         }
  88.     }
  89. }
  90.  
  91. class CustomMission: MissionServer
  92. {
  93.     void SetRandomHealth(EntityAI itemEnt)
  94.     {
  95.         if ( itemEnt )
  96.         {
  97.             int rndHlt = Math.RandomInt(55,100);
  98.             itemEnt.SetHealth("","",rndHlt);
  99.         }
  100.     }
  101.  
  102.     override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
  103.     {
  104.         Entity playerEnt;
  105.         playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
  106.         Class.CastTo(m_player, playerEnt);
  107.  
  108.         GetGame().SelectPlayer(identity, m_player);
  109.  
  110.         return m_player;
  111.     }
  112.  
  113.     override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
  114.     {
  115.         EntityAI itemTop;
  116.         EntityAI itemEnt;
  117.         ItemBase itemBs;
  118.         float rand;
  119.  
  120.         itemTop = player.FindAttachmentBySlotName("Body");
  121.  
  122.         if ( itemTop )
  123.         {
  124.             itemEnt = itemTop.GetInventory().CreateInInventory("Rag");
  125.             if ( Class.CastTo(itemBs, itemEnt ) )
  126.                 itemBs.SetQuantity(4);
  127.  
  128.             SetRandomHealth(itemEnt);
  129.            
  130.             itemEnt = itemTop.GetInventory().CreateInInventory("flashlight");
  131.             SetRandomHealth(itemEnt);
  132.  
  133.             itemEnt = itemTop.GetInventory().CreateInInventory("Battery9V");
  134.             SetRandomHealth(itemEnt);          
  135.            
  136.             itemEnt = itemTop.GetInventory().CreateInInventory("WaterBottle");
  137.             SetRandomHealth(itemEnt);
  138.            
  139.             itemEnt = itemTop.GetInventory().CreateInInventory("MoneyRuble100");
  140.             SetRandomHealth(itemEnt);
  141.  
  142.             itemEnt = itemTop.GetInventory().CreateInInventory("KitchenKnife");
  143.             SetRandomHealth(itemEnt);          
  144.            
  145.             rand = Math.RandomFloatInclusive(0.0, 1.0);
  146.             if ( rand < 0.35 )
  147.                 itemEnt = player.GetInventory().CreateInInventory("rice");
  148.             else if ( rand > 0.65 )
  149.                 itemEnt = player.GetInventory().CreateInInventory("Pear");
  150.        
  151.             SetRandomHealth(itemEnt);
  152.         }
  153.     }
  154. };
  155.  
  156. Mission CreateCustomMission(string path)
  157. {
  158.     return new CustomMission();
  159. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement