Cossacks/American Conquest Szenario Quellcode

Rund um die Cossacks-Reihe

Moderator: Moderatoren

Benutzeravatar
Lord Löwenherz
Optio ad spem
Optio ad spem
Beiträge: 669
Registriert: 11. März 2012 10:54
:
User des Monats Teilnahme an einem Contest Modder

Cossacks/American Conquest Szenario Quellcode

Beitragvon Lord Löwenherz » 15. März 2019 21:48

Hallo liebe Cossacks und American Conquest Fans,

ich habe in den weiten des Internet eine interessante Entdeckung gemacht. Hierbei handelt es sich um einen Quellcode von 2 Szenarien aus der Russland und England Kampagne von Cossacks: European Wars. Sicherlich ist das leider nicht der akutellste Stand und ob sich noch Leute im Jahre 2019 für so alte Spiele interessieren, wag ich ernstlich zu bezweifeln. Sicherlich werden die User hier auch kaum Ambitionen hegen, auch noch neue Szenarien zu programmiern, aber nichts desto trotz veröffentliche ich den Quellcode hier. Aber man kann mit den original Quellcode ja eine Menge anstellen.

Cossacks

Mithilfe von Visual C++ 6 einfach die "workspaces" im Ordner der jeweiligen 2 Beispielszenarien öffnen. In Mission.h befinden sich die jeweiligen Funktionen, mit denen man dann sein Szenario erstellen kann. Damit könnt ihr dann eure Mission in der main-Datei (.cpp) zusammenstellen. Zum Schluss mit Visual C++ 6 die Daten zu der Mission.dll kompilieren. Wie hier die uralte Entwicklungsumgebung Visual C++6 findet, das müsst ihr selber herausfinden. :strategie_zone_9:

American Conquest

Entwickler GSC Gameworld hat für den Nachfolger American Conquest natürlich einige neues Scriptfunktionen erstellt, wie Befehle das Einheiten Gebäude stürmen oder tanzende Indianergruppen. Da das Spiel aber hauptsächlich auf Cossacks bassiert, funktionieren mit einigen kleinen Einschränkungen noch alle Szenarioscriptbefehle in American Conquest. Das ist hier sicherlich nicht perfekt, aber hey, vorher gab es überhaupt keine Möglichkeiten neue Missionen zu erstellen. ;)

Tipp: Mithilfe des Scenario-Tools aus Cossacks - Back to war und American Conquest Fight Back, kannst du schnell und einfach eine Mission in das Einzelspielermissionen Menü einbinden. Da sind die Tools noch ganz nützlich, ansonsten stürzen sie zu häufig ab.

Danach einfach über den Editor die Dynamic Link Library in die Mission einbinden.

Jetzt folgt eine Bedienungsanleitung auf Englisch.




1. What is the scenario tool?
This is a tool used to create triggers and set up various parameters for user made missions for the game Cossacks. Essentially, it is used for the same purpose as the newer Scenario Editor that came bundled with Cossacks The difference is that the new Scenario Editor has a user interface, and more integrated with the map editor. This makes the process of making a scenario easier and more intuitive. Scenario Tool on the other hand has no user interface at all. In fact, it would be wrong to call it a tool. It is no more than a few example source codes in C++. The code then has to be compiled before you can use it in the game. It is anything but user friendly. There is a documentation that came with it but unfortunately (for us English speaking mob), it is in Russian.

You can download it at our download section

So why do we need the Scenario Tool?

There are simply too many bugs and missing features in the new Scenario Editor rendering it frustrating to use. In Scenario Tool, everything works. Power is also an advantage that Scenario Tool has over the Scenario Editor. As it is essentially a program source code, you can code it to do almost anything that you want. Including things that are not neccessarily originally included or intended for the game. Here the limit is your imagination ... well almost!

2. Requirements

As I have mentioned it above, Scenario Tool consists of source code examples in Visual C++, you therefore need Visual C++ 6 to use it. Obviously you also need Windows, the game Cossacks +/- AoW. And you will need to have some programming knowledge. It would also be essential that you are familiar with the Scenario Editor that came bundled with Cossacks Art of War as well. You do not need to have full knowledge C++ to use it, but essential if you want to fully utilize its power. As I am neither a professional programmer nor familiar with any other C++ utilities, I am writing this guide based on Visual C++ 6 from Microsoft.

