Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Help withCards

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Advanced Tactics Series >> Mods and Scenarios >> Help withCards Page: [1]
Login
Message << Older Topic   Newer Topic >>
Help withCards - 10/3/2015 2:19:31 AM   
E6Jarhead

 

Posts: 29
Joined: 6/1/2015
From: Hendersonville, NC
Status: offline
I have been trying for months and I cannot build any cards. I REALLY want to figure this out. Please Help.

I can figure out the front end. How to name the action card, PP etc, how to set what rule it will execute etc.

I want to deal a card to the player at the beginning of the game that will allow the player to place a fortification.

Will someone please post the event coding for this?



_____________________________

Th only reason some people are still alive is because it is illegal to kill them!
Post #: 1
RE: Help withCards - 10/3/2015 7:01:40 AM   
Ormand


Posts: 682
Joined: 2/17/2009
Status: offline
Something like this will give an action card #20 at the beginning of the game to all human players (and make it so it doesn't happen again):

LOOPER: TempVar0 FROM 0 to CheckRegimeCount        ! loops over regimes
    CHECK: CheckIfAI(TempVar0) == 0                ! = 0 if human, = 1 if AI
        EXECUTE: ExecGiveActionCard(20,TempVar0)   ! Action card
    END CHECK
END LOOPER
EXECUTE: BlockEvent                                !  don't execute event again



Set this event up to be Round Check. Start the game, and you should find the action card there.

(Also, of course you can't use the bang comment in ATG, that's just me adding explanation in good ol' FORTRAN90 style)

If you want to give it to only one regime, say regime 4 (note counting usually starts at zero, C-sytle)

CHECK: CheckRound == 4              !  CheckRound returns the number of the current regime

END CHECK


If you want to base it on a Regime variable, say 18, use

CHECK: CheckRegimeVar(TempVar0,18) == value

END CHECK



< Message edited by Ormand -- 10/3/2015 8:06:21 AM >

(in reply to E6Jarhead)
Post #: 2
RE: Help withCards - 10/3/2015 4:30:10 PM   
E6Jarhead

 

Posts: 29
Joined: 6/1/2015
From: Hendersonville, NC
Status: offline
Thanks!
1. I got the Card to show up at the beginning of the game just as I wanted.

2. I linked it to the "Generic" card number 8 (Fortify) in the stock game.

2a. Title: Fortify (#8) (Self explanatory)
2b. Text: Description: (Self explanatory)
2c. PP Cost : (Self explanatory)
2d. Execute Event: 82 (Self explanatory (posting this event below to discuss))
2e. Event Pic Number (Self Explanatory)
2f. Color Scheme: (Self Explanatory)
2g. Temp Var 0: (Temp Var0, Temp Var1 will be passed to event code)(I understand what this means but have not explored the event codes yet)
2h. Temp Var1: Temp Var0, Temp Var1 will be passed to event code) (I understand what this means but have not explored the event codes yet)
2i. Area Slot: 0: (Defining the highlighted hexes for user pic. User selection will be passed as Temp Var 2, Temp Var 3 to event) (I understand what this means but have not explored the event codes yet)
2j. Area Value: 1 (Defining the highlighted hexes for user pic. User selection will be passed as Temp Var 2, Temp Var 3 to event)(I understand what this means but have not explored the event codes yet)
2k. Pre Execute Event: 88 (Self Explanatory)
2l. Select Unit: False (Ill ask about this later on another card)

3. It lets me choose the card at the beginning and pulls up the pop up window showing the map.

4. I expected to be able to choose any hex (other than an existing location) that the fort could be constructed on. Instead it only lets me "Select" a "Raw" location and it changes that "Raw" location to fortification. Im going to assume that this has something to do with the pre execute and execute events.

5. So here is event #88 the Pre execute event as listed on the card.

0) EXECUTE: ExecClearMatrix(0, 0)
1) SETVAR: TempVar11 = 0
2) SETVAR: TempVar12 = CheckMapWidth
3) SETVAR: TempVar21 = 0
4) SETVAR: TempVar22 = CheckMapHeight
5) SETVAR: TempVar31 = CheckUnitX(TempVar4)
6) SETVAR: TempVar41 = CheckUnitY(TempVar4)
7) LOOPER: TempVar0 FROM TempVar11 TO TempVar12
8) LOOPER: TempVar1 FROM TempVar21 TO TempVar22
9) CHECK: CheckHexOwner(TempVar0, TempVar1) == CheckTurn
10) CHECK: CheckDistance(TempVar31, TempVar41, TempVar0, TempVar1) =< 5
11) CHECK: CheckLocTypeXY(TempVar0, TempVar1) == -1
12) SETVAR: TempVar8 = CheckLandscapeType(TempVar0, TempVar1)
13) CHECK: CheckStringList(94, TempVar8, 1) == 1
14) EXECUTE: ExecSetSlot(TempVar0, TempVar1, 0, 1)
15) END CHECK
16) END CHECK
17) END CHECK
18) END CHECK
19) END LOOPER
20) END LOOPER

