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

    Create a topic in the appropriate section
    Don't write everything in the chat!
  • Take a look at the marketplace

    There you can buy
    everything related to game servers
  • Don't want a ban?

    Please read our rules
    Don't disturb the order!
  • Sell or buy?

    Use services of the guarantor
    We will make your deal safe
  • 0
hooligan334

unlimited weight

20 answers to this question

Recommended Posts










  • 0

hooligan334 may be in PlayerBase:

 

try to modding this functions

 

	float GetPlayerLoad()
	{
		return m_CargoLoad;
	}
	
	bool IsOverloaded()
	{
		if ( GetPlayerLoad() >= OVERLOAD_LIMIT ) return true;
		return false;
	}

	void SetPlayerLoad(float load)
	{
		m_CargoLoad = load;
		
		//Log(ToString(this) + "'s load weight is " + ftoa(m_CargoLoad) + " g.", LogTemplates.TEMPLATE_PLAYER_WEIGHT);
	}

	void AddPlayerLoad(float addedload)
	{
		float newload = GetPlayerLoad() + addedload;
		SetPlayerLoad(newload);
		
		// Do not need -> Log is in SetPlayerLoad
		//PrintString(ToString(this) + "'s load weight is " + ToString(m_CargoLoad) + " g.");
	}

	void CalculatePlayerLoad()
	{
		EntityAI attachment;
		ItemBase itemHands;
		
		itemHands = GetItemInHands();
		int attcount = this.GetInventory().AttachmentCount();
		int total_load = 0;
		
		for (int att = 0; att < attcount; att++)
		{	
			attachment = GetInventory().GetAttachmentFromIndex(att);
			if( attachment )
			{
				total_load += attachment.GetItemWeight();
			}
		}

		if ( itemHands ) // adds weight of item carried in hands
			total_load += itemHands.GetItemWeight();

		SetPlayerLoad(total_load);
	}

 

Share this post


Link to post
Share on other sites
  • 0

BorizzK crash

Can't compile mission init script'!

$CurrentDir:mpmissions\dayzOffline.chernarusplus\init.c(275): Can't find variable 'm_CargoLoad'

init.c

	override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
	{
		Entity playerEnt;
		playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
		Class.CastTo(m_player, playerEnt);
		
		 g_Game.SendMessage(
         false,
         identity,
         "Server Login:",
         "Welcome "+identity.GetName() + ", enjoy your stay! Please make sure to read our rules! Trader Located Green Mountain And Kumyrna!!",
         10,
         2,
         false,
         true,
         "",
         0,
         0);
        GetGame().SelectPlayer(identity, m_player);
		return m_player;
		
	}
	
    float GetPlayerLoad()
	{
		return m_CargoLoad;
	}
	
	bool IsOverloaded()
	{
		if ( GetPlayerLoad() >= OVERLOAD_LIMIT ) return true;
		return false;
	}

	void SetPlayerLoad(float load)
	{
		m_CargoLoad = load;
		
		//Log(ToString(this) + "'s load weight is " + ftoa(m_CargoLoad) + " g.", LogTemplates.TEMPLATE_PLAYER_WEIGHT);
	}

	void AddPlayerLoad(float addedload)
	{
		float newload = GetPlayerLoad() + addedload;
		SetPlayerLoad(newload);
		
		// Do not need -> Log is in SetPlayerLoad
		//PrintString(ToString(this) + "'s load weight is " + ToString(m_CargoLoad) + " g.");
	}

	void CalculatePlayerLoad()
	{
		EntityAI attachment;
		ItemBase itemHands;
		
		itemHands = GetItemInHands();
		int attcount = this.GetInventory().AttachmentCount();
		int total_load = 0;
		
		for (int att = 0; att < attcount; att++)
		{	
			attachment = GetInventory().GetAttachmentFromIndex(att);
			if( attachment )
			{
				total_load += attachment.GetItemWeight();
			}
		}

		if ( itemHands ) // adds weight of item carried in hands
			total_load += itemHands.GetItemWeight();

		SetPlayerLoad(total_load);
	}

	 override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
	{
		EntityAI itemTop;
		EntityAI itemEnt;
		ItemBase itemBs;
		float rand;
		
		itemTop = player.FindAttachmentBySlotName("Body");
		
		if ( itemTop )
		{
			itemEnt = itemTop.GetInventory().CreateInInventory("Rag");
			if ( Class.CastTo(itemBs, itemEnt ) )
				itemBs.SetQuantity(4);

			SetRandomHealth(itemEnt);
			
			itemEnt = itemTop.GetInventory().CreateInInventory("RoadFlare");
			SetRandomHealth(itemEnt);
			
			rand = Math.RandomFloatInclusive(0.0, 1.0);
			if ( rand < 0.35 )
				itemEnt = player.GetInventory().CreateInInventory("Apple");
			else if ( rand > 0.65 )
				itemEnt = player.GetInventory().CreateInInventory("Pear");
			else
				itemEnt = player.GetInventory().CreateInInventory("Plum");
		
			SetRandomHealth(itemEnt);
		}
	}
        
};

 

Share this post


Link to post
Share on other sites
  • 0
7 часов назад, hooligan334 сказал:

123new  and where I have it write??

as sample add this function

void SpawnObject( string type, vector position, vector orientation )
{
  auto obj = GetGame().CreateObject( type, "0 0 0" );
  if(obj)
  {
	obj.SetPosition( position );
	obj.SetOrientation( orientation );
	Print("[SpawnObject] Object='" + obj.GetType()  + "' in position='" + obj.GetPosition().ToString() + "' and with orientation='" + obj.GetOrientation().ToString() + "' has been spawned successfull!");
  } else
  {
      Print("[SpawnObject] Object='" + type + "' in position='" + position.ToString() + "' and with orientation='" + orientation.ToString() + "' don't spawned!");
  }
}