3. How to use

Now that we are done with all the formalities, lets get down to business.

Assuming that you have had Visual C++ installed, I would now like to direct you to open up the subfolder Work01 of Russia folder. In Work01, you should find a file called Mission.dsw. This is the workspace file. Double clicking on this should open up Visual C++ and put you in the thick of a coding frenzy. Another option would be to open Visual C++ first and then go to menu File -> Open Workspace to open this file.

At this point, I would ask you to go to the menu Project -> Settings. Choose Win 32 Release option from the drop down menu. Then go to the Link tab on the right and you should see a textbox below. Scroll this textbox until you see /out:"Release/Mission.dll". This setting specifies where your file is going to be generated and under what name. You can change the text within the double brackets to a more appropriate Folder name, File name if you so wish. You would do the same for Win 32 Debug as well. Remember to set the drop down menu back to Win 32 Release option when you are done.

Here, I'd direct your attention to the window on the left hand side. You should see 2 tabs underneath it, ClassView and FileView. Choose FileView. Going up from there you should see a treeview. Expanding Header Files, you should see Mission.h. Clicking this would give you the codes for this file in the main window. This is where all the main functions for the scenario are defined. Have a browse through to familiarise yourself with them.

This is where we take a break and have ourselves a cuppa & a smoko...

Are we back from our break yet?

Good, lets continue.

Now that we are recharged, let move on to Source Files. Expanding this and you will see Mission.cpp. This is the nerve center of your program. This is where you do your programming. So lets start.

For those of you who are not familiar with C++, let me give you a few pointers.

Libraries

Because C++ has only a very limited number of intrinsic functions, this is expanded by the inclusion of additional external libraries. This is stated in the first line #include "mission.h". You can of course use other libraries for maths, strings, etc if you wish but for our purpose, mission.h (.h = header file) is all we need.

Variables

If you are familiar with programming, you are familiar with the concept of variables. This is a value holder, and the values of course can be changed from within the program either at design-time or at run-time. So the next lot of statements after #include are variable declarations. Because we are working within the constraints of Cossacks, there are only one type of variable that you would need to worry about and this is GAMEOBJ.

This variable refers to all unit, unit types, upgrades, groups and zones. Names can be anything you want but be careful as C++ is case sensitive, and do try to avoid key words. Of course you would want to keep your naming convention logical for easier later reference to your codes. Declare all necessary variables that you might need here.

Another important pointer : REMEMBER THE SEMICOLON ; It tells C++ that it's the end of the line. Simply pressing ENTER to go to the next line will not do!.

One more thing for the uninitiated: // is the comment tag for a single line. Anything after this tag is ignored by C++ until it gets to the next line. You do not have to put a semicolon after this tag however. /* and */ tags (in this order) are comment block tags and anything multiple lines that is placed between these tags will be ignored by C++. Comments should be used liberally as you will find it a nightmare going back to your codes at a later time, trying to decipher what you have done without adequate comments.



How are we doing so far?

Lets press on if you dare.

Dysfunctional Functions

This is the real juicy bit as we are getting into the actual programming bit, so get your itchy fingers ready.

Again for those with lesser knowledge of programming, a Function is a block of codes that does something - calculation, drawing, play sound - just something. The beauty of a function is that you can call it again and again without having to rewrite the whole code again and again. In C++, functions can either return a value or ... not ...! A function starts at the open bracket { and ends at this end bracket }. Within a function, you might wish to use If logical blocks. This block also starts with { and ends with }. So you need to be careful and make sure that you have all the necessary brackets or the code will not compile.

In Cossacks, for our purpose, there are only two functions and they both do NOT return a value. They are OnInit() and ProcessScenary(). The word void before the function name indicate that the function does not return a value. Other "intrinsic" functions are available from the header file mission.h. Note the date type that may be returned by these functions. For example, int GetGlobalTime(); returns an integer. This returned value can later be used in your codes, for example, in a decision structure to test it against a certain value. Functions that do not return values simply just carry out an action with no returned values. I suggest you might have another go at reading this mission.h file again and try to commit some of the more common functions that you are likely to use to your memory.

OnInit()