ONE THING I NOTICED IS THAT LINE 13 ABOVE SAYS TO CHECK STRINGLIST 94. I LOOKED AT SL94 AND IT IS IN REFERENCE TO LIGHT TANK GRAPHICS

6. This is the actual event that is called #82

0) ' tempvar2 & 3 are set as selected x,y
1) SETVAR: TempVar0 = CheckTurn
2) SETVAR: TempVar1 = CheckRegimePeople(TempVar0)
3) SETVAR: TempVar900 = CheckUnitHistorical(TempVar4)
4) SETVAR: TempVar901 = 10
5) SETVAR: TempVar902 = 3
6) SETVAR: TempVar911 = 98
7) SETVAR: TempVar912 = 105
8) EXECUTE: CallFunction('FunctionRisk')
9) CHECK: TempVar950 == 0
10) EXECUTE: ExecGiveCommanderXP(TempVar4, 10)
11) EXECUTE: ExecMessage(TempVar0, -1, -1, -1)
12) EXECUTE: ExecChangeLocationType(TempVar2, TempVar3, 6, TempVar1)
13) END CHECK

Can someone please try to explain what is going on in these events. I understand some of it, and have tried really hard...any help would be appreciated!

If I can learn how to code the one event that I want (thanks to Ormand for helping with the first part) maybe I can expound on others :)

So my goals are:

Deal a card to the player at the beginning of the turn. (Completed)
Make a card that lets the player place a location (noT completed, totaly bumfuzzled!)



_____________________________

Th only reason some people are still alive is because it is illegal to kill them!

(in reply to Ormand)
Post #: 3
RE: Help withCards - 10/3/2015 7:20:32 PM   
Ormand


Posts: 682
Joined: 2/17/2009
Status: offline
Interesting. I haven't delved into the cards as much as I should.

First of all, I think this is an action card meant to be played by an officer, as the event looks for the location of a unit whose identity is TempVar4. This must be coming into the event through the playing of the card from the officer (must be hard-coded). So, if you are doing it as a player, I think there will be a problem since TempVar4 is not defined.

Second, the reference to the string is the string ID not the number of the string. If you look in the strings, this is at the end of the name it will say (ID94). This is actually the 62nd string in the list. This string lists for each landscape type (not loctype which makes it a bit confusing since LT is used for loctype) and sets a 0 or 1 if the landscape can be fortified. There are 49 entries for the 49 landscape types. (This is where I have made a mistake with my 4Seasons mod, by not checking this and adding all my additional landscapes to this list).
0) EXECUTE: ExecClearMatrix(0, 0)                                         ! clears matrix for slot 0 and sets entries to 0
1) SETVAR: TempVar11 = 0             
2) SETVAR: TempVar12 = CheckMapWidth                                      ! number of horizontal hexes
3) SETVAR: TempVar21 = 0
4) SETVAR: TempVar22 = CheckMapHeight                                     ! number of vertical hexes
5) SETVAR: TempVar31 = CheckUnitX(TempVar4)                               ! checks x location of unit TempVar4
6) SETVAR: TempVar41 = CheckUnitY(TempVar4)                               ! checks y-location for unit TempVar4
7) LOOPER: TempVar0 FROM TempVar11 TO TempVar12                           ! loop over horizontal map, x
8) LOOPER: TempVar1 FROM TempVar21 TO TempVar22                           !  loop over vertical, y
9) CHECK: CheckHexOwner(TempVar0, TempVar1) == CheckTurn                  !  see if you own hex (TempVar0,TempVar1)
10) CHECK: CheckDistance(TempVar31, TempVar41, TempVar0, TempVar1) =< 5   !  Distance between hex and unit TempVar4 < 5
11) CHECK: CheckLocTypeXY(TempVar0, TempVar1) == -1                     !  Make sure hex is not a loctype
12) SETVAR: TempVar8 = CheckLandscapeType(TempVar0, TempVar1)           !  find out what landscape it is
13) CHECK: CheckStringList(94, TempVar8, 1) == 1                        ! check string list to see if fort can be built
14) EXECUTE: ExecSetSlot(TempVar0, TempVar1, 0, 1)                      !  if so set slot 0 to 1 for this hex, allows building fort
15) END CHECK
16) END CHECK
17) END CHECK
18) END CHECK
19) END LOOPER
20) END LOOPER


