tweber -> RE: Tutorial: Making action cards (11/23/2007 5:04:30 PM)
|
4. Write the event to ‘deal the action card’. See some of the code from event 12: LOOPER: TempVar0 FROM 0 TO 3 3) SETVAR: TempVar1 = TempVar0 4) SETVAR: TempVar1 + 4 5) SETVAR: TempVar2 = TempVar0 6) SETVAR: TempVar2 + 8 7) EXECUTE: ExecRemoveActionCard(TempVar0, 0) 8) EXECUTE: ExecRemoveActionCard(TempVar1, 1) 9) EXECUTE: ExecRemoveActionCard(TempVar2, 2) 10) END LOOPER 11) EXECUTE: ExecGiveActionCard(0, 0) 12) CHECK: CheckHexOwner(36, 38) == 0 13) EXECUTE: ExecGiveActionCard(3, 0) 14) END CHECK First, I run a loop that clears all arrival action cards. I do not know if an arrival hex was lost the previous turn (lines 7-9 remove cards for Germany, the West, and the Soviets respectively). Then, I give back the action card only if the regime controls the arrival hex (lines 11-13 give the card to Germany for control of Berlin). Note that the player will never get a card if it is not ‘dealt’ through an event. 5. Write an event to execute the action card. 0) EXECUTE: ExecMessage(0, -1, -1, -1) 1) SETVAR: Gameslot_German X(#0) = 39 2) SETVAR: Gameslot_German Y(#1) = 17 3) EXECUTE: ExecGiveActionCard(0, 0) This event set the arrival of German units to Berlin. I post a message to the German player so that he has a record in the log that can be checked. I also deal a card at the end. The card is used when played and must be re-dealt at some point if you want to allow the player to play the card more than once. We will allow Germany to set arrival hexes as often as desired. Here is the execute event for the German ‘blitz’ on the Soviet Union. Note that we don’t re-deal the card so the German can only play this card once. 0) EXECUTE: ExecReduceReadiness(2, 0, 50, 100) 1) EXECUTE: ExecMessage(0, 2, -1, -1) 5. Write, deal, and then execute the unit purchase cards. Here is the code for the card. Note that to minimize the number of cards I have to create, I do not know which player played the card. So the first thing to do is to check the turn. Depending on the turn – 0 = German, 1=West, 2 = Soviets, I now give the predefined unit (number 0) to the right regime and at the right location. Note in lines 2-6, I also give the Germans some pp back later in the war if they are losing (due to mass conscription) 0) CHECK: CheckTurn == 0 1) EXECUTE: ExecAddUnit(0, Gameslot_German X(#0), Gameslot_German Y(#1), 0) 2) CHECK: CheckYear > 1941 3) CHECK: Gameslot_German Victory Cities(#37) < 3 4) EXECUTE: ExecGiveRegimePP(0, 10) 5) END CHECK 6) END CHECK 7) END CHECK 8) CHECK: CheckTurn == 1 9) EXECUTE: ExecAddUnit(0, Gameslot_Western X(#2), Gameslot_Western Y(#3), 1) 10) END CHECK 11) CHECK: CheckTurn == 2 12) EXECUTE: ExecAddUnit(0, Gameslot_SU X(#4), Gameslot_SU Y(#5), 2) 13) CHECK: Gameslot_Cheap Soviet Infantry(#59) == 1 14) EXECUTE: ExecGiveRegimePP(2, 5) 15) END CHECK 16) END CHECK 17) SETVAR: TempVar0 = CheckTurn 18) EXECUTE: ExecGiveActionCard(12, TempVar0) 19) EXECUTE: ExecMessage(TempVar0, -1, -1, -1) That’s it. I find action cards to be very flexible. Uses include: - Special declarations of war - Diplomacy (transfer pp, war material, even territory if combined with slots) - Purchase pre-defined units - Abstract warfare (uboats and dd escorts in ww2) I am sure creative designers will come up with even more uses over time. Finally, note that you can also play action cards through events. This allows you to play cards if a player is run by the AI. The AI will not play an action card.
|
|
|
|