This is where you would want to load your variables with values from the maps using the appropriate Register* function (these are functions declared in mission.h). For example you would want to load GAMEOBJ GROUP1 with a group from the map named StartGroup by entering this RegisterUnits(&GROUP1,"StartGroup"); The ampersand &, in C++, means by reference. You declare GROUP1 without the ampersand as GAMEOBJ and load the value to it with the ampersand in Register*() function. Just know this and use it. Full explannation is outside the scope of this manual.

Within this function, you should also set the player's name and set the players' alliance. You can do everything else in the next function.

About player's alliance: This is done by using ChangeFriend(Player as byte,Flag as byte) function. A byte has 8 bits and this equates to values of integer in the range of 0 to 255. Of course, there are only 8 players in Cossacks so the Player value is in the range of 0 to 7. (Note C++ start at 0 so in the script, 0 means Player 1 in the game. Confused?). From here, I will use C++ notation for Player. The integer Flag is used to set the player's alliance. You work out the value for the flag as followed:

Each player 0 - 7can either be an ally or enemy to the player that you are setting the alliance for. If its an enemy, the value is zero. If it's a friend:

Player 0 value is 1

Player 1 value is 2

Player 2 value is 4

Player 3 value is 8

Player 4 value is 16

Player 5 value is 32

Player 6 value is 64

Player 7 value is 128

So for example if you want to set alliance for Player 0 as friend to Player 2 and 3, then you set it as ChangeFriend(0,13). Breaking this down, value 13 is derived from : Player 0 value + Player 2 value + ... + Player 7 value. Of course, you are friendly to yourself so Player 0 value is 1. Player 2 value for a friend is 4 and Player 3 is 8. So 1 + 4 + 8 = 13.

Special value of 0 = enemy to everyone, and 255 = friend to everyone. 0 is the default value so you don't need to code for this if that's what you want in the scenario.

Take note that this makes you friend to Players 2 and 3 but they are not your friends. This means that Player 0 units will not attack Player 2 and 3 but Player 2 and 3 will attack Player 0. So you need to also code for these to be friend with Player 0 as well by ChangeFriend(2,13) and ChangeFriend(3,13).

So you can see that this feature is a lot more powerful than the simple feature of Change Relation in Scenario Editor.

ProcessScenary()

This is where the real fun starts. In this function, you code the flow for your scenario. Of all the different decision structures, you will only need to know one and that is if(){ }. Basically this tell the scenario to test for certain condition and if the conditions are met, you then go to the next statement within the if block. If the conditions are not met, the scenario will parse through to the next block of statements. Each block of statement commences at the open bracket { and ends at close bracket }. I will now introduce you to the different syntax of C++ needed to use this tool.

&& is AND

|| is OR

== is Logical comparator EQUAL

> is Logical comparotor GREATER THAN

< is Logical comparator SMALLER THAN

and finally >= and <= (you guess these two).

Triggers are defined as Trigg. Each has an identifying number, starting at 0. I do not know the actual limit for the number of triggers that you can have.

In each scenario, triggers start as being activated. After you have satisfied the condition and gone into an IF block for that trigger, you will need to turn it off by doing this : SetTrigg(whatevertriggernumber,0). If you want to have this trigger remaining active (ie. the equivalent of Activate Current Trigger of the Scenario Editor), you simply omit doing this.

Did you know that the function Patrol existed in Cossacks EW - GSC simply did not give it a button!.

Now you need to go through the list of available functions in Mission.h file and see which of those that you will need. Most of them are very much self explanatory. Then start coding.

After finishing coding, you need to build your DLL file. You can do so by going to the menu again and under Build, you choose Build Whatevermission.dll. You will find your DLL file in the folder that you have specified previously.

Copy this file to the UserMission folder of Cossacks. You can even put it in a subfolder if you so wish. Then you need to specify where path for this in the map editor under Set Starting Parameters. Now we are done. Load up the map and test it out.

It's unwieldy and sounds complicated, but it's really good fun, once you get the hang of it.




Download des Quellcodes:
Download

Der Download erfolgt von einen anderen Server, der einfachheit halber.
Zuletzt geändert von Lord Löwenherz am 15. März 2019 22:30, insgesamt 3-mal geändert.
Der echte Wüstenmod für Stronghold 2. Ich darf vorstellen: Stronghold 2 Crusader - https://www.moddb.com/mods/stronghold-2-the-crusades