Not having coded officer cards, I am not positive, but pretty sure that TempVar4 is being hard-coded passed into the event (I can't see how it gets in otherwise). So, this event is actually checking a few things, but the main thing is to set up the matrix for Slot 0 by setting a value of 1 for hexes that are within five hexes of unit TempVar4 and are allowed to have a fort based on the landscape type and loctype.


For the other event
0) ' tempvar2 & 3 are set as selected x,y
1) SETVAR: TempVar0 = CheckTurn                           ! sets TempVar0 to current regime (same as turn)
2) SETVAR: TempVar1 = CheckRegimePeople(TempVar0)         ! sets TempVar1 to regime people type
3) SETVAR: TempVar900 = CheckUnitHistorical(TempVar4)     ! Next set up variables to be passed into FunctionRisk
4) SETVAR: TempVar901 = 10                                ! TempVar4 is current unit, and must be passed in by playing card
5) SETVAR: TempVar902 = 3
6) SETVAR: TempVar911 = 98
7) SETVAR: TempVar912 = 105
8) EXECUTE: CallFunction('FunctionRisk')                  !  Eexcutes the risk for the officer
9) CHECK: TempVar950 == 0                                 !  TempVAR950 = 0 means officer still lives
10) EXECUTE: ExecGiveCommanderXP(TempVar4, 10)            !  gives experience points to officer
11) EXECUTE: ExecMessage(TempVar0, -1, -1, -1)            !  sends a message to player
12) EXECUTE: ExecChangeLocationType(TempVar2, TempVar3, 6, TempVar1)   ! here is where the loctype is changed 
13) END CHECK


The last execute is where the selected hex (TempVar2,TempVar3) is set to LocType=6, which is cheaper fortress, with people TempVar1. The people type is needed because some LocTypes can build stuff, and the production is controlled by the people type.

In short, you can't do what you want to do this way. That is, I am assuming you want to give a card to a human player, who can then be able to place a fortification on a hex. This card has to be played by an officer, otherwise TempVar4 is not defined, and it tries to do stuff for the officer, which it can't do.

You need to make a new card, with new events that are very similar to what already exists. For the pre-event, take out the check for location of unit TempVar4 and remove the CheckDistanc check. In the other even, take out everything except lines 0,1,2,12.

This should allow you to select the hex and place a cheaper fortress. By the way, Loctype 4-7 are all fortresses, so you could choose which one you want to place.


< Message edited by Ormand -- 10/3/2015 8:23:44 PM >

(in reply to E6Jarhead)
Post #: 4
RE: Help withCards - 10/3/2015 8:04:21 PM   
E6Jarhead

 

Posts: 29
Joined: 6/1/2015
From: Hendersonville, NC
Status: offline
So you made the 4seasons mod? Awesome.

I have 0 experience with computer programming. I honestly dont understand 90% of what I see but I am very good at stealing little bits of codes from events etc and mashing them into my own mod.

For example I stole your coding for beaches from the 4seasons mod. I of course use it to place beaches on the map and have made all other LT's as un-amphibious. (I do have a problem with beaches disappearing after the 1st turn if I try to run a game with weather, but Ill ask about that later?) I also was able to mod your snippet for beaches to check the map for bridges and assign VP's to the hex on either end of the bridge trying to force the AI to want to take and hold these choke points.

Thank you for your responses, it will take me a bit to read and try to comprehend what you have suggested but I'm on it!


I have also written all sorts of events to change the random map after it is generated and before play to make it more interesting.

And yes I was thinking that the fact that these cards are tied to an officer might be a factor, I have spent the last 5 hours off and on between the kids and wife etc...trying to modify those events. I'll let you know if I get anywhere.



_____________________________

Th only reason some people are still alive is because it is illegal to kill them!

(in reply to Ormand)
Post #: 5
RE: Help withCards - 10/4/2015 12:02:54 AM   
Ormand


Posts: 682
Joined: 2/17/2009
Status: offline
Glad to be of help.

