Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Miscellaneous > Archive > Scenario League / Civ2-Creation -Archive > My C++ Events Generator
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!

bottom of page
  
Author
Thread    < Last Thread     Next Thread > Post New Thread     Post A Reply
St Leo is offline St Leo
King of Scenario League
Member of the Apolyton Social Democratic Party
Jul 2005
time: 00:15
Lightbulb  Old Post 22-08-2001 22:39 Visit St Leo<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
My C++ Events Generator Support Apolyton, buy Civilization III: Complete

Anzac asked for my C++ thingie, so here it is. It allows great dynamic event generation and compiles to virus-sized DOS executables.

P.S. I've only made the procedures that I needed.
P.P.S. Edit Post to see proper tabbing.




//Leons Petrazickis
//Roman Riots II Events Generator
//Uses St Leo's Civ++ Event Engine V1.0

#include
#include //Delete this

ofstream fout("events.txt"); //creates a variable of type ofstream

//Triggers
void citytaken(char city[255],
char attacker[255],
char defender[255]);
void negotiation(char talker[255],
char talkertype[255],
char listener[255],
char listenertype[255]);
void randomturn(int denominator);
void scenarioloaded();
void turn(int turn);
void unitkilled(char unit[255],
char attacker[255],
char defender[255]);

//Actions
void createunit(char owner[255],
char unit[255],
char veteran[255],
char homecity[255],
char loc[255]);
void justonce();
void noschism(char defender[255]);
void playwavefile(char filename[255]);
void text(char text[32000]);

//Keywords
void beginevents();
void endevents();
void IF();
void THEN();
void ENDIF();
void debug();

//Useful Variable
char civs[8][256] = {
"Roman Legion",
"Rebels",
"Invaders",
"English",
"Spaniards",
"French",
"Independents",
"Barbarians"};

void main(){
//Scenario-specific variables
char answer = ' '; //Answer to prompts
int x=0; //Index for loops
int number = 5;
int engfreq = 3;
int galfreq = 4;
int generalinterval = 15;
char assloc[] = "70,106";

cout << "Welcome to the Setup Program for Roman Riots 2:\n";
cout << "\t-Answer in lowercase and follow up with an [Enter]\n";
cout << "\t-Run it again whenever needed\n";
cout << "\t-If it summons aliens from Alpha Centauri, it is not my fault\n\n";

beginevents();
//debug();

IF();
noschism("ANYBODY");
THEN();
ENDIF();

IF();
negotiation("ANYBODY","HUMANORCOMPUTER","ANYBODY","HUMANORCOMPUTER");
THEN();
ENDIF();

IF();
randomturn(5);
THEN();
createunit("Rebels","Pachyderms","Yes","NONE","76,44");
ENDIF();
IF();
randomturn(5);
THEN();
createunit("Rebels","Dark Furies","Yes","NONE","76,44");
ENDIF();
IF();
randomturn(5);
THEN();
createunit("Rebels","Rebel Skirmisher","Yes","NONE","76,44");
ENDIF();
IF();
randomturn(10);
THEN();
createunit("Rebels","Scout","Yes","NONE","76,44");
ENDIF();
IF();
randomturn(5);
THEN();
createunit("Rebels","Rebel Skirmisher","Yes","NONE","29,15");
ENDIF();
IF();
randomturn(5);
THEN();
createunit("Rebels","Rebel Skirmisher","Yes","NONE","1,47");
ENDIF();
IF();
randomturn(15);
THEN();
createunit("Roman Legion","Praefect III","Yes","NONE","36,2");
text("^An expert defensive unit has arrived.");
ENDIF();


endevents();
fout.close();
}

void createunit(char owner[255],
char unit[255],
char veteran[255],
char homecity[255],
char loc[255]){
fout << "CreateUnit\n";
fout << "owner=" << owner << "\n";
fout << "unit=" << unit << "\n";
fout << "veteran=" << veteran << "\n";
fout << "homecity=" << homecity << "\n";
fout << "locations\n" << loc << "\nendlocations\n";
}

void unitkilled(char unit[255],
char attacker[255],
char defender[255]){
fout << "UnitKilled\n";
fout << "unit=" << unit << "\n";
fout << "attacker=" << attacker << "\n";
fout << "defender=" << defender << "\n";
}

void randomturn(int denominator){
fout << "RandomTurn\n";
fout << "denominator=" << denominator << "\n";
}

void turn(int turn){
fout << "Turn\n";
fout << "turn=" << turn << "\n";
}

void negotiation(char talker[255],
char talkertype[255],
char listener[255],
char listenertype[255]){
fout << "Negotiation\n";
fout << "talker=" << talker << "\n";
fout << "talkertype="<< talkertype << "\n";
fout << "listener="<< listener << "\n";
fout << "listenertype="<< listenertype << "\n";
}