Benutzeravatar
Lord Löwenherz
Optio ad spem
Optio ad spem
Beiträge: 669
Registriert: 11. März 2012 10:54
:
User des Monats Teilnahme an einem Contest Modder

Re: Cossacks/American Conquest Szenario Quellcode

Beitragvon Lord Löwenherz » 15. März 2019 22:03

Functions




//-------------External functions---------------//


void AssignNation(byte Src,byte Dst);



bool RegisterUnits(GAMEOBJ* GOBJ,char* Name);

Registration of Group.(&Group_perem.,”Name Group ”);



bool RegisterString(GAMEOBJ* GOBJ,char* ID);





bool RegisterSound(GAMEOBJ* GOBJ,char* Name);

void RegisterVar(void* Var,int size);(&____,size in bytes);

Variable registration (For variable storing)



void RegisterZone(GAMEOBJ* GOBJ,char* Name);

Zone registration .(&Zone_perem.,”Name Zone ”);





void RegisterVisibleZone(GAMEOBJ* GOBJ,char* Name);

?



bool RegisterUnitType(GAMEOBJ* GOBJ,char* Name);

Registration of unit’s type (&<type of variable>,”<Type of a unit from the description file of the nations .nds>”).



bool RegisterUpgrade(GAMEOBJ* GOBJ,char* Name);

Upgrade registration. (“<type a variable>,”<Type of an upgrade from the file of description of the nation.nds>”).





void InitialUpgrade(char* Grp,char* Upgrade);

Make an instant upgrade (“<Group name>”,”<Name of upgrade from file of description of the nation .nds >”). The group is necessary for nation instruction in which the upgrade becomes.



bool RegisterFormation(GAMEOBJ* GOBJ,char* Name);

Formation registration (necessary for creation of dynamic groups of units) (&”Variable of formation”,”<Name of construction from file orders.lst>”).



bool RegisterUnitsForm(GAMEOBJ* GOBJ,char* Name);

?



int GetUnitsAmount0(GAMEOBJ* Zone,byte Nation);

Returns a quantity of units of nation “NATION” in zone “ZONE”.



int GetUnitsAmount1(GAMEOBJ* Zone,GAMEOBJ* Group);

Returns a quantity of units of group “GROUP” in zone “ZONE”.





int GetUnitsAmount2(GAMEOBJ* Zone,GAMEOBJ* UnitType,byte Nation);

Returns a quantity of units of type “UnitType” of nation “Nation” in zone “ZONE”.



int GetTotalAmount0(GAMEOBJ* Group);

Returns a quantity of units in group “Group”.



int GetTotalAmount1(GAMEOBJ* UnitType,byte Nation);

Returns a quantity of units of nation “Nation” in group “Group”.



int GetReadyAmount(GAMEOBJ* UnitType,byte Nation);

?

bool IsUpgradeDoing(GAMEOBJ* Upgrade,byte Nation);

?

bool IsUpgradeDone(GAMEOBJ* Upgrade,byte Nation);

?



int GetAmountOfWarriors(byte Nat);

???



bool IsUpgradeEnabled(GAMEOBJ* Upgrade,byte Nation);

?

int GetDied(GAMEOBJ* UnitType,byte Nation);

?

bool CreateObject0(GAMEOBJ* DstObj,GAMEOBJ* Form,GAMEOBJ* UnitType,byte NatID,GAMEOBJ* Zone,byte Direction);

(&<Variable of dynamic group>, &<Variable of formation>, &<Variable of type of unit>, Nation, &<Variable of zone, in which units are created>, Direction)

Creates the dynamic group of nation “Nation” with direction “Direction”.



void ClearSelection(byte Nat);

Remove an allocation from units of nanion “Nat”.



void SelectUnits(GAMEOBJ* Group,bool Add);

Allocate units of group “Group”. “Add” shows, whether they will be united with previous allocation (1 – yes, 0 - no).



void SelectUnitsType(GAMEOBJ* UnitsType,byte Nat,bool Add);

?

void SelectUnits1(byte Nat, GAMEOBJ* Group, bool Add);

Allocate units of group “Group” of nation “Nat”. Add shows, whether they will be united with previous (1 – yes, 0 - no).