I have been updating 4 Seasons. I fixed some units, and of course I have been putting in the 3d-models. I got diverted by that activity. I was also working on a full random game replacement, but the 3d-modeling venture got in the way.

Some of these events are hard to understand, and very few are commented. In addition, there isn't a lot of documentation for the functions. Some are in the first manual, but there are many more. You can see the list with some explanations at the ATG wiki. I have found this to be really helpful, as incomplete as it is. My coding experience is basically limited to FORTRAN 77 & 95, with some dabbling in C, C++ and python. But, I have written two codes with 20,000+ lines. Reading and writing in ATG is more challenging.

Let me guess one issue with the beaches and weather. In order for the weather to work, you need to look at Stringlist ID45, or the 14th in the list. This basically lists how the terrains morph with weather. The first column is the landscape number, they all have to be here. Then it has the landscape terrain type for regular, mud, and snow. Note that the morph is essentially repeated for all three terrain types, for example, the roes associated with columns 0, 15, 26 (plains) would read 0, 15, 26. That is terrain 15 morphs to 0 in regular, and 26 for snow.






Attachment (1)

< Message edited by Ormand -- 10/4/2015 1:05:57 AM >

(in reply to E6Jarhead)
Post #: 6
RE: Help withCards - 10/12/2015 4:39:07 AM   
E6Jarhead

 

Posts: 29
Joined: 6/1/2015
From: Hendersonville, NC
Status: offline
Hot Damn....it worked!! Thanks!!

_____________________________

Th only reason some people are still alive is because it is illegal to kill them!

(in reply to Ormand)
Post #: 7
RE: Help withCards - 10/12/2015 4:59:34 AM   
Ormand


Posts: 682
Joined: 2/17/2009
Status: offline
Glad to be of use!

(in reply to E6Jarhead)
Post #: 8
RE: Help withCards - 10/14/2015 3:00:26 AM   
E6Jarhead

 

Posts: 29
Joined: 6/1/2015
From: Hendersonville, NC
Status: offline
I have (3) Cards made which require (2) events each, a “Pre Execute Event “ and a “Execute Event”

These card will allow the Player to Choose an Armored Division or a Naval Group etc to Pre-deploy to a strategic location instead of having to move all the ll units from far flung corners of the empire over the next several turns

I have listed the cards and associated and problems I encounter.


-----------------------------------------
CARD #1 “Place Land Units”
----------------------------------------

Problems:
1. Will not allow placement of unit on a “Location” such as in a city or a fort that was just placed
2. When player # 2 (etc) tries to place unit it will change the ownership of the hex the unit is placed in and the people of the unit are not the same as the player placing the unit.

-----------------------------------------
0) ' Pre Event Land Placement
1) EXECUTE: ExecClearMatrix(0, 0) ! I don’t know what matrix is being cleared?
2) SETVAR: TempVar11 = 0
3) SETVAR: TempVar12 = CheckMapWidth
4) SETVAR: TempVar21 = 0
5) SETVAR: TempVar22 = CheckMapHeight
6) LOOPER: TempVar0 FROM TempVar11 TO TempVar12
7) LOOPER: TempVar1 FROM TempVar21 TO TempVar22
8) CHECK: CheckHexOwner(TempVar0, TempVar1) == CheckTurn ! this checks each hex and logs the regime that owns the hex?
9) CHECK: CheckLocTypeXY(TempVar0, TempVar1) == -1 !This checks each location type but what does the -1 do?
10) SETVAR: TempVar8 = CheckLandscapeType(TempVar0, TempVar1) !this is setting TV 8 for use in the stringlist.
11) CHECK: CheckStringList(94, TempVar8, 1) == 1 ! I still don’t know what SL it is using? Or for what?
12) EXECUTE: ExecSetSlot(TempVar0, TempVar1, 0, 1) !Why is it setting a slot?
13) END CHECK
14) END CHECK
15) END CHECK
16) END LOOPER
17) END LOOPER

