Jump to content
Sign in to follow this  
Gurkenkoenig

plz help with most basic mod

Recommended Posts

hey,

i'm a pleb when it comes to programming. my group runs a dedi server, so for everything we wanted to change until now i just changed the xml's and stuff directly in the pbo's.

and that worked great for stuff like changing stamina, metabolism and cars. but now i want to do it trough mods. because i realised every time there is an update it will overwrite my changes.

so i went and got a few mods from the workshop, to try and reverse engineer them into my own basic stuff. but i cant figure it out for the life of me.

so the most basic thing i wanna do is change this line in 3_Game/constants.c with a mod

const int     STAMINA_DRAIN_STANDING_SPRINT_PER_SEC = 5; //in units (how much sprint depletes stamina)

how would i do that? or do i have to change it in 4_World/StaminaHandler.c?

can someone upload a super basic mod/video that does this? i would love you to pieces.

cheers.

 

Share this post


Link to post
Share on other sites

You can not overwrite constans even with a Mod. You need to make changes in the staminahandler. If you need help with installing mods or basic server configuration you can use my DayZ Toolbox. I try to release my Servermanager today, if no other bugs appear. 

LBmaster

Share this post


Link to post
Share on other sites
2 minutes ago, lbmaster said:

You can not overwrite constans even with a Mod. You need to make changes in the staminahandler. If you need help with installing mods or basic server configuration you can use my DayZ Toolbox. I try to release my Servermanager today, if no other bugs appear. 

LBmaster

yes thats what i mean. pretty sure that its only a few lines to change that single line. but idk how, i would like to learn that. could you make an example?

Share this post


Link to post
Share on other sites
7 minutes ago, Gurkenkoenig said:

yes thats what i mean. pretty sure that its only a few lines to change that single line. but idk how, i would like to learn that. could you make an example?

I will have a look when i'm home should not be too complicated

Share this post


Link to post
Share on other sites

I came up with two possible solutions (I did not have enough time to test it, but it should give you an idea on how to do it)

If you just want to disable stamina completly you can use the following code:

modded class StaminaHandler
{	
	float m_Time2 = 0.0;
	override void Update(float deltaT, int pCurrentCommandID)
	{
		// Stamina needs to be synchonized with the client !
		m_Time2 += deltaT;
		if ( m_StaminaParams && m_Time2 >= STAMINA_SYNC_RATE )
			{
				m_Time2 = 0;
				m_StaminaParams.param1 = STAMINA_MAX;
				m_StaminaParams.param2 = STAMINA_MAX;
				GetGame().RPCSingleParam(m_Player, ERPCs.RPC_STAMINA, m_StaminaParams, true, m_Player.GetIdentity());
			}
		return;
	}
}

If you want to double / trippe ... the stamina you can use this:

modded class StaminaHandler
{	
	
	float factor = 0.5; // Double the Stamina // Do not set is too Low ! Stamina Sync is connected to that
	float m_Time2 = 0.0;

	override void Update(float deltaT, int pCurrentCommandID)
	{
		super.Update(deltaT * factor, pCurrentCommandID);
		// If factor is set really low activate the following method
		/*
		if ( GetGame().IsServer() && GetGame().IsMultiplayer() )
			{
				m_Time2 += deltaT;
				if ( m_StaminaParams && m_Time2 >= STAMINA_SYNC_RATE )
				{
					m_Time2 = 0;
					m_StaminaParams.param1 = m_Stamina;
					m_StaminaParams.param2 = m_StaminaCap;
					GetGame().RPCSingleParam(m_Player, ERPCs.RPC_STAMINA, m_StaminaParams, true, m_Player.GetIdentity());
				}
			}
		
		*/
	}
}

Hopy this will help you.

LBmaster

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×