maddog7667
Chieftain
- Joined
- Oct 31, 2005
- Messages
- 15
i figured i would ask this as i cannot find anything about adding diplomacy and could use a little help
i trying to get this to work so the ai player demands cities as tribute from the human player sadly there is very little info about adding extra diplomacy i can compile the dll with no errors do you think these lines will work?
using vs 2003 on win xp sp3 if that means anything
if (GET_PLAYER((PlayerTypes)iI).isHuman() && (GET_TEAM(getTeam()).getLeaderID() == getID()))
{
if (GET_TEAM(getTeam()).canDeclareWar(GET_PLAYER((PlayerTypes)iI).getTeam()) && !GET_TEAM(getTeam()).AI_isSneakAttackPreparing(GET_PLAYER((PlayerTypes)iI).getTeam()))
{
if (GET_TEAM(GET_PLAYER((PlayerTypes)iI).getTeam()).getDefensivePower() < GET_TEAM(getTeam()).getPower(true))
{
if (AI_getAttitude((PlayerTypes)iI) <= GC.getLeaderHeadInfo(GET_PLAYER((PlayerTypes)iI).getPersonalityType()).getDemandTributeAttitudeThreshold())
{
if (AI_getContactTimer(((PlayerTypes)iI), CONTACT_DEMAND_TRIBUTE) == 0)
{
if (GC.getGameINLINE().getSorenRandNum(GC.getLeaderHeadInfo(getPersonalityType()).getContactRand(CONTACT_DEMAND_TRIBUTE), "AI Diplo Demand Tribute") == 0)
{
if (GET_PLAYER((PlayerTypes)iI).isHuman())
{
setTradeItem(&item, TRADE_CITIES, pLoopCity->getID());
iValue = (1 + GC.getGameINLINE().getSorenRandNum(10000, "AI Demanding Tribute (City)"));
iTheirValue = pLoopCity->plot()->calculateCulturePercent(getID());
iOurValue = pLoopCity->plot()->calculateCulturePercent(getID());
theirList.clear();
setTradeItem(&item, TRADE_CITIES);
theirList.insertAtEnd(item);
AI_changeContactTimer(((PlayerTypes)iI), CONTACT_DEMAND_TRIBUTE, GC.getLeaderHeadInfo(getPersonalityType()).getContactDelay(CONTACT_DEMAND_TRIBUTE));
pDiplo = new CvDiploParameters(getID());
FAssertMsg(pDiplo != NULL, "pDiplo must be valid");
pDiplo->setDiploComment((DiploCommentTypes)GC.getInfoTypeForString("AI_DIPLOCOMMENT_DEMAND_TRIBUTE"));
pDiplo->setAIContact(true);
pDiplo->setOurOfferList(theirList);
gDLL->beginDiplomacy(pDiplo, (PlayerTypes)iI);
abContacted[GET_PLAYER((PlayerTypes)iI).getTeam()] = true;
}
}
}
}
}
}
}
}
i trying to get this to work so the ai player demands cities as tribute from the human player sadly there is very little info about adding extra diplomacy i can compile the dll with no errors do you think these lines will work?
using vs 2003 on win xp sp3 if that means anything
if (GET_PLAYER((PlayerTypes)iI).isHuman() && (GET_TEAM(getTeam()).getLeaderID() == getID()))
{
if (GET_TEAM(getTeam()).canDeclareWar(GET_PLAYER((PlayerTypes)iI).getTeam()) && !GET_TEAM(getTeam()).AI_isSneakAttackPreparing(GET_PLAYER((PlayerTypes)iI).getTeam()))
{
if (GET_TEAM(GET_PLAYER((PlayerTypes)iI).getTeam()).getDefensivePower() < GET_TEAM(getTeam()).getPower(true))
{
if (AI_getAttitude((PlayerTypes)iI) <= GC.getLeaderHeadInfo(GET_PLAYER((PlayerTypes)iI).getPersonalityType()).getDemandTributeAttitudeThreshold())
{
if (AI_getContactTimer(((PlayerTypes)iI), CONTACT_DEMAND_TRIBUTE) == 0)
{
if (GC.getGameINLINE().getSorenRandNum(GC.getLeaderHeadInfo(getPersonalityType()).getContactRand(CONTACT_DEMAND_TRIBUTE), "AI Diplo Demand Tribute") == 0)
{
if (GET_PLAYER((PlayerTypes)iI).isHuman())
{
setTradeItem(&item, TRADE_CITIES, pLoopCity->getID());
iValue = (1 + GC.getGameINLINE().getSorenRandNum(10000, "AI Demanding Tribute (City)"));
iTheirValue = pLoopCity->plot()->calculateCulturePercent(getID());
iOurValue = pLoopCity->plot()->calculateCulturePercent(getID());
theirList.clear();
setTradeItem(&item, TRADE_CITIES);
theirList.insertAtEnd(item);
AI_changeContactTimer(((PlayerTypes)iI), CONTACT_DEMAND_TRIBUTE, GC.getLeaderHeadInfo(getPersonalityType()).getContactDelay(CONTACT_DEMAND_TRIBUTE));
pDiplo = new CvDiploParameters(getID());
FAssertMsg(pDiplo != NULL, "pDiplo must be valid");
pDiplo->setDiploComment((DiploCommentTypes)GC.getInfoTypeForString("AI_DIPLOCOMMENT_DEMAND_TRIBUTE"));
pDiplo->setAIContact(true);
pDiplo->setOurOfferList(theirList);
gDLL->beginDiplomacy(pDiplo, (PlayerTypes)iI);
abContacted[GET_PLAYER((PlayerTypes)iI).getTeam()] = true;
}
}
}
}
}
}
}
}