0) ' Place Land Unit
1) ' tempvar2 & 3 are set as selected x,y
2) SETVAR: TempVar0 = CheckTurn !I would think that this is seeing which regime is playing this turn so that TV 1 below is set correctly?
3) SETVAR: TempVar1 = CheckRegimePeople(TempVar0)
4) EXECUTE: ExecAddUnit(3, TempVar2, TempVar3, 0) !The 0 says to make it the belong to Regime 0, If I change it to TempV 1 (which I thought was set by the line above, it still does weird things and changed the hex owner away from the regime placing the unit

----------------------------------------------
CARD #2 “Place Air Units”
----------------------------------------------
Problems:
1. Will not allow placement of unit on a “Location” such as a City (which is an airfield) or an airfield
2. Places the Air Unit on a landscape hex (its ok it lets you (Fly) the Air Unit to an airfield. But it would be nice if it was able to be placed in the correct location first.
3. When player # 2 (etc) tries to place unit it will change the ownership of the hex the unit is placed in and the people of the unit are not the same as the player placing the unit.

----------------------------------------------
0) ' Pre Event Air Placement
1) EXECUTE: ExecClearMatrix(0, 0)
2) SETVAR: TempVar11 = 0
3) SETVAR: TempVar12 = CheckMapWidth
4) SETVAR: TempVar21 = 0
5) SETVAR: TempVar22 = CheckMapHeight
6) LOOPER: TempVar0 FROM TempVar11 TO TempVar12
7) LOOPER: TempVar1 FROM TempVar21 TO TempVar22
8) CHECK: CheckHexOwner(TempVar0, TempVar1) == CheckTurn
9) CHECK: CheckLocTypeXY(TempVar0, TempVar1) == -1
10) SETVAR: TempVar8 = CheckLandscapeType(TempVar0, TempVar1)
11) CHECK: CheckStringList(94, TempVar8, 1) == 1
12) EXECUTE: ExecSetSlot(TempVar0, TempVar1, 0, 1)
13) END CHECK
14) END CHECK
15) END CHECK
16) END LOOPER
17) END LOOPER

0) ' Start Plane
1) ' tempvar2 & 3 are set as selected x,y
2) SETVAR: TempVar0 = CheckTurn
3) SETVAR: TempVar1 = CheckRegimePeople(TempVar0)
4) EXECUTE: ExecAddUnit(11, TempVar2, TempVar3, 0)

----------------------------------------------
CARD #2 “Place Air Units”
------------------------------------------------
Problems:
1. Will not allow placement of unit on a “Location” (Such as a City, which is a Port or a Port)
2. Places the Naval Unit on a (Land) landscape hex (Not a Sea Hex) (its ok it lets you (move) the Naval Unit out to sea as long as you select a Land hex that is adjacent to the sea. But it would be nice if it was able to be placed in the Sea or in a Location that is a port first.
3. When player # 2 (etc) tries to place unit it will change the ownership of the hex the unit is placed in and the people of the unit are not the same as the player placing the unit.

--------------------------------------------------
0) ' Pre Event Sea Placement
1) EXECUTE: ExecClearMatrix(0, 0)
2) SETVAR: TempVar11 = 0
3) SETVAR: TempVar12 = CheckMapWidth
4) SETVAR: TempVar21 = 0
5) SETVAR: TempVar22 = CheckMapHeight
6) LOOPER: TempVar0 FROM TempVar11 TO TempVar12
7) LOOPER: TempVar1 FROM TempVar21 TO TempVar22
8) CHECK: CheckHexOwner(TempVar0, TempVar1) == CheckTurn
9) CHECK: CheckLocTypeXY(TempVar0, TempVar1) == -1
10) SETVAR: TempVar8 = CheckLandscapeType(TempVar0, TempVar1)
11) CHECK: CheckStringList(94, TempVar8, 1) == 1
12) EXECUTE: ExecSetSlot(TempVar0, TempVar1, 0, 1)
13) END CHECK
14) END CHECK
15) END CHECK
16) END LOOPER
17) END LOOPER

0) ' Start Ship
1) ' tempvar2 & 3 are set as selected x,y
2) SETVAR: TempVar0 = CheckTurn
3) SETVAR: TempVar1 = CheckRegimePeople(TempVar0)
4) EXECUTE: ExecAddUnit(11, TempVar2, TempVar3, 0)

----------------------------------------------------------------
In addition, when I create a Predefined Unit for the events to place when the units are placed the units are the people of the Predefined unit. I want to be able to have the correct people within the unit as the regime that is placing the unit. I could do this by predefining for example (8) Engineer Units with the (8) different peoples, then create corresponding cards for each regime then each unit, I could get into making hundreds of cards!

Also I want to be able to remove these dealt cards after the turn it is a one time shot at purchasing and placing these units.

I’m sure you (Ormand) or anybody responding is busy..but any help will be appreciated!
Thanks


< Message edited by E6Jarhead -- 10/14/2015 4:10:07 AM >


_____________________________

Th only reason some people are still alive is because it is illegal to kill them!