and use him with his command

SpawnObject( "OffroadHatchback", "14760.700195 34.657902 13322.099609", "0.000000 0.000000 0.000000" );
SpawnObject( "AK101", "14760.700195 34.657902 13322.099609", "0.000000 0.000000 0.000000" );

 

Share this post


Link to post
Share on other sites
  • 0
1 час назад, hooligan334 сказал:

123new and after rebooting won't double the items?

no, its will be

Share this post


Link to post
Share on other sites
  • 0

123new 

SpawnObject( "OffroadHatchback", "14760.700195 34.657902 13322.099609", "0.000000 0.000000 0.000000" );
SpawnObject( "AK101", "14760.700195 34.657902 13322.099609", "0.000000 0.000000 0.000000" );

add init.c?

 

//Spawn helper function
void SpawnObject( string type, vector position, vector orientation )
{
  auto obj = GetGame().CreateObject( type, "0 0 0" );
  if(obj)
  {
	obj.SetPosition( position );
	obj.SetOrientation( orientation );
	Print("[SpawnObject] Object='" + obj.GetType()  + "' in position='" + obj.GetPosition().ToString() + "' and with orientation='" + obj.GetOrientation().ToString() + "' has been spawned successfull!");
  } else
  {
      Print("[SpawnObject] Object='" + type + "' in position='" + position.ToString() + "' and with orientation='" + orientation.ToString() + "' don't spawned!");
  }
}

void main()
{
SpawnObject( "OffroadHatchback", "14760.700195 34.657902 13322.099609", "0.000000 0.000000 0.000000" );

 

Edited by hooligan334 (see edit history)

Share this post


Link to post
Share on other sites
  • 0

hooligan334 because in every start server will be runned command

 SpawnObject( "FAL", "4696.08 7 2405.24", "0.000000 0.000000 0.000000" );

and a new copy object will be spawned.

 

Share this post


Link to post
Share on other sites
  • 0

123new 

how to remove these items after rebooting??

void loot()
{
//Your custom spawned objects
SpawnObject( "CamoNetShelter", "14076.541992 136.752670 14976.748047", "137.618942 0.000000 0.000000" );
SpawnObject( "SeaChest", "14075.116211 136.884155 14978.248047", "50.000004 0.000000 -4.890675" );
SpawnObject( "AK101", "14076.048828 137.054703 14978.978516", "151.460526 85.055412 -45.103710" );
SpawnObject( "AK101", "14076.253906 137.067352 14978.034180", "-178.111877 83.078133 95.316048" );
SpawnObject( "AK101", "14073.862305 136.909302 14977.678711", "1.888104 -83.078133 -127.007103" );
SpawnObject( "AK101", "14074.860352 136.838364 14976.963867", "26.565048 -89.486038 -44.056740" );
SpawnObject( "AK101", "14073.970703 137.166077 14979.407227", "1.888104 -83.078133 -15.931926" );
SpawnObject( "TacticalGloves_Green", "14075.659180 136.773331 14978.079102", "104.140404 -1.475789 6.763414" );
SpawnObject( "JungleBoots_Green", "14075.958008 137.148819 14982.344727", "102.247910 -3.234643 3.741717" );
SpawnObject( "JungleBoots_Green", "14071.146484 136.822861 14978.212891", "-28.928053 5.952151 -3.539577" );
SpawnObject( "BDUJacket", "14075.393555 137.077988 14980.287109", "-37.583660 4.883367 -0.776322" );
SpawnObject( "BDUJacket", "14072.715820 136.705734 14977.149414", "162.402802 -0.367610 0.357007" );
SpawnObject( "UKAssVest_Khaki", "14077.089844 136.798172 14978.388672", "55.605129 0.505675 4.918680" );
};

 

Share this post


Link to post
Share on other sites
  • 0
4 часа назад, hooligan334 сказал:

123new 

how to remove these items after rebooting??


void loot()
{
//Your custom spawned objects
SpawnObject( "CamoNetShelter", "14076.541992 136.752670 14976.748047", "137.618942 0.000000 0.000000" );
SpawnObject( "SeaChest", "14075.116211 136.884155 14978.248047", "50.000004 0.000000 -4.890675" );
SpawnObject( "AK101", "14076.048828 137.054703 14978.978516", "151.460526 85.055412 -45.103710" );
SpawnObject( "AK101", "14076.253906 137.067352 14978.034180", "-178.111877 83.078133 95.316048" );
SpawnObject( "AK101", "14073.862305 136.909302 14977.678711", "1.888104 -83.078133 -127.007103" );
SpawnObject( "AK101", "14074.860352 136.838364 14976.963867", "26.565048 -89.486038 -44.056740" );
SpawnObject( "AK101", "14073.970703 137.166077 14979.407227", "1.888104 -83.078133 -15.931926" );
SpawnObject( "TacticalGloves_Green", "14075.659180 136.773331 14978.079102", "104.140404 -1.475789 6.763414" );
SpawnObject( "JungleBoots_Green", "14075.958008 137.148819 14982.344727", "102.247910 -3.234643 3.741717" );
SpawnObject( "JungleBoots_Green", "14071.146484 136.822861 14978.212891", "-28.928053 5.952151 -3.539577" );
SpawnObject( "BDUJacket", "14075.393555 137.077988 14980.287109", "-37.583660 4.883367 -0.776322" );
SpawnObject( "BDUJacket", "14072.715820 136.705734 14977.149414", "162.402802 -0.367610 0.357007" );
SpawnObject( "UKAssVest_Khaki", "14077.089844 136.798172 14978.388672", "55.605129 0.505675 4.918680" );
};

 

need add a few check this loot in position ando a new spawn, or use official system loot server with types.xml

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • 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.