int GetNInside(byte Nat);

Returns quantity of units inside !The allocated! Of changer of nation “Nat”.



int GetMaxInside(byte Nat);

?



void PushUnitAway(byte Nat);

Put ashore(on beach) one unit from !The allocated! Of changer of nation “Nat”.



bool CheckLeaveAbility(byte Nat);

Returns 1, if !The allocated! Changer of nation “Nat” has moored to coast (differently 0).



void SendUnitsToTransport(byte Nat);

Get allocated units in allocated changer of nation “Nat”.



void PushAllUnitsAway(byte Nat);

Put ashore all units from !The allocated! Of changer of nation “Nat”.



void AttackZoneByArtillery(GAMEOBJ* ArtGroup,GAMEOBJ* Zone,byte Nat);

To fire units and constructions of nation “Nat” in zone “Zone” of artillery group “ArtGroup”.



void AttackBuildingsInZone(GAMEOBJ* ArtGroup,GAMEOBJ* Zone,byte Nat);

Обстреливать постройки нации Nat в зоне Zone артиллерией группы ArtGroup.



bool SelDie(byte Nat);

Kill the allocated units of nation “Nat”



bool SelOpenGates(byte Nat);

Open the allocated gate of nation “Nat”



bool SelCloseGates(byte Nat);

Close the allocated gate of nation “Nat”



bool SelSendTo(byte Nat,GAMEOBJ* Zone,byte Dir,byte Type);

Send the allocated units of nation “Nat” in zone “Zone”. Arrange them there in direction “Dir”. If “Type” is equal 2, then remember the previous way.



bool SelSendAndKill(byte Nat,GAMEOBJ* Zone,byte Dir,byte Type);

Send the allocated units of nation “Nat” in zone “ZONE”. Arrange them there in direction “Dir”. If “Type” is equal 2, then remember the previous way. Identically direction of units under the letter “A”.



void SelAttackGroup(byte Nat,GAMEOBJ* Enemy);

Attack by the allocated units of nation “NAT” group “Enemy”. Given command is necessary to repeat all time.



bool Patrol(byte Nat,GAMEOBJ* Zone,byte Dir);

Expose the patrol by the allocated units of nation “NAT” from current position to zone “ZONE”. “Dir” – direction of a turn of units in zone “ZONE”.



void ChangeFriends(byte Nat,byte Flags);
Establish a relation of nation “NAT” with others. “Flags” – size of “line” in the table of relation
Zuletzt geändert von Lord Löwenherz am 15. März 2019 22:10, insgesamt 1-mal geändert.
Der echte Wüstenmod für Stronghold 2. Ich darf vorstellen: Stronghold 2 Crusader - https://www.moddb.com/mods/stronghold-2-the-crusades

Benutzeravatar
Lord Löwenherz
Optio ad spem
Optio ad spem
Beiträge: 669
Registriert: 11. März 2012 10:54
:
User des Monats Teilnahme an einem Contest Modder

Re: Cossacks/American Conquest Szenario Quellcode

Beitragvon Lord Löwenherz » 15. März 2019 22:04

Functions Part 2




void SelChangeNation(byte SrcNat,byte DstNat);



establish to the allocated units of nation SrcNat new nation DstNat



void SetStandGround(byte Nat,byte val);


For the allocated group of nation “Nat” at “val=1” - establish “Stand Ground”, “0” - to remove.


void AllowAttack(byte Nat,byte val);


For the allocated group of nation “Nat” at the “val=1” – allow the attack, 0 – forbid.




void SelAutoKill(byte Nat);


?


void HINT(GAMEOBJ* Hint,int time);



?



void DisableMission(char MISSID);


Not to show an inscription marked with the Latin letter in file “Miss*.txt”, given out on F1. “MISSID” - the Latin letter in apostrophes.



void EnableMission(char MISSID);



To show an inscription marked with the Latin letter in the file “Miss*.txt” , given out on F1. “MISSSID – the Latin letter in apostrophes



void SetVictoryText(char* ID);



?



void SetLooseText(char* ID);



?



void ShowVictory();


Give out a message on a victory.




void LooseGame();



Give out a message on a defeat.



void ShowCentralText(char* ID,int time);



?