(in reply to Ormand)
Post #: 9
RE: Help withCards - 10/14/2015 7:02:53 AM   
Ormand


Posts: 682
Joined: 2/17/2009
Status: offline
Unfortunately, I am about to do a three day trip and won't be able to spend anytime on anything until Saturday. But, in the first event, the matrix is a Gameslot for the map. The first entry is the number and the second is the value. As I see it, this is a convenient way to store some data that you want to use to modify the map, or to use to tell you something. For example, in the previous event, where you had trouble, the matrix was used to determine if a fortress could be put there. The event first cleared the matrix, i.e., set to zero, and then if it was allowed set it to 1. Then, if you wanted to put a fortress there, the slot was checked, and if the value for that hex was equal to one, then a fortress could be put there. If zero, then not allowed. This same concept is used for weather.

Once a scenario is made, you can check these in the editor. Go to the "Pick Draw Type" and select Slots. You'll see the first one, #0, is temp for cards. If you select it, numbers will come up. A good example is after you make a random game with weather, open the editor, and open slots, choose 3, and then any value. Arrays of numbers will pop up. 1 at the top, then 2, etc. These are defining the arctic, temperate, etc., zones. If you click on a hex in the editor, it will set the value chose, i.e., 0, 1, 2, etc. I am not sure what kind of number you can put there, but, certainly 0-125. There are also 10 (0-9) slots.

Line 8) does check if hex owner is current regime. Checkturn returns a number that is equivalent to regime number (namely the turn is for a given regime)

line 9) checks the location type, and -1 would be that it is NOT a Loctype. In the editor, look at the LT panel. There is a list of location types, city, capitol, fortress etc. If the hex has a Loctype, it will return one of these numbers. If not, it will be -1. Thus, event may NOT allow you to deploy a unit in hex that is a city, fort, etc.

line 10, is the returning the landscape type listed in the "Land" panel, namely plains, sea, city, etc.

Line 11, is checking the stringlist ID=94 for the landscape found in the line above. This is the "Can Build Fort?" string list. It looks in line TempVar8 (under the LT column) and brings back the value in column #1 (starts counting at 0) "1=yes, 0=no". If this value == 1 then the check is satisfied. You may not want to do this check.

Line 12, all the checks are satisfied, so now put a value of one into Slot = 0 for the hex. This, in principle, will then be checked in the follow up event, and if == 1 place unit.


In the place land unit event
line 2, yes this checks the regime, and puts in TempVar0
line 3, check people of regime puts in TempVar1
line 4, places unit#3 in hex. The zero in the 3rd entry ALWAYS gives it to regime 0. You want to put TempVar0 here. The unit that is placed is pre-defined unit #3 found in the "Units" panel.

Now, unless you are checking Slot 0 for a 1 or 0, this event should place the unit. But, it will always give it to regime 0, which will change ownership. I am not sure what would happen if it is occupied by other units. That is primarily why the checks in the pre-event are done, and the slot is set to 1 if the unit can be placed there.

(in reply to E6Jarhead)
Post #: 10
RE: Help withCards - 10/15/2015 11:05:09 PM   
Ormand


Posts: 682
Joined: 2/17/2009
Status: offline
Still on travel, but realized calrifying something might help. The reason why the slot matters is that if you based the card on fortify, etc., you'll see that there are two entries AreaSlot and AreaValue. If AreaSlot=0 and AreaValue=1 then it will allow to select a hex that has a value of 1 set in Slot 0. So, you're pre-event is to be set up so that it sets values of 1 in Slot 0 that you will then be allowed to select. The selection, will then send the hex values to the next event that will place the unit in that hex. Hence, your problem of not being able to place the unit in a city, airfield, or any LocType is due to that line that I pointed out where the check was for LocType=-1. This was OK for the fortification because you shouldn't be allowed to put a fortification in a hex with a different loctype already there.

(in reply to Ormand)
Post #: 11
RE: Help withCards - 10/17/2015 7:44:16 PM   
Ormand


Posts: 682
Joined: 2/17/2009
Status: offline
Back home (for a week at least).

I think the overall comments for the first event, are appropriate for the second two as well.

For the aircraft, you would have to check that the Loctype is a capitol, city, airfield or aircraft factory. So, instead of

CHECK: CheckLocTypeXY(TempVar0, TempVar1) == -1

you would need to check that this equals, 0, 1, 9, or 10. This will set the area slot to 1 if it is one of these. And, it has to be otherwise, you won't be able to move it (except via strategic transfer).