void text(char text[32000]){
fout << "Text\n";
fout << text << "\n";
fout << "EndText\n";
}


void beginevents(){
fout << "@BEGINEVENTS\n";
}

void endevents(){
fout << "@ENDEVENTS\n";
}

void IF(){
fout << "@IF\n";
}

void THEN(){
fout << "@THEN\n";
}

void ENDIF(){
fout << "@ENDIF\n";
}

void justonce(){
fout << "JustOnce\n";
}

void noschism(char defender[255]){
fout << "NoSchism\n";
fout << "defender=" << defender << "\n";
}

void citytaken(char city[255],
char attacker[255],
char defender[255]){
fout << "CityTaken\n";
fout << "city=" << city << "\n";
fout << "attacker=" << attacker << "\n";
fout << "defender=" << defender << "\n";
}

void playwavefile(char filename[255]){
fout << "PlayWaveFile\n";
fout << filename << "\n";
}

void scenarioloaded(){
fout << "ScenarioLoaded\n";
}

void debug(){
fout << "@DEBUG\n";
}

Jimmywax is offline Jimmywax

Prince
in an undisclosed strip club
Apr 2001
time: 22:15
Question  Old Post 22-08-2001 23:33
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Huh ??? Tired of ads?

Okay, pretend for a second that I have no idea how to use C++ and all that events lingo confuses me to no end. Now pretend that you need to explain all this to me.

P.S. just remember that I said pretend, I know what you're talking about. I am just seeing if you know what you're about.

St Leo is offline St Leo
King of Scenario League
Member of the Apolyton Social Democratic Party
Jul 2005
time: 00:15
  Old Post 23-08-2001 01:59 Visit St Leo<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Support Apolyton, buy Alpha Centauri

This is basically just an interactive preprocessor for the CivII macro language. You can use C++ loops and other control structures and the syntax is much cleaner.

Jimmywax is offline Jimmywax

Prince
in an undisclosed strip club
Apr 2001
time: 22:15
Question  Old Post 23-08-2001 09:22
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Support Apolyton or Terrorists Win

Are you saying that I can copy this down and put it right in an events file and it will work?

Or do I have to make it into a batch file or something?

The ANZAC is offline The ANZAC
King
The Rodina!
Jan 2000
time: 00:15
Thumbs up  Old Post 23-08-2001 17:58 Visit The ANZAC's homepage!
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Support Apolyton, buy Alpha Centauri

Thanks St. Leo, though I somewhat understand it. But I think when I get Fictional Americas and see how it works in the field, I will be able to really implement it. Thanks

techumseh is offline techumseh
King
of the frozen North.
Apr 1999
time: 22:15
  Old Post 23-08-2001 20:00 Visit techumseh's homepage!
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Support Apolyton, buy Civilization III: Complete

Is this anything like Angelo Scottos' CPSL?

techumseh is offline techumseh
King
of the frozen North.
Apr 1999
time: 22:15
  Old Post 23-08-2001 20:00 Visit techumseh's homepage!
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Support Apolyton, buy Call to Power 2

Is this anything like Angelo Scottos' CPSL?

Shadowstrike is offline Shadowstrike
Emperor
The Glorious Land of Canada
Jul 2000
time: 00:15
  Old Post 23-08-2001 20:34
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Support Apolyton buy from Amazon

I think this simply randomizes event you get..... for example, I suppose you could set it so that say you could get extra money every 5, 10 or 20 years, depndig on a randomized factor.... *tries to remember more from puny collection of C++ knowledge*

St Leo is offline St Leo
King of Scenario League
Member of the Apolyton Social Democratic Party
Jul 2005
time: 00:15
Talking  Old Post 23-08-2001 20:54 Visit St Leo<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Got spare money?

Is this anything like Angelo Scottos' CPSL?

No, CSPL messes with Civ2's memory to create new events. This simply generates a custom events file. Note: I don't know how to run delevent.exe for a C++ file, so you might have to combine this with a batch file for mutli-event file scenarios.

I think this simply randomizes event you get..... for example, I suppose you could set it so that say you could get extra money every 5, 10 or 20 years, depndig on a randomized factor....

That certainly is possible, but in Fictional Americas and Imperial Ambition I used this to create a distinct file based on who's human and who's not, while in Roman Riots II I simply used it because I prefer C++ function syntax.

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:15.
Apolyton Time is 00:15.
    top of page
Rate This Thread:
archivepost
Forum Jump:
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0466 seconds (88.33% PHP - 11.67% MySQL) with 31 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net