[SDK] Advanced Diplomacy

yo afforess, I'd like to ask about the embassy visibility, I've been playing the mod, I just experience the visibility problem, can't see the capital of the civ I have an embassy with.

Anyways, thanks for the cool mod :)
 
Imo he copied the text from his AND mod. The capital feature is not implemented in AD, maybe still bugged in AND.
 
yo afforess, I'd like to ask about the embassy visibility, I've been playing the mod, I just experience the visibility problem, can't see the capital of the civ I have an embassy with.

Anyways, thanks for the cool mod :)

I removed it, the text is just out of date. The problem is that I don't understand Civ4's visibility system. The feature didn't work right. If someone else does understand Civ4's visibility system, they are free to add it back.
 
Thanks for the modcomp! I just added part of it to Planetfall, but I'm wondering about a snippet of code:

Code:
DenialTypes CvPlayerAI::AI_civicTrade(CivicTypes eCivic, PlayerTypes ePlayer) const
{
	if (isHuman())
	{
		return NO_DENIAL;
	}
/************************************************************************************************/
/* Afforess	                  Start		 04/05/10                                               */
/*                                                                                              */
/*                                                                                              */
/************************************************************************************************/
	if (GC.getGameINLINE().isOption(GAMEOPTION_ADVANCED_DIPLOMACY))
	{
		if (GET_TEAM(getTeam()).isAtWar(GET_PLAYER(ePlayer).getTeam()))
		{
			return NO_DENIAL;
		}
	}
/************************************************************************************************/
/* Afforess	                     END                                                            */
/************************************************************************************************/
	if (GET_TEAM(getTeam()).isVassal(GET_PLAYER(ePlayer).getTeam()))
	{
		return NO_DENIAL;
	}

	if (atWar(getTeam(), GET_PLAYER(ePlayer).getTeam()))
	{
		return NO_DENIAL;
	}

Why did you add your lines while a couple lines lower there already is an atWar check?
 
I've been using Advanced Diplo merged with my personal mod, and it has worked perfectly. It has turned out to be an excellent add-on. But there is something I'd like to do and help would be appreciated: Adding conditions for certain trades based on vecinity, connectivity, techs and/or distance:
1) Vecinity: A trade can only be available if the two civs have touching borders. (In the same way EventTriggerInfos.xml allow some events to happen only if there're touching borders)
2) Connectivity: A trade can only be available if the two civs are connected through their trade networks.
3) Distance: A trade can only be available if palace-to-palace distance is less than some thershold.
4) Tech: A trade can only be available if at least one of the two civs has a certain tech.

In general I dislike the low importance Civ4 gives to geography; the game is too willing to allow civs to operate on a global (planet-wide) scale from the start. I've been fighting that in my mod in several ways through xml and python, but diplomacy remains out of my reach. I suppose these sort of conditions can be achieved simply adding the right "if" lines in the code, but I don't know where exactly or how such conditions must be written, as my C++ knowledge is close to null.

Thanks
 
Thanks for the modcomp! I just added part of it to Planetfall, but I'm wondering about a snippet of code:

Code:
DenialTypes CvPlayerAI::AI_civicTrade(CivicTypes eCivic, PlayerTypes ePlayer) const
{
	if (isHuman())
	{
		return NO_DENIAL;
	}
/************************************************************************************************/
/* Afforess	                  Start		 04/05/10                                               */
/*                                                                                              */
/*                                                                                              */
/************************************************************************************************/
	if (GC.getGameINLINE().isOption(GAMEOPTION_ADVANCED_DIPLOMACY))
	{
		if (GET_TEAM(getTeam()).isAtWar(GET_PLAYER(ePlayer).getTeam()))
		{
			return NO_DENIAL;
		}
	}
/************************************************************************************************/
/* Afforess	                     END                                                            */
/************************************************************************************************/
	if (GET_TEAM(getTeam()).isVassal(GET_PLAYER(ePlayer).getTeam()))
	{
		return NO_DENIAL;
	}

	if (atWar(getTeam(), GET_PLAYER(ePlayer).getTeam()))
	{
		return NO_DENIAL;
	}

Why did you add your lines while a couple lines lower there already is an atWar check?

I missed that - It's duplicate code then, feel free to remove it.

I've been using Advanced Diplo merged with my personal mod, and it has worked perfectly. It has turned out to be an excellent add-on. But there is something I'd like to do and help would be appreciated: Adding conditions for certain trades based on vecinity, connectivity, techs and/or distance:
1) Vecinity: A trade can only be available if the two civs have touching borders. (In the same way EventTriggerInfos.xml allow some events to happen only if there're touching borders)
2) Connectivity: A trade can only be available if the two civs are connected through their trade networks.
3) Distance: A trade can only be available if palace-to-palace distance is less than some thershold.
4) Tech: A trade can only be available if at least one of the two civs has a certain tech.

In general I dislike the low importance Civ4 gives to geography; the game is too willing to allow civs to operate on a global (planet-wide) scale from the start. I've been fighting that in my mod in several ways through xml and python, but diplomacy remains out of my reach. I suppose these sort of conditions can be achieved simply adding the right "if" lines in the code, but I don't know where exactly or how such conditions must be written, as my C++ knowledge is close to null.

Thanks

You need to look in CvPlayer::canTradeItem, that controls which trades can be made. Your ideas are a bit involved, you might want to start a thread in the SDK/Python forum. If you are comfortable with python, you should have little trouble adapting to C++.
 
Hey Afforess,

Just a question. Have you tested if you can propose a RoP or establish an embassy if you enable them on an earlier tech than writing, i.e. hunting?
I can propose a RoP or establish an embassy after researching writing, not earlier.
 
Hey Afforess,

Just a question. Have you tested if you can propose a RoP or establish an embassy if you enable them on an earlier tech than writing, i.e. hunting?
I can propose a RoP or establish an embassy after researching writing, not earlier.

No - But it should work, since it is in the XML, and is processed in CvTeam::processTech (IIRC)

Are you saying it isn't working correctly? Are you trying to allow players to use those two trading options right out of the gate? If so, there's an easier way to do that then messing with techs. Remove the Tech prereq checks in CvPlayer::canTradeItem. ;)
 
No - But it should work, since it is in the XML, and is processed in CvTeam::processTech (IIRC)

Are you saying it isn't working correctly? Are you trying to allow players to use those two trading options right out of the gate? If so, there's an easier way to do that then messing with techs. Remove the Tech prereq checks in CvPlayer::canTradeItem. ;)

In my mod (AI)-players won't get these options right from the start. The options become available after researching an ancient tech (even earlier in my mod).
Strange thing is that AI can propose RoP and embassies after researching the appropriate tech to the human, but not the other way around.
I'm using BUG 4.2, BBAI 1.01f, then merged AD. I did it twice and that's no fun :p
BTW, have you thought about my earlier suggestions:
1. Add a small icon for embassy trading and RoP-agreements in the techtree.
2. A prereq-tech for contact-trading and unit-trading
3. An icon in the techtree for 2.
and now we're at it:
4. Adjust the Foreign Advisor - Relations screen (for BUG) to make RoP and embassies visible.

Another question:
If you buy a unit, will it appear in your capital? Also if you sell a unit, will it appear in the capital of the buyer?

Anyway thanks for this great modcomp :goodjob:
 
Strange thing is that AI can propose RoP and embassies after researching the appropriate tech to the human, but not the other way around.

Okay... At first I thought I had forgot to check both teams, and only checked one of the teams, but you can see right here, both are checked:

Code:
if (GET_TEAM(getTeam()).isEmbassyTrading() || GET_TEAM(GET_PLAYER(eWhoTo).getTeam()).isEmbassyTrading())