For the ships, you need to check the landscape type. In principle, you can place a ship in a city, but if it is not adjacent to water, it is stuck.

Here, you only need to check the landscape type. I believe that you can't own sea hexes. This will set area slot 0 equal to 1 for all sea hexes.

' Pre Event Sea Placement
EXECUTE: ExecClearMatrix(0, 0)
SETVAR: TempVar11 = 0
SETVAR: TempVar12 = CheckMapWidth
SETVAR: TempVar21 = 0
SETVAR: TempVar22 = CheckMapHeight
LOOPER: TempVar0 FROM TempVar11 TO TempVar12
LOOPER: TempVar1 FROM TempVar21 TO TempVar22
CHECK: CheckLandscapeType(TempVar0, TempVar1) == 1
EXECUTE: ExecSetSlot(TempVar0, TempVar1, 0, 1)
END CHECK
END LOOPER
END LOOPER


This is probably overly broad, in that you could place a naval unit in any sea hex, anywhere.

You could do something more restrictive. Say port cities. In this case, you would check if the hex is a capitol, city, port, or shipyard, check that the current player owns it, and then set the area slot. You can do this much more efficiently, however, by looping over all the locations on the map, instead of all the hexes. This is an event that will probably work. I haven't debugged it. The idea is to check the location types, see if they are owned by the current regime, with the same people. Then, check if the loctype is a capitol or city (if you want towns, you need to add another check right there). Then, determine if the capitol or city is adjacent to a sea or rainy sea hex. Do this by checking the six adjacent hexes. You could write a function to get the new hex, but here it is. If it is adjacent to a sea hex, then set TempVar20 to 1 (start with it set to zero). Then check if the loctype is a port or shipyard, and set TempVar20=1 (they should be adjacent by definition). Then, if TempVar20, put the value of 1 in slot #0 for this hex.

Note that a few things are redundant, like lines 21 and 22. I used this block as a template for all six, so it was easier to have these things in and paste the whole block later. Obviously, if I add zero to x or y I don't need to check. But, since placing the ends can be confusing, it was just easier to do it this way. Also, obviously at line 131, I could skip the check on TempVar20 and just set the slot value equal to TempVar20 since it is either zero or one. But, I wanted to leave in an explicit check for you to see what is going on.


