[BTS] Event make unit on map?

I wanted to convert what you sent me into a Spanish bombing event, but probably not white, but I don't think it shows to the first player an event that does nothing.
Code:
gc = CyGlobalContext()
PyPlayer = PyHelpers.PyPlayer
localText = CyTranslator()

# initialise misc variables
iX = 0
iY = 1
iNoFocus = -1
iFocusBoth = -2
bForceCoastal = True
bUsePythagoras = True


class CvEventManager:
def __init__(self):

self.initValues()




class CvEventHistory:

def SpanisCvilWarTrriger(argsList): ##Remember that that's the tag##
iGameTurn = argsList[0]
CvTopCivs.CvTopCivs().turnChecker(iGameTurn)
if iGameTurn == 1:
player = gc.getPlayer(kTriggeredData.ePlayer)
if (player.getCivilizationType() == gc.getInfoTypeForString("CIVILIZATION_WW2_IBERIA")): ##Defines the Civilization
return True



return False

def SpanisCvilWar(self, argsList):
'Called at the beginning of the end of each turn'
iEvent = argsList[0]
kTriggeredData = argsList[1]
# new code

# popup end
player = gc.getPlayer(kTriggeredData.ePlayer)
plot = gc.getMap().plot(44, 14) ##THE COORINATES##

