Jump to content
definiteintegral

Modifying constants.c and playerconstants.c not working

Recommended Posts

Hello,

I am trying to create a mod that will modify constants.c and playerconstants.c. I would like to pack this as a PBO and not modify the original files on server side.

At this stage I am trying to modify metabolic speed and stamina drain. But, no matter what I do, it seems to have no effect.

I have followed the instructions here on basic mod setup: https://community.bistudio.com/wiki/DayZ:Modding_Basics
Also this about modifying constants: https://community.bistudio.com/wiki/DayZ:Enforce_Script_Syntax#Modded_constants

Also I have looked at various mods that alter these files, for example this one which alters the health regen constant: https://gitlab.desolationredux.com/DayZ/DayZBR-Mod/BattleRoyale

It seems like my setup is the same as the examples, but for some reason, it won't work.

My folder structure is:

  • scripts
    • config.cpp
    • 3_game
      • constants.c
      • playerconstants.c

Config.cpp looks like this:

class CfgPatches
{
	class NAMServerCustom
	{
		units[] = {};
		weapons[] = {};
		requiredVersion = 0.1;
		requiredAddons[] = { "DZ_Data" };
	};	
};

class CfgMods
{
	class NAMServerCustom
	{
		type = "mod";
		
		dir = "NAMServerCustom";
		author = "DeliciousWhales";
		name = "NAMServerCustom";
		url = "";
		version="0.1";
		
		dependencies[] = { "Game" };
		
		class defs
		{
			class gameScriptModule
			{
				value = ""; 
				files[] = {"NAMServerCustom/Scripts/3_Game"};
			};
		};
	};
};

playerconstants.c:

modded class PlayerConstants 
{
	static const float METABOLIC_SPEED_ENERGY_BASAL		= 0.005;		//energy loss per second while idle
	
	static const float METABOLIC_SPEED_ENERGY_WALK		= 0.05;		//energy loss per second
	static const float METABOLIC_SPEED_ENERGY_JOG		= 0.15;		//energy loss per second
	static const float METABOLIC_SPEED_ENERGY_SPRINT	= 0.3;		//energy loss per second
	
	static const float METABOLIC_SPEED_WATER_BASAL		= 0.005;		//water loss per second while idle
	
	static const float METABOLIC_SPEED_WATER_WALK		= 0.05;		//water loss per second
	static const float METABOLIC_SPEED_WATER_JOG		= 0.15;		//water loss per second
	static const float METABOLIC_SPEED_WATER_SPRINT		= 0.3;		//water loss per second
	
}

constants.c:

modded class GameConstants
{
	// unit = currently percent (stamina max is 100)
	const int 	STAMINA_DRAIN_STANDING_SPRINT_PER_SEC = 1.3; //in units (how much sprint depletes stamina)
	const int 	STAMINA_DRAIN_CROUCHED_SPRINT_PER_SEC = 0.33; //in units (how much sprint in crouch depletes stamina)
	const int 	STAMINA_DRAIN_PRONE_SPRINT_PER_SEC = 1; //in units (how much sprint in prone depletes stamina)
	const int	STAMINA_DRAIN_SWIM_FAST_PER_SEC = 1.6; //in units (how much fast swimming depletes stamina)
	const int	STAMINA_DRAIN_LADDER_FAST_PER_SEC = 2.6; //in units (how much fast ladder climb depletes stamina)

}

With this setting, it should be possible to sprint for 75 seconds, instead of the usual 25.

I pack from the root folder, so my packed PBO has files in it in the same structure as listed at the top.

The folder I use to publish to Workshop is like so:

  • Addons
    • NAMServerCustom.pbo
    • NAMServerCustom.pbo.DeliciousWhales.bisign
  • Keys
    • DeliciousWhales.bikey
  • mod.cpp

After publishing to Workshop, I update the mod via the launcher, as well as uploading the @NAMServerCustom folder to the server, and restart the server. The mod is added to @mod= on the server, and is the last mod in the list. It does get listed first in the launcher when joining the server.

Server starts up just fine. But..... there is no change to the game behaviour. I can still only sprint for 25 seconds.

Does anyone know what I am missing.. ?

 

Share this post


Link to post
Share on other sites

Greetings.

1st you shall understand that in game there's 2 type of addons.

a) Client-addon addon (need on both sides server and client)

b) Server mod (required only on server-side and will be downloaded automatically on user connected).

A-type connection over -mod=... and required keys.

B-type only on server-side and not required the keys. Connection to the server through -server-mod=...

For editing of Constants you required server-side mod that should be enough.

But keep in your head that paths must be the same like in overrited addons. For example: "scrips\blackjack\h**kers.c", and in your server-side mod it should be like "MyBlackJackAndHo\blackjack\h**kers.c".

That's should be enough for make your addon working.

Also keep in mind that Server-side addon has no rights for working with the clients GUI and dialogs.

 

Also checkout mission files there there's some overrides of constants and it's not required server side mods

Edited by Sid Debian
Fixes

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

×