Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • Need help?

    Create a theme in the appropriate section
    No need to write everything in the chat!
  • Sell or buy?

    Use the services of a guarantor
    We will make your transaction safe
  • Don't want a BAN?

    Please read our rules
    Don't disturb the order
  • Visit the market

    There you can sell or buy
    Everything related to game servers
  • 0
mastaZz

Оружие и магазины в быстрых слотах

Ребята помогите, не получается организовать переменные(в файле инит) таким образом, чтобы не выдавало ошибку


	void main()
	{
		Hive ce = CreateHive();
		if ( ce )
		ce.InitOffline();

		Weather weather = g_Game.GetWeather();

		weather.GetOvercast().SetLimits( 0.0 , 1.0 );
		weather.GetRain().SetLimits( 0.0 , 1.0 );
		weather.GetFog().SetLimits( 0.0 , 0.25 );

		weather.GetOvercast().SetForecastChangeLimits( 0.0, 0.2 );
		weather.GetRain().SetForecastChangeLimits( 0.0, 0.1 );
		weather.GetFog().SetForecastChangeLimits( 0.15, 0.45 );

		weather.GetOvercast().SetForecastTimeLimits( 1800 , 1800 );
		weather.GetRain().SetForecastTimeLimits( 600 , 600 );
		weather.GetFog().SetForecastTimeLimits( 1800 , 1800 );

		weather.GetOvercast().Set( Math.RandomFloatInclusive(0.0, 0.3), 0, 0);
		weather.GetRain().Set( Math.RandomFloatInclusive(0.0, 0.2), 0, 0);
		weather.GetFog().Set( Math.RandomFloatInclusive(0.0, 0.1), 0, 0);

		weather.SetWindMaximumSpeed(15);
		weather.SetWindFunctionParams(0.1, 0.3, 50);
	}

	class CustomMission: MissionServer
	{ 
		void SetRandomHealth(EntityAI itemEnt)
		{
			int rndHlt = Math.RandomInt(60,100);
			itemEnt.SetHealth("","",rndHlt);
		}

		override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
	{
		vector player_pos;
		int index;
		
		TVectorArray positions = { "10701.016 0 7952.518", "10604.016 0 8045.518", "10712.016 0 8133.518", "10779.016 0 8074.518", "10702.016 0 8058.518", };
	    index = Math.RandomInt(0, positions.Count() );
		
	    player_pos = positions.Get(index);
		
		Entity playerEnt;
		playerEnt = GetGame().CreatePlayer(identity, characterName, player_pos, 0, "NONE");//Creates random player
		Class.CastTo(m_player, playerEnt);
		
		GetGame().SelectPlayer(identity, m_player);
		
		return m_player;
	}

			override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
			{
		player.RemoveAllItems();

		EntityAI itemEnt;
		ItemBase itemBs;

		switch (Math.RandomInt(0, 1)) { 
		case 0:
		//ак
		
			player.GetInventory().CreateInInventory("CoyoteBag_Green");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("TTSKOPants");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("TTsKOJacket_Camo");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("CombatBoots_Black");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("CombatKnife");itemBs = ItemBase.Cast(itemEnt);
			
			player.GetInventory().CreateInInventory("FNX45");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");itemBs = ItemBase.Cast(itemEnt);	
			player.GetInventory().CreateInInventory("Mag_AKM_30Rnd");itemBs = ItemBase.Cast(itemEnt); 
			player.GetInventory().CreateInInventory("Mag_AKM_30Rnd");itemBs = ItemBase.Cast(itemEnt);
			itemEnt = player.GetInventory().CreateInInventory( "akm" ); 
			itemEnt.GetInventory().CreateAttachment( "PSO11Optic" ); 
			itemEnt.GetInventory().CreateAttachment( "AK_WoodBttstck" ); 
			itemEnt.GetInventory().CreateAttachment( "AK_WoodHndgrd" );
			itemEnt.GetInventory().CreateAttachment( "AK_Suppressor" );
		break; 
		case 1: 
		//Мка
			player.GetInventory().CreateInInventory("CoyoteBag_Green");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("GorkaPants_Autumn");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("GorkaEJacket_Autumn");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("CombatBoots_Black");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("CombatKnife");itemBs = ItemBase.Cast(itemEnt); 
			
			itemEnt = player.GetInventory().CreateInInventory( "M4A1_Black" ); 
			itemEnt.GetInventory().CreateAttachment( "M4_Suppressor" ); 
			itemEnt.GetInventory().CreateAttachment( "M4_RISHndgrd_Black" ); 
			itemEnt.GetInventory().CreateAttachment( "M4_MPBttstck_Black" );
			itemEnt.GetInventory().CreateAttachment( "ACOGOptic" );
			
				
			player.GetInventory().CreateInInventory("FNX45");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");itemBs = ItemBase.Cast(itemEnt);	
			player.GetInventory().CreateInInventory("Mag_STANAGCoupled_30Rnd");itemBs = ItemBase.Cast(itemEnt); 
			player.GetInventory().CreateInInventory("Mag_STANAGCoupled_30Rnd");itemBs = ItemBase.Cast(itemEnt); 
		break; 

		
		}
			// базовое
			itemEnt = player.GetInventory().CreateInInventory("Rag");
			itemBs = ItemBase.Cast(itemEnt);
			itemBs.SetQuantity(4);
			itemEnt = player.GetInventory().CreateInInventory("SmershVestBackpack");
			itemEnt = player.GetInventory().CreateInInventory("Ushanka_Black");
			itemEnt = player.GetInventory().CreateInInventory("ThinFramesGlasses");
			itemEnt = player.GetInventory().CreateInInventory("SalineBagIV");
			itemEnt = player.GetInventory().CreateInInventory("Crowbar");
			itemEnt = player.GetInventory().CreateInInventory("Roadflare");
			itemEnt = player.GetInventory().CreateInInventory("CombatKnife");
			itemEnt = player.GetInventory().CreateInInventory("landminetrap");
			itemEnt = player.GetInventory().CreateInInventory("PersonalRadio");
				itemEnt.GetInventory().CreateAttachment( "Battery9V" );
			itemBs = ItemBase.Cast(itemEnt);
			itemBs.SetQuantity(4);

		}
		
};
	Mission CreateCustomMission(string path)
		{
		return new CustomMission();
		}

