possible to remove a button from an existing unit?

naf4ever

Dread Lord
Joined
Feb 8, 2003
Messages
405
Location
Southeast Washington State
I want to remove the "recon" ability altogether from an air unit im making. I notice all air units do this by default, even bombers which seems odd. I was hoping there was an XML value i could just set to zero but im not seeing one. If there is one please let me know.

Or if you know which .py file i need to edit it would help me get pointed in the right direction. Thanks.

-Naf
 
You can't do this via XML, you have to mod that. Go to toe file CyMainInterface.py and look for the line "actions = CyInterface().getActionsToShow()". In the following lines the buttons are added to the multi list container. Here you have a chance to filter the buttons you don't want to have.
 
Would it be enough to just remove the selection button for the human player? I don't think I've ever seen the AI using recon, though I don't get into many end-game wars.

If you want to do this check out lines 1300-1360 in a vanilla CvMainInterface.py - in the updateSelectionButtons function.

Specifically, you'll want to edit:
Code:
actions = CyInterface().getActionsToShow()
for i in actions:
	screen.appendMultiListButton( "BottomButtonContainer", gc.getActionInfo(i).getButton(), 0, WidgetTypes.WIDGET_ACTION, i, -1, False )
	screen.show( "BottomButtonContainer" )
So that if the action is the recon action the loop continues to the next action. Something like:
Code:
actions = CyInterface().getActionsToShow()
for i in actions:
	if i == WhateverTheCodeForReconIs:
		continue
	screen.appendMultiListButton( "BottomButtonContainer", gc.getActionInfo(i).getButton(), 0, WidgetTypes.WIDGET_ACTION, i, -1, False )
	screen.show( "BottomButtonContainer" )
You'll have to work out what value of i corresponds with the recon command by playing with a few print commands for units which can recon.
 
Back
Top Bottom