0) ' Get regime # and regime people
1) SETVAR: TempVar0 = CheckTurn
2) SETVAR: TempVar1 = CheckRegimePeople(TempVar0)
3) ' Clear matrix for slot #0
4) EXECUTE: ExecClearMatrix(0, 0)
5) ' Loop over all location types
6) LOOPER: TempVar10 FROM 0 TO CheckLocCounter
7) ' Get x & y coordinates
8) SETVAR: TempVar11 = CheckLocX(TempVar10)
9) SETVAR: TempVar12 = CheckLocX(TempVar10)
10) ' Check if owned by regime
11) CHECK: CheckHexOwner(TempVar11, TempVar12) == TempVar0
12) ' Initialize TempVar20 which we will use to see if location type is port
13) SETVAR: TempVar20 = 0
14) ' Check if location is capitol or city
15) CHECK: CheckLocTypeXY(TempVar11, TempVar12) == 0
16) CHECK: CheckLocTypeXY(TempVar11, TempVar12) == 1
17) ' Now check if any of the six adjacent hexes are sea
18) ' Check all six hexes
19) ' hex #1 =(x,y-1), make sure the hexes are on the map
20) SETVAR: TempVar111 = TempVar10
21) SETVAR: TempVar111 + 0
22) CHECK: TempVar111 => 0
23) SETVAR: TempVar112 = TempVar12
24) SETVAR: TempVar112 - 1
25) CHECK: TempVar112 => 0
26) ' Check if sea
27) CHECK: CheckLandscapeType(TempVar111, TempVar112) == 1
28) ' Check if rainy sea
29) CHECK: CheckLandscapeType(TempVar111, TempVar112) == 49
30) ' Is sea hex, so set TempVar20=1
31) SETVAR: TempVar20 = 1
32) END CHECK
33) END CHECK
34) END CHECK
35) END CHECK
36) ' hex #2 =(x+1,y-1), make sure the hexes are on the map
37) SETVAR: TempVar111 = TempVar10
38) SETVAR: TempVar111 + 1
39) CHECK: TempVar111 =< CheckMapWidth
40) SETVAR: TempVar112 = TempVar12
41) SETVAR: TempVar112 - 1
42) CHECK: TempVar112 => 0
43) ' Check if sea
44) CHECK: CheckLandscapeType(TempVar111, TempVar112) == 1
45) ' Check if rainy sea
46) CHECK: CheckLandscapeType(TempVar111, TempVar112) == 49
47) ' Is sea hex, so set TempVar20=1
48) SETVAR: TempVar20 = 1
49) END CHECK
50) END CHECK
51) END CHECK
52) END CHECK
53) ' hex #3 =(x+1,y), make sure the hexes are on the map
54) SETVAR: TempVar111 = TempVar10
55) SETVAR: TempVar111 + 1
56) CHECK: TempVar111 =< CheckMapWidth
57) SETVAR: TempVar112 = TempVar12
58) SETVAR: TempVar112 + 0
59) CHECK: TempVar112 => 0
60) ' Check if sea
61) CHECK: CheckLandscapeType(TempVar111, TempVar112) == 1
62) ' Check if rainy sea
63) CHECK: CheckLandscapeType(TempVar111, TempVar112) == 49
64) ' Is sea hex, so set TempVar20=1
65) SETVAR: TempVar20 = 1
66) END CHECK
67) END CHECK
68) END CHECK
69) END CHECK
70) ' hex #4 =(x,y+1), make sure the hexes are on the map
71) SETVAR: TempVar111 = TempVar10
72) SETVAR: TempVar111 + 0
73) CHECK: TempVar111 => 0
74) SETVAR: TempVar112 = TempVar12
75) SETVAR: TempVar112 + 1
76) CHECK: TempVar112 =< CheckMapHeight
77) ' Check if sea
78) CHECK: CheckLandscapeType(TempVar111, TempVar112) == 1
79) ' Check if rainy sea
80) CHECK: CheckLandscapeType(TempVar111, TempVar112) == 49
81) ' Is sea hex, so set TempVar20=1
82) SETVAR: TempVar20 = 1
83) END CHECK
84) END CHECK
85) END CHECK
86) END CHECK
87) ' hex #1 =(x-1,y), make sure the hexes are on the map
88) SETVAR: TempVar111 = TempVar10
89) SETVAR: TempVar111 - 1
90) CHECK: TempVar111 => 0
91) SETVAR: TempVar112 = TempVar12
92) SETVAR: TempVar112 + 0
93) CHECK: TempVar112 => 0
94) ' Check if sea
95) CHECK: CheckLandscapeType(TempVar111, TempVar112) == 1
96) ' Check if rainy sea
97) CHECK: CheckLandscapeType(TempVar111, TempVar112) == 49
98) ' Is sea hex, so set TempVar20=1
99) SETVAR: TempVar20 = 1
100) END CHECK
101) END CHECK
102) END CHECK
103) END CHECK
104) ' hex #6 =(x-1,y-1), make sure the hexes are on the map
105) SETVAR: TempVar111 = TempVar10
106) SETVAR: TempVar111 - 1
107) CHECK: TempVar111 => 0
108) SETVAR: TempVar112 = TempVar12
109) SETVAR: TempVar112 - 1
110) CHECK: TempVar112 => 0
111) ' Check if sea
112) CHECK: CheckLandscapeType(TempVar111, TempVar112) == 1
113) ' Check if rainy sea
114) CHECK: CheckLandscapeType(TempVar111, TempVar112) == 49
115) ' Is sea hex, so set TempVar20=1
116) SETVAR: TempVar20 = 1
117) END CHECK
118) END CHECK
119) END CHECK
120) END CHECK
121) ' Finished checking if Capitol or cities are ports
122) ' Now check if loctype is port or shipyard
123) CHECK: CheckLocTypeXY(TempVar11, TempVar12) == 8
124) CHECK: CheckLocTypeXY(TempVar11, TempVar12) == 13
125) ' They are so, set TempVar20 = 1
126) SETVAR: TempVar20 = 1
127) END CHECK
128) END CHECK
129) ' Now set slot#0 for this hex equal to 1
130) CHECK: TempVar20 == 1
131) EXECUTE: ExecSetSlot(TempVar11, TempVar12, 0, TempVar20)
132) END CHECK
133) END CHECK
134) END CHECK
135) END CHECK
136) END LOOPER






< Message edited by Ormand -- 10/17/2015 8:47:01 PM >

(in reply to Ormand)
Post #: 12
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Advanced Tactics Series >> Mods and Scenarios >> Help withCards Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.750