Цель - чтобы выберались рандомные персы с разным обмуньдированием и оружием и при этом магазины были в быстрых слотах, а оружие в руках и тоже в быстром слоте

Edited by mastaZz (see edit history)

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Синтаксис не верный у switch-case

switch (Math.RandomIntInclusive(0, 1))
			case 0:
			{
			//ак
			
				player.GetInventory().CreateInInventory("CoyoteBag_Green");itemBs = ItemBase.Cast(itemEnt);
				player.GetInventory().CreateInInventory("TTSKOPants");itemBs = ItemBase.Cast(itemEnt);
				player.GetInventory().CreateInInventory("TTsKOJacket_Camo");itemBs = ItemBase.Cast(itemEnt);
				player.GetInventory().CreateInInventory("CombatBoots_Black");itemBs = ItemBase.Cast(itemEnt);
				player.GetInventory().CreateInInventory("CombatKnife");itemBs = ItemBase.Cast(itemEnt);
				
				player.GetInventory().CreateInInventory("FNX45");itemBs = ItemBase.Cast(itemEnt);
				player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");itemBs = ItemBase.Cast(itemEnt);
				player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");itemBs = ItemBase.Cast(itemEnt);	
				player.GetInventory().CreateInInventory("Mag_AKM_30Rnd");itemBs = ItemBase.Cast(itemEnt); 
				player.GetInventory().CreateInInventory("Mag_AKM_30Rnd");itemBs = ItemBase.Cast(itemEnt);
				itemEnt = player.GetInventory().CreateInInventory( "akm" ); 
				itemEnt.GetInventory().CreateAttachment( "PSO11Optic" ); 
				itemEnt.GetInventory().CreateAttachment( "AK_WoodBttstck" ); 
				itemEnt.GetInventory().CreateAttachment( "AK_WoodHndgrd" );
				itemEnt.GetInventory().CreateAttachment( "AK_Suppressor" );
				break; 
			}
			case 1: 
			{
			//Мка
				player.GetInventory().CreateInInventory("CoyoteBag_Green");itemBs = ItemBase.Cast(itemEnt);
				player.GetInventory().CreateInInventory("GorkaPants_Autumn");itemBs = ItemBase.Cast(itemEnt);
				player.GetInventory().CreateInInventory("GorkaEJacket_Autumn");itemBs = ItemBase.Cast(itemEnt);
				player.GetInventory().CreateInInventory("CombatBoots_Black");itemBs = ItemBase.Cast(itemEnt);
				player.GetInventory().CreateInInventory("CombatKnife");itemBs = ItemBase.Cast(itemEnt); 
				
				itemEnt = player.GetInventory().CreateInInventory( "M4A1_Black" ); 
				itemEnt.GetInventory().CreateAttachment( "M4_Suppressor" ); 
				itemEnt.GetInventory().CreateAttachment( "M4_RISHndgrd_Black" ); 
				itemEnt.GetInventory().CreateAttachment( "M4_MPBttstck_Black" );
				itemEnt.GetInventory().CreateAttachment( "ACOGOptic" );
				
					
				player.GetInventory().CreateInInventory("FNX45");itemBs = ItemBase.Cast(itemEnt);
				player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");itemBs = ItemBase.Cast(itemEnt);
				player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");itemBs = ItemBase.Cast(itemEnt);	
				player.GetInventory().CreateInInventory("Mag_STANAGCoupled_30Rnd");itemBs = ItemBase.Cast(itemEnt); 
				player.GetInventory().CreateInInventory("Mag_STANAGCoupled_30Rnd");itemBs = ItemBase.Cast(itemEnt); 
				break; 
			}
		/*	default:
			{
				//тупо ничего, это не обязательно
				break;
			}*/

так верно будет

По поводу горячих слотов - вроде бы все просто, только комманду не проверял:

 player.SetQuickBarEntityShortcut(primary, 0, true);
    player.SetQuickBarEntityShortcut(axe, 2, true);

где player - сам игрок
primary и axe - сам объект отспавненный
т.е.

EntityAI gun = player.GetInventory().CreateInInventory("MP5K"); 
player.SetQuickBarEntityShortcut(gun, 0, true);

или

EntityAI gun = player.GetInventory().CreateInInventory("MP5K"); 
mag = gun.GetInventory().CreateInInventory(mag_type);
player.SetQuickBarEntityShortcut(mag, 0, true);

 

Share this post


