[*]The INI files will be created using the defaults, but the folder itself must exist.
[*]BUG should be calling all the right GameUtils callbacks unless you added some of your own.
[*]You place all your mod's XML into a new XML file that you load from init.xml. The instructions for that first part in the tutorial with an example file. Can you reference a link that you don't understand and post the XML you have created so far?
[*]There's no built-in way to create an option that is disabled all the time, but you could trick BUG by setting the option to require a very large version of the DLL by adding dll="99999" to the <option> element.
<events module="AbandonRazeDemolish"/>
class AbandonRazeDemolish:
def __init__(self, eventManager):
self.eventMgr.EventKeyDown=6
eventManager.addEventHandler("KbdEvent", self.onKbdEvent)
eventManager.addEventHandler("DestroyBuildingBegin", self.eventDestroyBuildingBegin)
eventManager.addEventHandler("DestroyBuildingApply", self.eventDestroyBuildingApply)
eventManager.addEventHandler("CityRazed", self.onCityRazed)
self.eventMgr = eventManager
def onKbdEvent(self, argsList, bCtrl):
eventType,key,mx,my,px,py = argsList
self.eventMgr.bCtrl = bCtrl
if ( eventType == self.eventMgr.EventKeyDown ):
CvUtil.pyPrint("test")
theKey=int(key)
CvCameraControls.g_CameraControls.handleInput( theKey )
'Check if city screen is active'
if ( CyInterface().isCityScreenUp() ):
'Check if CTRL + Z was hit'
if(theKey == int(InputTypes.KB_Z) and self.eventMgr.bCtrl):
'Make sure the owner is the player!'
if (CyInterface().getHeadSelectedCity().getOwner() == gc.getGame().getActivePlayer()):
return 1
return 0
I expect your problem was the the leading K in the event name should be lower case: "kbdEvent"....
good catch
thanks for the "adding event" tip!
FYI Emperorfool this typo is in your modders corner:
class ReminderEvent:
def __init__(self, eventManager):
eventManager.addEventHandler("kbdEvent", self.onKbdEvent)
eventManager.addEventHandler("endTurnReady", self.onEndTurnReady)
eventManager.addEventHandler("GameStart", self.onGameStart)
...
???
I see no typo there.
The event names themselves are a mixed bag. Some start with a capital letter, some don't. For example, all but one of the unit related events start with "unit" with the exception being "UnitRename". The function names (that come with BtS) called to handle the events are more regular in form: they all start with "on", with the lower case "o", and then every word (or shortened version in the case of "kbd") after that which is incorporated into the function name is capitalized (whether or not it was in the event name). So in the standard event manager that comes with BtS the mouseEvent event is handled by the onMouseEvent function, the Init event is handled by onInit, and the OnSave event is handled by onSaveGame (where they snuck in a whole extra word). As you can see, it is pretty haphazard.
eventMgr.addEventHandler("techAcquired", self.onTechAcquired)
eventMgr.addEventHandler("TechAcquired", self.onTechAcquired)
Yet one more thing to add to the ever-growing list of feature requests.
I'm glad GE was able to help you along, modifieda4. I just got back from vacation and will be around more now.
- mod XML files are merged the old way with a BUG install
- CVmaininterface changes get merged the old way with a BUG install
- art files get merged the old way with a BUG install
a new mod's CGgameUtil functions overwrite the default function entirely if placed outside a CLASS in a new BUG mod events file
a new mod's event with the same name of a default function (case matters!) gets appended to default function in a CLASS in a new BUG mod events file. Otherwise you may see two events fired at a time. only put additions in the new mod.
when an event is triggered by the user (ie. a function of a new unit) and can be triggered by AI functions, then it has to be placed in a sepate py file and called into the new BUG mod event file via import.