iUnitType = CvUtil.findInfoTypeNum(gc.getUnitInfo, gc.getNumUnitInfos(), 'UNIT_INFANTRY') #######The Units, here are 3 conquistadors, 1 explorer#
player.initUnit(iUnitType, plot.getX(), plot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
player.initUnit(iUnitType, plot.getX(), plot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
player.initUnit(iUnitType, plot.getX(), plot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
player.initUnit(iUnitType, plot.getX(), plot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
player.initUnit(iUnitType, plot.getX(), plot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
player.initUnit(iUnitType, plot.getX(), plot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
iUnitType = CvUtil.findInfoTypeNum(gc.getUnitInfo, gc.getNumUnitInfos(), 'UNIT_ARTILLERY')
player.initUnit(iUnitType, plot.getX(), plot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
player.initUnit(iUnitType, plot.getX(), plot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
player.initUnit(iUnitType, plot.getX(), plot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
iTypeDeclaringCiv == gc.getInfoTypeForString(
"CIVILIZATION_WW2_IBERIA")
iTypeVictim == gc.getInfoTypeForString("CIVILIZATION_SPAIN")
iDeclaringPlayer = -1
iVictimPlayer = -1
iMaxCiv = gc.getMAX_PLAYERS()
for iCivs in range(iMaxCiv):
pPlayer = gc.getPlayer(iCivs)
if pPlayer.getCivilizationType() == iTypeDeclaringCiv:
iDeclaringPlayer == iCivs
elif pPlayer.getCivilizationType() == iTypeVictim:
iVictimPlayer == iCivs
if iDeclaringPlayer == -1 or iVictimPlayer == -1:
return
gc.getTeam(gc.getPlayer(iDeclaringPlayer).getTeam()).declareWar(
iVictimPlayer, false, WarPlanTypes.WARPLAN_TOTAL)
# declare war end
# popup begin
popup = PyPopup.PyPopup(-1)
popup.setHeaderString(CyTranslator().getText("SPANISH CIVIL WAR", (gc.getPlayer(
iDeclaringPlayer).getCivilizationDescription(), gc.getPlayer(iVictimPlayer).getCivilizationDescription())))
popup.setBodyString(CyTranslator().getText("SPANISH CIVIL WAR", (gc.getPlayer(
iDeclaringPlayer).getCivilizationDescription(), gc.getPlayer(iVictimPlayer).getCivilizationDescription())))
popup.launch(True, PopupStates.POPUPSTATE_IMMEDIATE)

iTypeDeclaringCiv == gc.getInfoTypeForString(
"CIVILIZATION_WW2_IBERIA")
iTypeVictim == gc.getInfoTypeForString("CIVILIZATION_SPAIN")
iDeclaringPlayer = -1
iVictimPlayer = -1
iMaxCiv = gc.getMAX_PLAYERS()
for iCivs in range(iMaxCiv):
pPlayer = gc.getPlayer(iCivs)
if pPlayer.getCivilizationType() == iTypeDeclaringCiv:
iDeclaringPlayer == iCivs
elif pPlayer.getCivilizationType() == iTypeVictim:
iVictimPlayer == iCivs
if iDeclaringPlayer == -1 or iVictimPlayer == -1:
return
gc.getTeam(gc.getPlayer(iDeclaringPlayer).getTeam()).declareWar(
iVictimPlayer, false, WarPlanTypes.WARPLAN_TOTAL)
# declare war end
# popup begin
popup = PyPopup.PyPopup(-1)
popup.setHeaderString(CyTranslator().getText("SPANISH CIVIL WAR", (gc.getPlayer(
iDeclaringPlayer).getCivilizationDescription(), gc.getPlayer(iVictimPlayer).getCivilizationDescription())))
popup.setBodyString(CyTranslator().getText("SPANISH CIVIL WAR", (gc.getPlayer(
iDeclaringPlayer).getCivilizationDescription(), gc.getPlayer(iVictimPlayer).getCivilizationDescription())))
popup.launch(True, PopupStates.POPUPSTATE_IMMEDIATE)

<EventInfo>
<Type>EVENT_SPAINWAR</Type>
<Description>Spain civil war</Description>
<LocalInfoText>Spanish Civil War</LocalInfoText>
<WorldNewsTexts/>
<OtherPlayerPopup/>
<QuestFailText/>
<bQuest>0</bQuest>
<bGlobal>0</bGlobal>
<bTeam>0</bTeam>
<bPickCity>1</bPickCity>
<bPickOtherPlayerCity>0</bPickOtherPlayerCity>
<bDeclareWar>0</bDeclareWar>
<iGold>0</iGold>
<bGoldToPlayer>0</bGoldToPlayer>
<iRandomGold>0</iRandomGold>
<iCulture>0</iCulture>
<iEspionagePoints>0</iEspionagePoints>
<bGoldenAge>0</bGoldenAge>
<iFreeUnitSupport>0</iFreeUnitSupport>
<iInflationMod>0</iInflationMod>
<iSpaceProductionMod>0</iSpaceProductionMod>
<Tech>NONE</Tech>
<TechFlavors/>
<iTechPercent>0</iTechPercent>
<iTechCostPercent>0</iTechCostPercent>
<iTechMinTurnsLeft>0</iTechMinTurnsLeft>
<PrereqTech>NONE</PrereqTech>
<UnitClass>NONE</UnitClass>
<iNumFreeUnits>0</iNumFreeUnits>
<bDisbandUnit>0</bDisbandUnit>
<iUnitExperience>0</iUnitExperience>
<iUnitImmobileTurns>0</iUnitImmobileTurns>
<UnitPromotion/>
<UnitName/>
<UnitCombatPromotions/>
<UnitClassPromotions/>
<BuildingClass>NONE</BuildingClass>
<iBuildingChange>0</iBuildingChange>
<BuildingExtraYields/>
<BuildingExtraCommerces/>
<BuildingExtraHappies/>
<BuildingExtraHealths/>
<iHappy>0</iHappy>
<iHealth>0</iHealth>
<iHurryAnger>0</iHurryAnger>
<iHappyTurns>0</iHappyTurns>
<iRevoltTurns>0</iRevoltTurns>
<iMinPillage>0</iMinPillage>
<iMaxPillage>0</iMaxPillage>
<iFood>0</iFood>
<iFoodPercent>0</iFoodPercent>
<FreeSpecialistCounts/>
<FeatureType>NONE</FeatureType>
<iFeatureChange>0</iFeatureChange>
<ImprovementType>NONE</ImprovementType>
<iImprovementChange>0</iImprovementChange>
<BonusType>NONE</BonusType>
<iBonusChange>0</iBonusChange>
<RouteType>NONE</RouteType>
<iRouteChange>0</iRouteChange>
<BonusRevealed>NONE</BonusRevealed>
<BonusGift>NONE</BonusGift>
<PlotExtraYields/>
<iConvertOwnCities>0</iConvertOwnCities>
<iConvertOtherCities>0</iConvertOtherCities>
<iMaxNumReligions>-1</iMaxNumReligions>
<iOurAttitudeModifier>0</iOurAttitudeModifier>
<iAttitudeModifier>0</iAttitudeModifier>
<iTheirEnemyAttitudeModifier>0</iTheirEnemyAttitudeModifier>
<iPopulationChange>0</iPopulationChange>
<AdditionalEvents/>
<EventTimes/>
<ClearEvents/>
<PythonCallback>SpanisCvilWar</PythonCallback>
<PythonExpireCheck/>
<PythonCanDo/>
<PythonHelp/>
<Button>,Art/Interface/Buttons/Process/Blank.dds,Art/Interface/Buttons/Beyond_the_Sword_Atlas.dds,8,5</Button>
<iAIValue>1001</iAIValue>
</EventInfo>

<EventTriggerInfo>
<Type>EVENTTRIGGER_SPANISHWAR</Type>
<WorldNewsTexts>
<Text>Spanish Civil War</Text>
</WorldNewsTexts>
<TriggerTexts>
<TriggerText>
<Text>Spanish Civil War</Text>
<Era>NONE</Era>
</TriggerText>
</TriggerTexts>
<bSinglePlayer>0</bSinglePlayer>
<iPercentGamesActive>100</iPercentGamesActive>
<iWeight>-1</iWeight>
<bProbabilityUnitMultiply>0</bProbabilityUnitMultiply>
<bProbabilityBuildingMultiply>0</bProbabilityBuildingMultiply>
<Civic>NONE</Civic>
<iMinTreasury>0</iMinTreasury>
<iMinPopulation>0</iMinPopulation>
<iMaxPopulation>0</iMaxPopulation>
<iMinMapLandmass>0</iMinMapLandmass>
<iMinOurLandmass>0</iMinOurLandmass>
<iMaxOurLandmass>-1</iMaxOurLandmass>
<MinDifficulty>NONE</MinDifficulty>
<iAngry>0</iAngry>
<iUnhealthy>0</iUnhealthy>
<UnitsRequired/>
<iNumUnits>0</iNumUnits>
<iNumUnitsGlobal>0</iNumUnitsGlobal>
<iUnitDamagedWeight>0</iUnitDamagedWeight>
<iUnitDistanceWeight>0</iUnitDistanceWeight>
<iUnitExperienceWeight>0</iUnitExperienceWeight>
<bUnitsOnPlot>0</bUnitsOnPlot>
<BuildingsRequired>
<BuildingClass>NONE</BuildingClass>
</BuildingsRequired>
<iNumBuildings>0</iNumBuildings>
<iNumBuildingsGlobal>0</iNumBuildingsGlobal>
<iNumPlotsRequired>0</iNumPlotsRequired>
<bOwnPlot>1</bOwnPlot>
<iPlotType>-1</iPlotType>
<FeaturesRequired/>
<TerrainsRequired/>
<ImprovementsRequired/>
<BonusesRequired/>
<RoutesRequired/>
<ReligionsRequired/>
<iNumReligions>0</iNumReligions>
<CorporationsRequired/>
<iNumCorporations>0</iNumCorporations>
<bPickReligion>0</bPickReligion>
<bStateReligion>0</bStateReligion>
<bHolyCity>0</bHolyCity>
<bPickCorporation>0</bPickCorporation>
<bHeadquarters>0</bHeadquarters>
<Events>
<Event>EVENT_SPAINWAR</Event>
</Events>
<PrereqEvents/>
<bPrereqEventPlot>0</bPrereqEventPlot>
<OrPreReqs/>
<AndPreReqs/>
<ObsoleteTechs/>
<bRecurring>0</bRecurring>
<bTeam>0</bTeam>
<bGlobal>1</bGlobal>
<bPickPlayer>0</bPickPlayer>
<bOtherPlayerWar>0</bOtherPlayerWar>
<bOtherPlayerHasReligion>0</bOtherPlayerHasReligion>
<bOtherPlayerHasOtherReligion>0</bOtherPlayerHasOtherReligion>
<bOtherPlayerAI>0</bOtherPlayerAI>
<iOtherPlayerShareBorders>0</iOtherPlayerShareBorders>
<OtherPlayerHasTech>NONE</OtherPlayerHasTech>
<bPickCity>1</bPickCity>
<bPickOtherPlayerCity>0</bPickOtherPlayerCity>
<bShowPlot>1</bShowPlot>
<iCityFoodWeight>0</iCityFoodWeight>
<PythonCanDo>SpanisCvilWarTrriger</PythonCanDo>
<PythonCanDoCity/>
<PythonCanDoUnit/>
<PythonCallback/>
</EventTriggerInfo>
 
@Louis the XIV
Sorry for lots of ping, but I did not formulate my question well
After lots of trials
I came to the conclusion that the call of war event should be in cveventmanager and it should look like this:
Code:
def onBeginGameTurn(self, argsList):
        'Called at the beginning of the end of each turn'
        iGameTurn = argsList[0]
        CvTopCivs.CvTopCivs().turnChecker(iGameTurn)
###new code
        if iGameTurn == 10:
            ###declare war begin###
            iTypeDeclaringCiv == gc.getInfoTypeForString("CIVILIZATION_GERMANY")
            iTypeVictim == gc.getInfoTypeForString("CIVILIZATION_ENGLAND")
            iDeclaringPlayer = -1
            iVictimPlayer = -1
            iMaxCiv = gc.getMAX_PLAYERS()
            for iCivs in range(iMaxCiv):
                pPlayer = gc.getPlayer(iCivs)
                if pPlayer.getCivilizationType ()==iTypeDeclaringCiv:
                    iDeclaringPlayer == iCivs
                elif pPlayer.getCivilizationType ()==iTypeVictim:
                    iVictimPlayer == iCivs
            if iDeclaringPlayer ==-1 or iVictimPlayer ==-1:
                return
            gc.getTeam(gc.getPlayer(iDeclaringPlayer).getTeam()).declareWar(iVictimPlayer, false, WarPlanTypes.WARPLAN_TOTAL)
            ###declare war end
            ###popup begin
            popup = PyPopup.PyPopup(-1)
            popup.setHeaderString(CyTranslator().getText("TXT_KEY_HEADER_TEXT_SOMETHING_BLABLAB",(gc.getPlayer(iDeclaringPlayer).getCivilizationDescription () ,gc.getPlayer(iVictimPlayer).getCivilizationDescription () )))
            popup.setBodyString(CyTranslator().getText("TXT_KEY_THE_BODY_TEXT_SOMETHING_BLABLA",(gc.getPlayer(iDeclaringPlayer).getCivilizationDescription () ,gc.getPlayer(iVictimPlayer).getCivilizationDescription () )))
            popup.launch(True, PopupStates.POPUPSTATE_IMMEDIATE)
            ###popup end
###new code end
but when create same event game says: iTypeDeclaringCiv wasn't define and I don't know the solution to this problem
 
@Louis the XIV
Sorry for lots of ping, but I did not formulate my question well
After lots of trials
I came to the conclusion that the call of war event should be in cveventmanager and it should look like this:
Code:
def onBeginGameTurn(self, argsList):
        'Called at the beginning of the end of each turn'
        iGameTurn = argsList[0]
        CvTopCivs.CvTopCivs().turnChecker(iGameTurn)
###new code
        if iGameTurn == 10:
            ###declare war begin###
            iTypeDeclaringCiv == gc.getInfoTypeForString("CIVILIZATION_GERMANY")
            iTypeVictim == gc.getInfoTypeForString("CIVILIZATION_ENGLAND")
            iDeclaringPlayer = -1
            iVictimPlayer = -1
            iMaxCiv = gc.getMAX_PLAYERS()
            for iCivs in range(iMaxCiv):
                pPlayer = gc.getPlayer(iCivs)
                if pPlayer.getCivilizationType ()==iTypeDeclaringCiv:
                    iDeclaringPlayer == iCivs
                elif pPlayer.getCivilizationType ()==iTypeVictim:
                    iVictimPlayer == iCivs
            if iDeclaringPlayer ==-1 or iVictimPlayer ==-1:
                return
            gc.getTeam(gc.getPlayer(iDeclaringPlayer).getTeam()).declareWar(iVictimPlayer, false, WarPlanTypes.WARPLAN_TOTAL)
            ###declare war end
            ###popup begin
            popup = PyPopup.PyPopup(-1)
            popup.setHeaderString(CyTranslator().getText("TXT_KEY_HEADER_TEXT_SOMETHING_BLABLAB",(gc.getPlayer(iDeclaringPlayer).getCivilizationDescription () ,gc.getPlayer(iVictimPlayer).getCivilizationDescription () )))
            popup.setBodyString(CyTranslator().getText("TXT_KEY_THE_BODY_TEXT_SOMETHING_BLABLA",(gc.getPlayer(iDeclaringPlayer).getCivilizationDescription () ,gc.getPlayer(iVictimPlayer).getCivilizationDescription () )))
            popup.launch(True, PopupStates.POPUPSTATE_IMMEDIATE)
            ###popup end
###new code end
but when create same event game says: iTypeDeclaringCiv wasn't define and I don't know the solution to this problem
As keldath said, when defining variables use =
There's also a pretty interesting resource by The_J called War and Peace script which lets you make civs declare war on each and make peace, you could have a look at it's code
https://forums.civfanatics.com/resources/warnpeace-script.18546/
 
Top Bottom