Link to post
Share on other sites





  • 0

123new вот что у меня получилось, ошибку выдало на 91 строчке(там где надпись кейс 1)


	void main()
	{
		Hive ce = CreateHive();
		if ( ce )
		ce.InitOffline();

		Weather weather = g_Game.GetWeather();

		weather.GetOvercast().SetLimits( 0.0 , 1.0 );
		weather.GetRain().SetLimits( 0.0 , 1.0 );
		weather.GetFog().SetLimits( 0.0 , 0.25 );

		weather.GetOvercast().SetForecastChangeLimits( 0.0, 0.2 );
		weather.GetRain().SetForecastChangeLimits( 0.0, 0.1 );
		weather.GetFog().SetForecastChangeLimits( 0.15, 0.45 );

		weather.GetOvercast().SetForecastTimeLimits( 1800 , 1800 );
		weather.GetRain().SetForecastTimeLimits( 600 , 600 );
		weather.GetFog().SetForecastTimeLimits( 1800 , 1800 );

		weather.GetOvercast().Set( Math.RandomFloatInclusive(0.0, 0.3), 0, 0);
		weather.GetRain().Set( Math.RandomFloatInclusive(0.0, 0.2), 0, 0);
		weather.GetFog().Set( Math.RandomFloatInclusive(0.0, 0.1), 0, 0);

		weather.SetWindMaximumSpeed(15);
		weather.SetWindFunctionParams(0.1, 0.3, 50);
	}

	class CustomMission: MissionServer
	{ 
		void SetRandomHealth(EntityAI itemEnt)
		{
			int rndHlt = Math.RandomInt(60,100);
			itemEnt.SetHealth("","",rndHlt);
		}

		override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
	{
		vector player_pos;
		int index;
		
		TVectorArray positions = { "10701.016 0 7952.518", "10604.016 0 8045.518", "10712.016 0 8133.518", "10779.016 0 8074.518", "10702.016 0 8058.518", };
	    index = Math.RandomInt(0, positions.Count() );
		
	    player_pos = positions.Get(index);
		
		Entity playerEnt;
		playerEnt = GetGame().CreatePlayer(identity, characterName, player_pos, 0, "NONE");//Creates random player
		Class.CastTo(m_player, playerEnt);
		
		GetGame().SelectPlayer(identity, m_player);
		
		return m_player;
	}

			override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
			{
		player.RemoveAllItems();

		EntityAI itemEnt;
		ItemBase itemBs;

		switch (Math.RandomInt(0, 1))
		{
			
		case 0:
		 // тсско с калашом
		
			player.GetInventory().CreateInInventory("CoyoteBag_Green");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("TTSKOPants");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("TTsKOJacket_Camo");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("CombatBoots_Black");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("CombatKnife");itemBs = ItemBase.Cast(itemEnt);
			
			player.GetInventory().CreateInInventory("FNX45");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");itemBs = ItemBase.Cast(itemEnt);	
			player.GetInventory().CreateInInventory("Mag_AKM_30Rnd");itemBs = ItemBase.Cast(itemEnt); 
			player.GetInventory().CreateInInventory("Mag_AKM_30Rnd");itemBs = ItemBase.Cast(itemEnt);
			itemEnt = player.GetInventory().CreateInInventory( "akm" ); 
			itemEnt.GetInventory().CreateAttachment( "PSO11Optic" ); 
			itemEnt.GetInventory().CreateAttachment( "AK_WoodBttstck" ); 
			itemEnt.GetInventory().CreateAttachment( "AK_WoodHndgrd" );
			itemEnt.GetInventory().CreateAttachment( "AK_Suppressor" );
		break;
		 
		}
		 
		{
		case 1:   // строчка 91
		         // с Мка
			player.GetInventory().CreateInInventory("CoyoteBag_Green");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("GorkaPants_Autumn");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("GorkaEJacket_Autumn");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("CombatBoots_Black");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("CombatKnife");itemBs = ItemBase.Cast(itemEnt); 
			
			itemEnt = player.GetInventory().CreateInInventory( "M4A1_Black" ); 
			itemEnt.GetInventory().CreateAttachment( "M4_Suppressor" ); 
			itemEnt.GetInventory().CreateAttachment( "M4_RISHndgrd_Black" ); 
			itemEnt.GetInventory().CreateAttachment( "M4_MPBttstck_Black" );
			itemEnt.GetInventory().CreateAttachment( "ACOGOptic" );
			
				
			player.GetInventory().CreateInInventory("FNX45");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");itemBs = ItemBase.Cast(itemEnt);	
			player.GetInventory().CreateInInventory("Mag_STANAGCoupled_30Rnd");itemBs = ItemBase.Cast(itemEnt); 
			player.GetInventory().CreateInInventory("Mag_STANAGCoupled_30Rnd");itemBs = ItemBase.Cast(itemEnt); 
		break;
		 
        }

		
};
Mission CreateCustomMission(string path)
{
	return new CustomMission();
}

переставляя фигурные скобки которые идут после 

		switch (Math.RandomInt(0, 1))

добился того что ошибка ушла в

Mission CreateCustomMission(string path)

в итогде начал перестраивать фигурные скобки по всему телу скрипта, в качестве образца использовал скрипт с форума с разным стартовым вооружением и одним вареантом одежды для всех классов(только модифицировал его и изменил точки спауна, данный скрипт работает отлично и точки спауна и оружее)


void main()
{

	Hive ce = CreateHive();
	if ( ce )
		ce.InitOffline();

	Weather weather = g_Game.GetWeather();

	weather.GetOvercast().SetLimits( 0.0 , 1.0 );
	weather.GetRain().SetLimits( 0.0 , 1.0 );
	weather.GetFog().SetLimits( 0.0 , 0.25 );

	weather.GetOvercast().SetForecastChangeLimits( 0.0, 0.2 );
	weather.GetRain().SetForecastChangeLimits( 0.0, 0.1 );
	weather.GetFog().SetForecastChangeLimits( 0.15, 0.45 );

	weather.GetOvercast().SetForecastTimeLimits( 1800 , 1800 );
	weather.GetRain().SetForecastTimeLimits( 600 , 600 );
	weather.GetFog().SetForecastTimeLimits( 1800 , 1800 );

	weather.GetOvercast().Set( Math.RandomFloatInclusive(0.0, 0.3), 0, 0);
	weather.GetRain().Set( Math.RandomFloatInclusive(0.0, 0.2), 0, 0);
	weather.GetFog().Set( Math.RandomFloatInclusive(0.0, 0.1), 0, 0);
	
	weather.SetWindMaximumSpeed(15);
	weather.SetWindFunctionParams(0.1, 0.3, 50);
}

class CustomMission: MissionServer
{	
	void SetRandomHealth(EntityAI itemEnt)
	{
		int rndHlt = Math.RandomInt(40,100);
		itemEnt.SetHealth("","",rndHlt);
	}

	override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
	{
		vector player_pos;
		int index;
		
		TVectorArray positions = { "10701.016 0 7952.518", "10604.016 0 8045.518", "10712.016 0 8133.518", "10779.016 0 8074.518", "10702.016 0 8058.518", };
	    index = Math.RandomInt(0, positions.Count() );
		
	    player_pos = positions.Get(index);
		
		Entity playerEnt;
		playerEnt = GetGame().CreatePlayer(identity, characterName, player_pos, 0, "NONE");//Creates random player
		Class.CastTo(m_player, playerEnt);
		
		GetGame().SelectPlayer(identity, m_player);
		
		return m_player;
	}
	
void addMags(PlayerBase player, string mag_type, int count)
{
    if (count < 1)
        return;

    EntityAI mag;

    for (int i = 0; i < count; i++) {
        mag = player.GetInventory().CreateInInventory(mag_type);
    }

    player.SetQuickBarEntityShortcut(mag, 1, true);
}

EntityAI assaultClass(PlayerBase player)
{
    EntityAI gun = player.GetHumanInventory().CreateInHands("M4A1");
    gun.GetInventory().CreateAttachment("M4_RISHndgrd_Black");
    gun.GetInventory().CreateAttachment("M4_MPBttstck_Black");
    gun.GetInventory().CreateAttachment("ACOGOptic");
    addMags(player, "Mag_STANAG_30Rnd", 3);

    return gun;
}

EntityAI sniperClass(PlayerBase player)
{
    EntityAI gun = player.GetHumanInventory().CreateInHands("SVD");
    gun.GetInventory().CreateAttachment("PSO1Optic");
    addMags(player, "Mag_SVD_10Rnd", 3);

    return gun;
}

EntityAI smgClass(PlayerBase player)
{
    EntityAI gun = player.GetHumanInventory().CreateInHands("UMP45");
    gun.GetInventory().CreateAttachment("PistolSuppressor");
    addMags(player, "Mag_UMP_25Rnd", 3);

    return gun;
}

override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
{
    player.RemoveAllItems();

    player.GetInventory().CreateInInventory("TTSKOPants");
    player.GetInventory().CreateInInventory("TTsKOJacket_Camo");
    player.GetInventory().CreateInInventory("CombatBoots_Black");
    player.GetInventory().CreateInInventory("ImprovisedBag");

    player.GetInventory().CreateInInventory("SodaCan_Pipsi");
    player.GetInventory().CreateInInventory("SpaghettiCan");
    player.GetInventory().CreateInInventory("HuntingKnife");
    ItemBase rags = player.GetInventory().CreateInInventory("Rag");
    rags.SetQuantity(4);

    EntityAI primary;
    EntityAI axe = player.GetInventory().CreateInInventory("FirefighterAxe");

    switch (Math.RandomInt(0, 3)) {
        case 0: primary = assaultClass(player); break;
        case 1: primary = sniperClass(player); break;
        case 2: primary = smgClass(player); break;
    }

    player.LocalTakeEntityToHands(primary);
    player.SetQuickBarEntityShortcut(primary, 0, true);
    player.SetQuickBarEntityShortcut(rags, 2, true);
    player.SetQuickBarEntityShortcut(axe, 3, true);
}

};
  
Mission CreateCustomMission(string path)
{
	return new CustomMission();
}

вот что у меня в итоге получилось(вообще не работают ни точки спавна ни стартовая амуниция)


	void main()
{
	Hive ce = CreateHive();
	if ( ce )
		ce.InitOffline();

	Weather weather = g_Game.GetWeather();

	weather.GetOvercast().SetLimits( 0.0 , 1.0 );
	weather.GetRain().SetLimits( 0.0 , 1.0 );
	weather.GetFog().SetLimits( 0.0 , 0.25 );

	weather.GetOvercast().SetForecastChangeLimits( 0.0, 0.2 );
	weather.GetRain().SetForecastChangeLimits( 0.0, 0.1 );
	weather.GetFog().SetForecastChangeLimits( 0.15, 0.45 );

	weather.GetOvercast().SetForecastTimeLimits( 1800 , 1800 );
	weather.GetRain().SetForecastTimeLimits( 600 , 600 );
	weather.GetFog().SetForecastTimeLimits( 1800 , 1800 );

	weather.GetOvercast().Set( Math.RandomFloatInclusive(0.0, 0.3), 0, 0);
	weather.GetRain().Set( Math.RandomFloatInclusive(0.0, 0.2), 0, 0);
	weather.GetFog().Set( Math.RandomFloatInclusive(0.0, 0.1), 0, 0);

	weather.SetWindMaximumSpeed(15);
	weather.SetWindFunctionParams(0.1, 0.3, 50);
}

class CustomMission: MissionServer
{ 
	void SetRandomHealth(EntityAI itemEnt)
	{
		int rndHlt = Math.RandomInt(60,100);
		itemEnt.SetHealth("","",rndHlt);
	}
	
	override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
	{
		vector player_pos;
		int index;
		
		TVectorArray positions = { "10701.016 0 7952.518", "10604.016 0 8045.518", "10712.016 0 8133.518", "10779.016 0 8074.518", "10702.016 0 8058.518", };
	    index = Math.RandomInt(0, positions.Count() );
		
	    player_pos = positions.Get(index);
		
		Entity playerEnt;
		playerEnt = GetGame().CreatePlayer(identity, characterName, player_pos, 0, "NONE");//Creates random player
		Class.CastTo(m_player, playerEnt);
		
		GetGame().SelectPlayer(identity, m_player);
		
		return m_player;
	}

override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
{
	player.RemoveAllItems();
	EntityAI itemEnt;
	ItemBase itemBs;

	switch (Math.RandomInt(0, 1)) {
    
		case 0:
		 // тсско с калашом
		
			player.GetInventory().CreateInInventory("CoyoteBag_Green");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("TTSKOPants");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("TTsKOJacket_Camo");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("CombatBoots_Black");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("CombatKnife");itemBs = ItemBase.Cast(itemEnt);
			
			player.GetInventory().CreateInInventory("FNX45");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");itemBs = ItemBase.Cast(itemEnt);	
			player.GetInventory().CreateInInventory("Mag_AKM_30Rnd");itemBs = ItemBase.Cast(itemEnt); 
			player.GetInventory().CreateInInventory("Mag_AKM_30Rnd");itemBs = ItemBase.Cast(itemEnt);
			itemEnt = player.GetInventory().CreateInInventory( "akm" ); 
			itemEnt.GetInventory().CreateAttachment( "PSO11Optic" ); 
			itemEnt.GetInventory().CreateAttachment( "AK_WoodBttstck" ); 
			itemEnt.GetInventory().CreateAttachment( "AK_WoodHndgrd" );
			itemEnt.GetInventory().CreateAttachment( "AK_Suppressor" );
		break;
    
		
    
		case 1: 
		 // с Мка
			player.GetInventory().CreateInInventory("CoyoteBag_Green");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("GorkaPants_Autumn");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("GorkaEJacket_Autumn");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("CombatBoots_Black");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("CombatKnife");itemBs = ItemBase.Cast(itemEnt); 
			
			itemEnt = player.GetInventory().CreateInInventory( "M4A1_Black" ); 
			itemEnt.GetInventory().CreateAttachment( "M4_Suppressor" ); 
			itemEnt.GetInventory().CreateAttachment( "M4_RISHndgrd_Black" ); 
			itemEnt.GetInventory().CreateAttachment( "M4_MPBttstck_Black" );
			itemEnt.GetInventory().CreateAttachment( "ACOGOptic" );
			
			
			player.GetInventory().CreateInInventory("FNX45");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");itemBs = ItemBase.Cast(itemEnt);
			player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");itemBs = ItemBase.Cast(itemEnt);	
			player.GetInventory().CreateInInventory("Mag_STANAGCoupled_30Rnd");itemBs = ItemBase.Cast(itemEnt); 
			player.GetInventory().CreateInInventory("Mag_STANAGCoupled_30Rnd");itemBs = ItemBase.Cast(itemEnt); 
		break; 
    
		
	}	
};

Mission CreateCustomMission(string path)
{
return new CustomMission();
}

Помоги пожалуйсто эти скрипты мне уже снятся((((

Share this post


Link to post
Share on other sites
  • 0

mastaZz вы когда копируете у кого-то, вы хоть синтаксис и последовательность данных соблюдайте, ошибки в корректности заполнения массива точек спавна, и прочее по мелочам. Вот вам готовый инит, тупо замените.

P.S. Немного внес коррекций своих в коде. С вас пиво ;)

void main()
{
	Hive ce = CreateHive();
	if ( ce )
	ce.InitOffline();

	Weather weather = g_Game.GetWeather();

	weather.GetOvercast().SetLimits( 0.0 , 1.0 );
	weather.GetRain().SetLimits( 0.0 , 1.0 );
	weather.GetFog().SetLimits( 0.0 , 0.25 );

	weather.GetOvercast().SetForecastChangeLimits( 0.0, 0.2 );
	weather.GetRain().SetForecastChangeLimits( 0.0, 0.1 );
	weather.GetFog().SetForecastChangeLimits( 0.15, 0.45 );

	weather.GetOvercast().SetForecastTimeLimits( 1800 , 1800 );
	weather.GetRain().SetForecastTimeLimits( 600 , 600 );
	weather.GetFog().SetForecastTimeLimits( 1800 , 1800 );

	weather.GetOvercast().Set( Math.RandomFloatInclusive(0.0, 0.3), 0, 0);
	weather.GetRain().Set( Math.RandomFloatInclusive(0.0, 0.2), 0, 0);
	weather.GetFog().Set( Math.RandomFloatInclusive(0.0, 0.1), 0, 0);

	weather.SetWindMaximumSpeed(15);
	weather.SetWindFunctionParams(0.1, 0.3, 50);
}

class CustomMission: MissionServer
{ 
	void SetRandomHealth(EntityAI Loot)
	{
		int rndHlt = Math.RandomInt(60,100);
		Loot.SetHealth("","",rndHlt);
	}

	override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
	{
		array<string> positions = {"10701.016 0 7952.518", "10604.016 0 8045.518", "10712.016 0 8133.518", "10779.016 0 8074.518", "10702.016 0 8058.518"};
		pos = (positions.GetRandomElement()).ToVector();
		
		string Name_P = identity.GetName();
		string UID_P = identity.GetPlainId();
		string Game_UID_P = identity.GetId();
		string Game_ID_P = identity.GetPlayerId().ToString();
		string TEMP_MESSage_log = " Name: " + Name_P + " UID: " + UID_P + " GAME_UID: " + Game_UID_P;
		Print("[Respawn] Selected point '" + pos.ToString() + "' for spawn player:" + TEMP_MESSage_log);
		
		Entity playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");
		Class.CastTo(m_player, playerEnt);
		GetGame().SelectPlayer(identity, m_player);	

		return m_player;
	}	
	
	override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
	{
		player.RemoveAllItems();

		EntityAI Loot; EntityAI itemAttachment;
		ItemBase itemBs;
		
		switch (Math.RandomIntInclusive(0, 1))
		{
			case 0:
			{
			//ак
			
				Loot = player.GetInventory().CreateInInventory("CoyoteBag_Green");itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
				Loot = player.GetInventory().CreateInInventory("TTSKOPants");itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
				Loot = player.GetInventory().CreateInInventory("TTsKOJacket_Camo");itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
				Loot = player.GetInventory().CreateInInventory("CombatBoots_Black");itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
				Loot = player.GetInventory().CreateInInventory("CombatKnife");itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
				
				Loot = player.GetInventory().CreateInInventory("FNX45");itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
				Loot = player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
				Loot = player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);	
				Loot = player.GetInventory().CreateInInventory("Mag_AKM_30Rnd");itemBs = ItemBase.Cast(Loot);  SetRandomHealth(Loot);
				Loot = player.GetInventory().CreateInInventory("Mag_AKM_30Rnd");itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
				Loot = player.GetInventory().CreateInInventory( "akm" );  SetRandomHealth(Loot);
				itemAttachment = Loot.GetInventory().CreateAttachment( "PSO11Optic" );  SetRandomHealth(itemAttachment);
				itemAttachment = Loot.GetInventory().CreateAttachment( "AK_WoodBttstck" ); SetRandomHealth(itemAttachment);
				itemAttachment = Loot.GetInventory().CreateAttachment( "AK_WoodHndgrd" ); SetRandomHealth(itemAttachment);
				itemAttachment = Loot.GetInventory().CreateAttachment( "AK_Suppressor" ); SetRandomHealth(itemAttachment);
				itemBs = ItemBase.Cast(Loot); 
				break; 
			}
			case 1: 
			{
			//Мка
				Loot = player.GetInventory().CreateInInventory("CoyoteBag_Green");itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
				Loot = player.GetInventory().CreateInInventory("GorkaPants_Autumn");itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
				Loot = player.GetInventory().CreateInInventory("GorkaEJacket_Autumn");itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
				Loot = player.GetInventory().CreateInInventory("CombatBoots_Black");itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
				Loot = player.GetInventory().CreateInInventory("CombatKnife");itemBs = ItemBase.Cast(Loot);  SetRandomHealth(Loot);
				
				Loot = player.GetInventory().CreateInInventory( "M4A1_Black" );  SetRandomHealth(Loot);
				itemAttachment = Loot.GetInventory().CreateAttachment( "M4_Suppressor" ); SetRandomHealth(itemAttachment);
				itemAttachment = Loot.GetInventory().CreateAttachment( "M4_RISHndgrd_Black" );  SetRandomHealth(itemAttachment);
				itemAttachment = Loot.GetInventory().CreateAttachment( "M4_MPBttstck_Black" ); SetRandomHealth(itemAttachment);
				itemAttachment = Loot.GetInventory().CreateAttachment( "ACOGOptic" ); SetRandomHealth(itemAttachment);
				itemBs = ItemBase.Cast(Loot);
					
				Loot = player.GetInventory().CreateInInventory("FNX45");itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
				Loot = player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
				Loot = player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");itemBs = ItemBase.Cast(Loot);	 SetRandomHealth(Loot);
				Loot = player.GetInventory().CreateInInventory("Mag_STANAGCoupled_30Rnd");itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);  
				Loot = player.GetInventory().CreateInInventory("Mag_STANAGCoupled_30Rnd");itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
				break; 
			}
			/*	default:
			{
				//тупо ничего, это не обязательно
				break;
			}*/
		}
		// базовое
		Loot = player.GetInventory().CreateInInventory("Rag");
		itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
		itemBs.SetQuantity(4);
		Loot = player.GetInventory().CreateInInventory("SmershVestBackpack"); itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
		Loot = player.GetInventory().CreateInInventory("Ushanka_Black"); itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
		Loot = player.GetInventory().CreateInInventory("ThinFramesGlasses"); itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
		Loot = player.GetInventory().CreateInInventory("SalineBagIV"); itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
		Loot = player.GetInventory().CreateInInventory("Crowbar"); itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
		Loot = player.GetInventory().CreateInInventory("Roadflare"); itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
		Loot = player.GetInventory().CreateInInventory("CombatKnife"); itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
		Loot = player.GetInventory().CreateInInventory("landminetrap"); itemBs = ItemBase.Cast(Loot); SetRandomHealth(Loot);
		Loot = player.GetInventory().CreateInInventory("PersonalRadio");  SetRandomHealth(Loot);
			itemAttachment = Loot.GetInventory().CreateAttachment( "Battery9V" ); SetRandomHealth(itemAttachment);
		itemBs = ItemBase.Cast(Loot);

	}		
};
Mission CreateCustomMission(string path)
{
	return new CustomMission();
}

 

Share this post


Link to post
Share on other sites
  • 0

123new Спасибо большое что помогаешь, скинь цифры карты на пивасик закину))) если в 1 кейсе прописать