void ShowPage(char* Name);



Show the text from file “Miss*.txt”. Its identifier, for example “#PAGE1” specified in quotation marks.



bool AskQuestion(char* Name);



Returns the answer to a question from file “Miss*.txt”. Its identifier, “#PAGE1” specified in quotation marks.

Yes – 1, No – 0.




int GetResource(byte Nat,byte ID);


Returns quantity of resource ID at nation “NAT”.



ID for resources can be:



FOOD



GOLD



WOOD



STONE



IRON



COAL



void AddResource(byte Nat,byte ID,int Amount);



Add for nation “NAT” quantity of resource ID, equal “AMOUNT”.



void SetResource(byte Nat,byte ID,int Amount);



Establish for nation “NAT” quantity of resource ID, equal “AMOUNT”.




int GetUnitCost(byte Nat,GAMEOBJ* UnitType,byte ResID);



?




int GetUpgradeCost(byte Nat,GAMEOBJ* Upgrade,byte ResID);



?




void RunTimer(byte ID,int Long);



Start the timer number ID for the “LONG” period.



Time specified in the standard units, minute is approximately equal 1000.



bool TimerDone(byte ID);



Returns “true” if the timer has com to the end.





bool TimerDoneFirst(byte ID);



Returns “true” if the timer has com to the end. (1 time, after that “false” again).



bool TimerIsEmpty(byte ID);



Returns “true” if the timer is not started.



?



void FreeTimer(byte ID);



To null value of the timer. (As though it did not start).



int GetTime(byte ID);



?


int GetGlobalTime();



Returns global game time (its readout is conducted in same units, as the timer, readout begins with mission start).



byte Trigg(byte ID);



Returns a value of the trigger ID.




void SetTrigg(byte ID,byte Val);



Establishes to trigger ID value “VAL”.



void RunAI(byte Nat);



Not to use.



void RunAIWithPeasants(byte Nat,char* P_Name);



Not to use.





void SetStartPoint(GAMEOBJ* Zone);



Establish the screen in zone “ZONE”.




bool UnitsCenter(GAMEOBJ* DstZone,GAMEOBJ* Units,word R);



?





bool SelCenter(GAMEOBJ* DstZone,byte Nat,int R);


?
Zuletzt geändert von Lord Löwenherz am 15. März 2019 22:10, insgesamt 3-mal geändert.
Der echte Wüstenmod für Stronghold 2. Ich darf vorstellen: Stronghold 2 Crusader - https://www.moddb.com/mods/stronghold-2-the-crusades

Benutzeravatar
Lord Löwenherz
Optio ad spem
Optio ad spem
Beiträge: 669
Registriert: 11. März 2012 10:54
:
User des Monats Teilnahme an einem Contest Modder

Re: Cossacks/American Conquest Szenario Quellcode

Beitragvon Lord Löwenherz » 15. März 2019 22:08

Functions Part 3




bool CreateZoneNearUnit(GAMEOBJ* DstZone,GAMEOBJ* Zone,GAMEOBJ* UnitType,byte Nat,int R);



Creates the dynamic zone “DstZone”, located most close to zone “Zone” near a unit of type “UnitType” of nation “Nat” in radius R (radius in pixels).




void SetLightSpot(GAMEOBJ* Zone,int R,byte index);


Open a map area in zone “Zone” in radius R (radius in standard units, equal to a review of units.) and assign to this area number “index”.




void ClearLightSpot(byte index);



Close the shined area number “index”.




int GetTopDst(GAMEOBJ* Z1,GAMEOBJ* Z2);



?




void AttackEnemyInZone(GAMEOBJ* Grp,GAMEOBJ* Zone,byte EnmNation);



Attack by group “Grp” of enemies of nation “EnmNation” in zone “Zone”. (Its necessary to give constantly this comand).




void StartAI(byte Nat,char* Name,int Land,int Money,int ResOnMap,int Difficulty);



Start AI for nation “NAT”. Name – name of AI in quotation marks, from file “TEXT\AI.txt”. Land – type of terrain LAND_AI, MEDITERR_AI, WATER_AI. Money – starting resources: START_NORMAL, START_RICH, START_MILLION. ResOnMap – the quantity of resources on a map: RES_POOR, RES_NORMAL, RES_RICH. Difficulty – complexity(difficulty): from 0 to 3.




