Jump to content

Forums Announcement

Read-Only Mode for Announcements & Changelogs

Dear Survivors, we'd like to inform you that this forum will transition to read-only mode. From now on, it will serve exclusively as a platform for official announcements and changelogs.

For all community discussions, debates, and engagement, we encourage you to join us on our social media platforms: Discord, Twitter/X, Facebook.

Thank you for being a valued part of our community. We look forward to connecting with you on our other channels!

Stay safe out there,
Your DayZ Team

Sign in to follow this  
Jim1120

Conditions for using another mod with #ifdef

Recommended Posts

hello everyone, I'm new to creating mod dayz.
I managed to make a mistletoe personalize but I block on a simple thing.
I would like to change the value of a variable if a mod has defined a constant.


For example the heros and bandits mod defines the HEROESANDBANDITSMOD constant like this
#define HEROESANDBANDITSMOD

In my mistletoe I seek to display the level of the player thanks to this mod without it denien obligatory of use.

So I did:

	private void Karma()	{
		if(GetGame().IsClient() || !GetGame().IsMultiplayer())	{
			if (Player){
				#ifdef HEROESANDBANDITSMOD
					m_Karma.SetText( GetHeroesAndBandits().GetPlayerAffinity(Player.GetIdentity().GetPlainId()) );
				#else
					m_Karma.SetText( "Bambi défaut" );
				#endif
			}
		}
	}


Or again like this:

	private void Karma()	{
		if(GetGame().IsClient() || !GetGame().IsMultiplayer())	{
			if (Player){
				m_Karma.SetText( "Bambi défaut" );
				
				#ifdef HEROESANDBANDITSMOD
					m_Karma.SetText( GetHeroesAndBandits().GetPlayerAffinity(Player.GetIdentity().GetPlainId()) );
				#endif
			}
		}
	}


When I put: m_Karma.SetText (GetHeroesAndBandits (). GetPlayerAffinity (Player.GetIdentity (). GetPlainId ())) without the condition of the mod it works fine.

But when I put the condition #ifdef I have in string text "Bambi défaut" everytime, but I don't see what's bothering ...

Do you have any idea please?

In advance thank you very much

Edited by Jim1120
Add syntax

Share this post


Link to post
Share on other sites
Sign in to follow this  

×