EntityAI gun = player.GetInventory().CreateInInventory("MP5K"); 
player.SetQuickBarEntityShortcut(gun, 0, true);

а во втором к примеру
 

EntityAI gun = player.GetInventory().CreateInInventory("akm");
player.SetQuickBarEntityShortcut(gun, 0, true);

то на этой строчке ошибка вылетает(((я понял что проще так сделать
 


void main()
{
	Hive ce = CreateHive();
	if ( ce )
	ce.InitOffline();

	Weather weather = g_Game.GetWeather();

	weather.GetOvercast().SetLimits( 0.0 , 1.0 );
	weather.GetRain().SetLimits( 0.0 , 1.0 );
	weather.GetFog().SetLimits( 0.0 , 0.25 );

	weather.GetOvercast().SetForecastChangeLimits( 0.0, 0.2 );
	weather.GetRain().SetForecastChangeLimits( 0.0, 0.1 );
	weather.GetFog().SetForecastChangeLimits( 0.15, 0.45 );

	weather.GetOvercast().SetForecastTimeLimits( 1800 , 1800 );
	weather.GetRain().SetForecastTimeLimits( 600 , 600 );
	weather.GetFog().SetForecastTimeLimits( 1800 , 1800 );

	weather.GetOvercast().Set( Math.RandomFloatInclusive(0.0, 0.3), 0, 0);
	weather.GetRain().Set( Math.RandomFloatInclusive(0.0, 0.2), 0, 0);
	weather.GetFog().Set( Math.RandomFloatInclusive(0.0, 0.1), 0, 0);

	weather.SetWindMaximumSpeed(15);
	weather.SetWindFunctionParams(0.1, 0.3, 50);
}

class CustomMission: MissionServer
{ 
	void SetRandomHealth(EntityAI Loot)
	{
		int rndHlt = Math.RandomInt(60,100);
		Loot.SetHealth("","",rndHlt);
	}

	override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
	{
		array<string> positions = {"10701.016 0 7952.518", "10604.016 0 8045.518", "10712.016 0 8133.518", "10779.016 0 8074.518", "10702.016 0 8058.518"};
		pos = (positions.GetRandomElement()).ToVector();
		
		string Name_P = identity.GetName();
		string UID_P = identity.GetPlainId();
		string Game_UID_P = identity.GetId();
		string Game_ID_P = identity.GetPlayerId().ToString();
		string TEMP_MESSage_log = " Name: " + Name_P + " UID: " + UID_P + " GAME_UID: " + Game_UID_P;
		Print("[Respawn] Selected point '" + pos.ToString() + "' for spawn player:" + TEMP_MESSage_log);
		
		Entity playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");
		Class.CastTo(m_player, playerEnt);
		GetGame().SelectPlayer(identity, m_player);	

		return m_player;
	}	
	
void addMags(PlayerBase player, string mag_type, int count)
{
    if (count < 1)
        return;

    EntityAI mag;

    for (int i = 0; i < count; i++) {
        mag = player.GetInventory().CreateInInventory(mag_type);
    }

    player.SetQuickBarEntityShortcut(mag, 1, true);
}

EntityAI assaultClass(PlayerBase player)
{
	EntityAI gun = player.GetInventory().CreateInInventory("M4A1");
	gun.GetInventory().CreateAttachment("M4_RISHndgrd_Black");
	gun.GetInventory().CreateAttachment("M4_MPBttstck_Black");
	gun.GetInventory().CreateAttachment("ACOGOptic");
	EntityAI aspants = player.GetInventory().CreateInInventory("TTSKOPants");
	EntityAI asjacket = player.GetInventory().CreateInInventory("TTsKOJacket_Camo");
    EntityAI asboots = player.GetInventory().CreateInInventory("CombatBoots_Black");
	EntityAI asmask = player.GetInventory().CreateInInventory("GasMask");
	EntityAI asbag = player.GetInventory().CreateInInventory("TortillaBag");
	addMags(player, "Mag_STANAG_30Rnd", 3);

    return gun;
}

EntityAI sniperClass(PlayerBase player)
{
	EntityAI gun = player.GetInventory().CreateInInventory("AKM");
	gun.GetInventory().CreateAttachment("AK_FoldingBttstck");
	gun.GetInventory().CreateAttachment("AK_RailHndgrd");
	gun.GetInventory().CreateAttachment("KashtanOptic");
    EntityAI asgh = player.GetInventory().CreateInInventory("GhillieHood_Woodland");
	EntityAI asgh2 = player.GetInventory().CreateInInventory("GhillieBushrag_Woodland");
	EntityAI asgpants = player.GetInventory().CreateInInventory("TTSKOPants");
	EntityAI asjacket = player.GetInventory().CreateInInventory("TTsKOJacket_Camo");
    EntityAI asgboots = player.GetInventory().CreateInInventory("CombatBoots_Black");
	addMags(player, "Mag_AKM_30Rnd", 3);

    return gun;
}

EntityAI smgClass(PlayerBase player)
{
	EntityAI gun = player.GetInventory().CreateInInventory("MP5K");
	gun.GetInventory().CreateAttachment("MP5k_StockBttstck");
	gun.GetInventory().CreateAttachment("MP5_PRailHndgrd");
	//gun.GetInventory().CreateAttachment("ACOGOptic"); // не правильно отображается
    EntityAI asboots = player.GetInventory().CreateInInventory("CombatBoots_Black");
    EntityAI asjacket = player.GetInventory().CreateInInventory("M65Jacket_Black");
	EntityAI asbal = player.GetInventory().CreateInInventory("BalaclavaMask_Black");
	EntityAI asbag = player.GetInventory().CreateInInventory("TortillaBag");
	EntityAI aspants = player.GetInventory().CreateInInventory("ShortJeans_Black");
	addMags(player, "Mag_MP5_30Rnd", 3);

    return gun;
}

override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
{
    player.GetStatStamina().Set(1000);
	player.RemoveAllItems();

    /*itemEnt = player.GetInventory().CreateInInventory("SodaCan_Pipsi");
    itemBs = ItemBase.Cast(itemEnt);
	itemEnt = player.GetInventory().CreateInInventory("SpaghettiCan");
    itemBs = ItemBase.Cast(itemEnt);
	itemEnt = player.GetInventory().CreateInInventory("CanOpener");
    itemBs = ItemBase.Cast(itemEnt);
	itemEnt = player.GetInventory().CreateInInventory("Rag");
    itemBs = ItemBase.Cast(itemEnt);
	ItemBase.Cast(rags).SetQuantity(4);*/
	
	EntityAI itemEnt;
    ItemBase itemBs;
	
	itemEnt = player.GetInventory().CreateInInventory("Rag");
		itemBs = ItemBase.Cast(itemEnt);
		itemBs.SetQuantity(4);
		SetRandomHealth(itemEnt);

    EntityAI primary;
    EntityAI axe = player.GetInventory().CreateInInventory("FirefighterAxe");
	EntityAI soda = player.GetInventory().CreateInInventory("SodaCan_Pipsi");
	EntityAI spagetti = player.GetInventory().CreateInInventory("SpaghettiCan");
	EntityAI opener = player.GetInventory().CreateInInventory("CanOpener");
	

    switch (Math.RandomInt(0, 3)) {
        case 0: primary = assaultClass(player); break;
        case 1: primary = sniperClass(player); break;
        case 2: primary = smgClass(player); break;
    }

    player.LocalTakeEntityToHands(primary);
    player.SetQuickBarEntityShortcut(primary, 0, true);
    player.SetQuickBarEntityShortcut(axe, 2, true);
    //player.SetQuickBarEntityShortcut(axe, 3, true);
}

};
  
  
  
Mission CreateCustomMission(string path)
{
	return new CustomMission();
}

только как сделать чтобы несколько магазинов в быстрый слот вставить я так и не понял(((

Share this post


Link to post
Share on other sites
  • 0

mastaZz а если так

EntityAI gun = player.GetInventory().CreateInInventory("MP5K"); 
player.SetQuickBarEntityShortcut(gun, 0, true);
EntityAI gun2 = player.GetInventory().CreateInInventory("FNX45");
player.SetQuickBarEntityShortcut(gun2, 1, true);

по логике должно быть нормально
А по поводу магазинов - так к каждому:

itemEnt = player.GetInventory().CreateInInventory("Mag_STANAGCoupled_30Rnd");itemBs = ItemBase.Cast(itemEnt);
player.SetQuickBarEntityShortcut(itemEnt, 2, true);

менять слот горячий.
если не прокатывает так, то

itemEnt = player.GetInventory().CreateInInventory("Mag_STANAGCoupled_30Rnd");itemBs = ItemBase.Cast(itemEnt);
player.SetQuickBarEntityShortcut(itemBs, 2, true);

Точно сам не проверял как правильно и как должно работать, надо эксперементировать.Не исключено, что часть функций может и не работать от сервера, т.к. они могут быть чисто клиентские.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you automaticly agree to our Guidelines and Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.