void DoNotUseSelInAI(byte Nat);



Not allow to use allocated units AI of nation “NAT”.




void SetAIProperty(byte NAT,int Prop,int Val);



Establish property AI of nation “NAT” in value “VAL” (0 –switch off, 1 – switch on, all inclusive by default).



Properties of AI:



DEVELOPMENT – development



WATER_BATTLE – fleet



LAND_BATTLE – land forces



MINES_CAPTURE – capture of mines



TOWN_DEFENCE – protection of own base



MINES_UPGRADE – improvement of own mines



FAST_DIVERSION - cavalry attacks




int AskComplexQuestion(int Nx,char* Name1,byte or1,char* Name2,byte or2,char* Quest);



?





void SetTutorial(bool State);



?




bool GetQuestPressed();



?




void DisableUpgrade(byte Nat,GAMEOBJ* Upg);



Forbid upgrade “Upg” for nation “NAT”.




void EnableUnit(byte Nat,GAMEOBJ* Type,bool State);



Establish possibility of manufacture of unit of type “TYPE” for nation “NAT”. State 1 – allow, 0 – forbid.




int GetMyNation();



Returns number of nation, which player controls (basically for historical battles).



void SelErase(byte NI);
Zuletzt geändert von Lord Löwenherz am 15. März 2019 22:11, insgesamt 1-mal geändert.
Der echte Wüstenmod für Stronghold 2. Ich darf vorstellen: Stronghold 2 Crusader - https://www.moddb.com/mods/stronghold-2-the-crusades

Benutzeravatar
Lord Löwenherz
Optio ad spem
Optio ad spem
Beiträge: 669
Registriert: 11. März 2012 10:54
:
User des Monats Teilnahme an einem Contest Modder

Re: Cossacks/American Conquest Szenario Quellcode

Beitragvon Lord Löwenherz » 15. März 2019 22:11

Functions Part 4




//--------------------------NEW!!!-----------------------//

DLLIMPORT

int AskMultilineQuestion(int Nx,char* Name1,byte or1,char* Quest);

DLLIMPORT

void TakeFood(GAMEOBJ* Units);

DLLIMPORT

void TakeWood(GAMEOBJ* Units);

DLLIMPORT

void TakeStone(GAMEOBJ* Units);

DLLIMPORT

void RepairBuildingsBySel(byte Nat,GAMEOBJ* Buildings);

DLLIMPORT

bool CheckBuildingsComplete(GAMEOBJ* Buildings);

DLLIMPORT

int GetKilled(GAMEOBJ* Units);

DLLIMPORT

int GetUnitsByNation(GAMEOBJ* Units,byte Nat);

DLLIMPORT

void ProduceUnit(GAMEOBJ* Units,GAMEOBJ* UnitType,GAMEOBJ* DestGroup);

DLLIMPORT

bool CreateBuilding(byte Nat,GAMEOBJ* Zone,GAMEOBJ* UnitType,GAMEOBJ* DestGroup);

DLLIMPORT

void SetDestPoint(GAMEOBJ* Units,GAMEOBJ* Zone);

DLLIMPORT

void RegisterDynGroup(GAMEOBJ* Units);

DLLIMPORT

bool NationIsErased(byte Nat);

DLLIMPORT

int GetNUnits(GAMEOBJ* Units);

struct OneUnit{

word Index;

word Serial;

word Life; //rw

word MaxLife;

byte AddDamage; //rw

byte AddShield; //rw

word Stage;

word MaxStage;

word Kills;

word NIndex;

byte Usage;

byte Building;

int x,y; //rw

byte Reserved[16];

};

DLLIMPORT

bool GetUnitInfo(GAMEOBJ* Units,int Index,OneUnit* Uni);

DLLIMPORT

void SetUnitInfo(OneUnit* Uni);

DLLIMPORT

void RemoveGroup(GAMEOBJ* Source,GAMEOBJ* Dest);

/////////////////////////////////////////////////////////////

// //

// AAA IIII //

// AA AA II //

// AA AA II //

// AAAAAAA II //

// AA AA IIII //

// //

/////////////////////////////////////////////////////////////

DLLIMPORT

int GetAINation();

DLLIMPORT

