phungus420
Deity
- Joined
- Mar 1, 2003
- Messages
- 6,296
How do I stop a function from being performed if the map is a scenario (any scenario), but still allow it to occur for randomly generated maps in python? I've checked the Python API but can't find anything that looks like it works.
For context, this is for the Start as Minors game option in RevolutionDCM. The function I specifically want to stop being run on scenario maps is the free defensive unit that is given to the players at game start when Start as Minors is selected (it messes up big time on scenarios, plus I'd rather keep the starting units in a scenario to be defined by the scenario maker). I've tried this:
Original code:
Looking in the Python API, the only thing I could find that looked promising was the getMapScript call. So I defined map as gc.getMap(), and then tried this code:
But I get a python exception "Type 'NONE' is not defined". Anyone have any ideas?
For context, this is for the Start as Minors game option in RevolutionDCM. The function I specifically want to stop being run on scenario maps is the free defensive unit that is given to the players at game start when Start as Minors is selected (it messes up big time on scenarios, plus I'd rather keep the starting units in a scenario to be defined by the scenario maker). I've tried this:
Original code:
Code:
if( game.isFinalInitialized() and game.getGameTurn() < 2 and pPlayer.isMinorCiv() ) :
if( pPlayer.isAlive() and not pPlayer.isBarbarian() ) :
#phungus AI defensive unit start
...do stuff
Code:
if( game.isFinalInitialized() and game.getGameTurn() < 2 and pPlayer.isMinorCiv() and map.getMapScriptName() != NONE ) :
if( pPlayer.isAlive() and not pPlayer.isBarbarian() ) :
#phungus AI defensive unit start
...do stuff