View Full Version : anyone used pushMission() before?


naf4ever
Mar 30, 2006, 02:48 PM
If so please post an example of how its used. Im trying to figure it out but its blowing me away... Here is what i found for its python reference:


VOID pushMission(MissionType eMission, INT iData1, INT iData2, INT iFlags,
BOOL bAppend, BOOL bManual, MissionAIType eMissionAI, CyPlot pMissionAIPlot,
CyUnit pMissionAIUnit)
void (eMission, iData1, iData2, iFlags, bAppend, bManual, eMissionAI,
pMissionAIPlot, pMissionAIUnit)


BTW, im assuming this is the command to give a unit an action, like telling it to move or fortify, etc...

Im not quite sure what half of those inputs it wants are. An example would help big time. All im trying to do is tell a unit to skip its turn and chill. Thanks. -naf

IVZanIV
Mar 30, 2006, 02:54 PM
I think this is for aircraft (like bomb, assault and such)... They are actually named missions... (If this is wrong, I'm sorry lol just trying to be helpful...)

naf4ever
Mar 30, 2006, 03:04 PM
These are all the mission types ive found:


-1 = NO_MISSION
0 = MISSION_MOVE_TO
1 = MISSION_ROUTE_TO
2 = MISSION_MOVE_TO_UNIT
3 = MISSION_SKIP
4 = MISSION_SLEEP
5 = MISSION_FORTIFY
6 = MISSION_AIRPATROL
7 = MISSION_HEAL
8 = MISSION_SENTRY
9 = MISSION_AIRLIFT
10 = MISSION_NUKE
11 = MISSION_RECON
12 = MISSION_AIRBOMB
13 = MISSION_BOMBARD
14 = MISSION_PILLAGE
15 = MISSION_SABOTAGE
16 = MISSION_DESTROY
17 = MISSION_STEAL_PLANS
18 = MISSION_FOUND
19 = MISSION_SPREAD
20 = MISSION_JOIN
21 = MISSION_CONSTRUCT
22 = MISSION_DISCOVER
23 = MISSION_HURRY
24 = MISSION_TRADE
25 = MISSION_GREAT_WORK
26 = MISSION_GOLDEN_AGE
27 = MISSION_BUILD
28 = MISSION_BEGIN_COMBAT
29 = MISSION_END_COMBAT
30 = MISSION_AIRSTRIKE
31 = MISSION_SURRENDER
32 = MISSION_CAPTURED
32 = MISSION_IDLE
33 = MISSION_DIE
34 = MISSION_DAMAGE
35 = MISSION_MULTI_SELECT
36 = MISSION_MULTI_DESELECT
37 = NUM_MISSION_TYPES

I want to be able to force some of these on a unit but so far havent found a function to do that with except the one i posted which is very hard to comprehend.

IVZanIV
Mar 30, 2006, 03:07 PM
Aha, there's a "DIE" mission?

12monkeys
Mar 30, 2006, 03:22 PM
Here is an example. I used that in my Reinit-Interceptor Mod.


def doReInit(self):
iPlayer = PyPlayer(CyGame().getActivePlayer())
unitList = iPlayer.getUnitList()
# Loop for all players units
for ii in range(len(unitList)):
pLoopUnit = unitList[ii]
# get the group the unit belongs to.
pGroup = pLoopUnit.getGroup()
# check if unit is doing air patrol
if (pGroup.getActivityType() == ActivityTypes.ACTIVITY_INTERCEPT):
# remove mission (this one shold be obsolete, but who knows ;)
pGroup.popMission()
pPlot = pGroup.plot()
# add new mission -> fortify
pGroup.pushMission(MissionTypes.MISSION_FORTIFY, 0, 0, 0, false, false, MissionAITypes.NO_MISSIONAI, pPlot, pLoopUnit)
# add new mission -> air patrol
pGroup.pushMission(MissionTypes.MISSION_AIRPATROL, 0, 0, 0, false, false, MissionAITypes.NO_MISSIONAI, pPlot, pLoopUnit)

naf4ever
Mar 30, 2006, 03:49 PM
Sweet thanks,, that helps greatly, I'll try it out..

EDIT: Works like a charm!

snarko
Mar 30, 2006, 07:01 PM
Aha, there's a "DIE" mission?

If you can figure out how to use it please tell me. Tried using it, nothing. Tried canStartMission() and it says false. (Yes I know there are other ways to kill a unit. Looks like I'll have to use one.)

SimCutie
Mar 30, 2006, 07:14 PM
If you can figure out how to use it please tell me. Tried using it, nothing. Tried canStartMission() and it says false. (Yes I know there are other ways to kill a unit. Looks like I'll have to use one.)
Did you set bool bTestVisible = True? ( in canStartMission( int iMission, int iData1, int iData2, CyPlot* pPlot, bool bTestVisible) ). I don't know what this flag means exactly but some times it works. My guess is it has someting do with simuleneous turn mode multiplay.

12monkeys
Mar 31, 2006, 01:35 AM
Did you set bool bTestVisible = True? ( in canStartMission( int iMission, int iData1, int iData2, CyPlot* pPlot, bool bTestVisible) ). I don't know what this flag means exactly but some times it works. My guess is it has someting do with simuleneous turn mode multiplay.

Out of my experience, the "TestVisible" variables just check, f the realted mission/action button is displayed in the main interface when selecting the unit. It does NOT mean, that the action is possible or not, because the function canStartMission returns also true, if the button is displayed but disabled.

12monkeys
Mar 31, 2006, 01:37 AM
If you can figure out how to use it please tell me. Tried using it, nothing. Tried canStartMission() and it says false. (Yes I know there are other ways to kill a unit. Looks like I'll have to use one.)

Maybe the DIE mission only works if the unit has no health points. It may be used to trigger the die animation after a lost combat. In this case it has nothing to do with the abandon unit command you can select in the interface.

Just a guess!