That checks that either our team can trade embassies OR their team can trade embassies. So the code is fine.


1. Add a small icon for embassy trading and RoP-agreements in the techtree.
2. A prereq-tech for contact-trading and unit-trading
3. An icon in the techtree for 2.
and now we're at it:

Those I could add - it would require that I add new widgets and stuff. It's a surprising amount of work for a little feature, trust me... I'd ad it, but we have 3 days until I don't care any more. Sorry. If you attempt themselves, I'd be happy to offer my support, but other than that, not happening.

4. Adjust the Foreign Advisor - Relations screen (for BUG) to make RoP and embassies visible.

Again - I avoid python at all costs...
Another question:
If you buy a unit, will it appear in your capital? Also if you sell a unit, will it appear in the capital of the buyer?

Correct. The only exception is when you purchase a naval unit. If your capital is not on the water, it searches for the next coastal city, and places it there. If you have no coastal cities, naval units will not appear to be purchasable in the first place.
 
Okay... At first I thought I had forgot to check both teams, and only checked one of the teams, but you can see right here, both are checked:

Code:
if (GET_TEAM(getTeam()).isEmbassyTrading() || GET_TEAM(GET_PLAYER(eWhoTo).getTeam()).isEmbassyTrading())

That checks that either our team can trade embassies OR their team can trade embassies. So the code is fine.

Thanks, I'll double check this. For the other stuff, I think it ain't gonna happen either ;)
 
...but we have 3 days until I don't care any more. Sorry. If you attempt themselves, I'd be happy to offer my support, but other than that, not happening.
Uff! That sounds definitive... Before you turn to CiV completely, would you be so kind to relase your "realistic corporatipons" as a standalone mod/modcomp? I would be very grateful for that. I feel rather anxious now (3 more days...). :(
 
Uff! That sounds definitive... Before you turn to CiV completely, would you be so kind to relase your "realistic corporatipons" as a standalone mod/modcomp? I would be very grateful for that. I feel rather anxious now (3 more days...). :(

Possibly. Demands are queuing up...
 
So i went to CvPlayer.cpp, found the canTradeItem function, and replaced these lines...

Code:
    case TRADE_CONTACT:
		if (GC.getGameINLINE().isOption(GAMEOPTION_ADVANCED_DIPLOMACY))
		{
			if (!GET_TEAM((TeamTypes)item.m_iData).isMinorCiv())
			{
				if (!GET_TEAM(GET_PLAYER(eWhoTo).getTeam()).isHasMet((TeamTypes)(item.m_iData)) && GET_TEAM(getTeam()).isHasMet((TeamTypes)(item.m_iData)))
				{
					return true;
				}
			}
		}
        break;

for these...

Code:
    case TRADE_CONTACT:
		if (GC.getGameINLINE().isOption(GAMEOPTION_ADVANCED_DIPLOMACY))
		{
			return false;
		}
        	break;

It was really only a test, as this should disable completely contact trading but it didn't work. They kept offering contacts for sale. What did I do wrong?
 
Possibly. Demands are queuing up...
Yeah, I read all the requests people have. And I understand that esp. AND has priority. Too bad my (low-end) machine isn't capable of running ROM/AND - and also Civ5 for that matter. That's why I kept asking for having that awesome "realistic corporations" feature as a mod/mod comp while you advance to Civ5. :) Well, I will patiently wait until you have worked through all the other requests. ;)
 
hey afforess,

ive merged revdcm 2.8 pre release 3 with advanced diplo, and i see that there is a lot similarities in the code of advanced diplo and ruthless ai.

im not sure ive made the ,merge right,
where there where differences, i kept the part of advanced diplo over the ruthless code.
stuff like trade diplomacy and more parts.

i hope that was a right thing to do.
 
Is there a way of the game automatically running this so I dont have to go ot the ingame menu and load tis?
 
Top Bottom