bool TryUnit(GAMEOBJ* UnitType,int Max,byte CostPercent,byte Probability);

DLLIMPORT

bool TryUpgrade(GAMEOBJ* Upgrade,int CostPercent,int Probability);

DLLIMPORT

void SetMineBalanse(int N,word* Bal);

DLLIMPORT

void SetPDistribution(int OnFood,int OnWood,int OnStone);

DLLIMPORT

void AssignAmountOfMineUpgrades(int MU);

DLLIMPORT

bool AssignMineUpgrade(word U,char* Str,word val);

DLLIMPORT

void SET_MINE_CAPTURE_RADIUS(int x);

DLLIMPORT

void SET_MINE_UPGRADE1_RADIUS(int x);

DLLIMPORT

void SET_MINE_UPGRADE2_RADIUS(int x);

DLLIMPORT

void SET_DEFAULT_MAX_WORKERS(int x);

DLLIMPORT

void SET_MIN_PEASANT_BRIGADE(int x);

DLLIMPORT

int GetMoney(byte id);

DLLIMPORT

int GetUnits(GAMEOBJ* UnitType);

DLLIMPORT

int GetReadyUnits(GAMEOBJ* UnitType);

DLLIMPORT

bool UpgIsDone(GAMEOBJ* Upgrade);

DLLIMPORT

bool UpgIsRun(GAMEOBJ* Upgrade);

DLLIMPORT

void AssignMine(char* Name);

DLLIMPORT

void AssignPeasant(char* Name);

DLLIMPORT

void AssignHouse(char* Name);

DLLIMPORT

void AssignWall(char* Name);

DLLIMPORT

bool FieldExist();

DLLIMPORT

int GetDifficulty();

DLLIMPORT

int GetStartRes();

DLLIMPORT

int GetResOnMap();

DLLIMPORT

int GetLandType();

DLLIMPORT

void SetStandartVictory();

DLLIMPORT

void SetPlayerName(byte Nat,char* ID);

inline int GetTotalAmount(GAMEOBJ* Units){

return GetTotalAmount0(Units);

};

inline int GetTotalAmount(GAMEOBJ* UnitType,byte Nation){

return GetTotalAmount1(UnitType,Nation);

};

#define REG(x) RegisterVar(&##x,sizeof x)

#define WOOD 0

#define GOLD 1

#define STONE 2

#define FOOD 3

#define IRON 4

#define COAL 5



#define LAND_AI 0

#define MEDITERR_AI 1

#define WATER_AI 2



#define EASY 0

#define NORMAL 1

#define HARD 2

#define VERY_HARD 3



#define START_NORMAL 0

#define START_RICH 1

#define START_MILLION 2



#define RES_POOR 0

#define RES_NORMAL 1

#define RES_RICH 2



#define DEVELOPMENT 0x1001

#define WATER_BATTLE 0x1002

#define LAND_BATTLE 0x1003

#define MINES_CAPTURE 0x1004

#define TOWN_DEFENCE 0x1005

#define MINES_UPGRADE 0x1006

#define FAST_DIVERSION 0x1007

//----------------------------------------------//

BOOL APIENTRY DllMain( HANDLE hModule,

DWORD ul_reason_for_call,

LPVOID lpReserved

){

switch (ul_reason_for_call){

case DLL_PROCESS_ATTACH:{

OnInit();

break;

};

break;

};

return TRUE;
}
Der echte Wüstenmod für Stronghold 2. Ich darf vorstellen: Stronghold 2 Crusader - https://www.moddb.com/mods/stronghold-2-the-crusades

Benutzeravatar
Lord Löwenherz
Optio ad spem
Optio ad spem
Beiträge: 669
Registriert: 11. März 2012 10:54
:
User des Monats Teilnahme an einem Contest Modder

Re: Cossacks/American Conquest Szenario Quellcode

Beitragvon Lord Löwenherz » 15. März 2019 22:15

Wenn ihr Erfahrungen gesammelt habt, oder etwas herausgefunden habt, schreeeeeeiiiibts mir in die Kommentare. :strategie_zone_10:
Der echte Wüstenmod für Stronghold 2. Ich darf vorstellen: Stronghold 2 Crusader - https://www.moddb.com/mods/stronghold-2-the-crusades