 |
|  |
 |
|  |
 |
|
MarkG
|
|
Grand Lord of Apolyton, Owner of all this land as far as the eye can see
|
|
i hope bhg doesnt mind 
here is the 1st tutorial script
code:
/******************************************/
/*************RISE OF NATIONS**************/
/***************TUTORIAL ONE***************/
/**************Big Huge Games**************/
/********Scripted by: Joshua Mitnick*******/
/*******Storyboarded by: Doug Kaufman******/
/***************July 25, 2002**************/
/******************************************/
/ **************************************************
*****
Scenario 1 - Boudicea vs. the Romans
Map: A Briton village, bounded by mountains and forests.
A Roman camp (obs tower and maybe a barracks) nearby.
Setup: Several combat units on both sides. The Britons
outnumber the Romans. The Britons have a scout, multiple
slingers, and a few each of bowmen and hoplites. A
Boudicea unit is in the lower left.
**************************************************
******/
include "scripts.bhh"
scenario {
// nations
labels {
HUMAN = 1,
COMPUTER = 2,
}
labels {
FLAG_X = 27,
FLAG_Y = 50,
FLAG2_X = 25,
FLAG2_Y = 33,
BONUS_LEGIONS_X = 35,
BONUS_LEGIONS_Y = 28,
ARMY_CREATE_X = 35,
ARMY_CREATE_Y = 28,
ATTACK_TO_X = 37,
ATTACK_TO_Y = 30,
}
static boudicea_id = 19; // HACK!! find_unit(HUMAN, "BOUDICEAN");
static briton_id = find_city_id("Briton");
static Briton_X = object_position_x (HUMAN, briton_id);
static Briton_Y = object_position_y (HUMAN, briton_id);
static Legions_create_X = Briton_X;
static Legions_create_Y = Briton_Y;
static barracks_id = find_build(COMPUTER, "barracks");
static R_Barracks_X = object_position_x (COMPUTER, barracks_id);
static R_Barracks_Y = object_position_y (COMPUTER, barracks_id);
static lookout_id = find_build( COMPUTER, "lookout" );
static lookout_x = object_position_x( COMPUTER, lookout_id );
static lookout_y = object_position_y( COMPUTER, lookout_id );
static tower_destroyed = false;
static barracks_destroyed = false;
static army_destroyed = false;
static objective_delay = 60;
run_once {
bubble_text_hide();
set_explored(HUMAN, ( (R_Barracks_X + lookout_x ) / 2) , ( ( R_Barracks_Y + lookout_y ) / 2 ), 10);
disable_all_triggers();
set_unique_unit( "BOUDICEAN", "Boudicea" );
set_object_type_max_health( "barracks", 250 );
set_object_type_max_health( "lookout", 125 );
disable_type("Citizen");
set_music_volume(50);
enable_trigger("Global");
enable_trigger("Start");
set_timer("progress_check",objective_delay );
}
trigger Objective_Reminder( timer_expired("progress_check") && sound_finished() ) {
clear_all_arrows();
draw_screen_arrow_line(200, 0, 200, 90, 10 );
play_sound("objective.wav");
if(objective_delay < 300) {
objective_delay = objective_delay * 2;
} else {
objective_delay = 300;
}
set_timer("progress_check", objective_delay);
enable_trigger("Objective_Reminder");
}
trigger Start () {
//WAV: We must remove the Romans from the lands of Briton. Lead Boudecia back to the city
// where we will muster our troops to drive the Romans out.
play_sound ("boudicea.wav");
enable_trigger("Select_a_unit");
enable_trigger("Select_Boudicea");
enable_trigger("Objective_Reminder");
set_timer("progress_check",objective_delay);
}
trigger Select_a_unit( sound_finished() ) {
//WAV: "You must select a unit before you can give it orders. Move the mouse over Boudicea and left click to 'select' her."
add_objective("Left click on Boudicea.", "Select_boudicea", "select_boudicea.wav");
play_objective_sound("Select_boudicea");
enable_trigger ("Select_Boudicea");
enable_trigger ("Ping_Boudicea");
set_timer("progress_check",objective_delay);
}
trigger Select_Boudicea( object_selected(HUMAN, boudicea_id ) ) {
disable_trigger ("Ping_Boudicea");
disable_trigger("Select_a_unit");
objective_complete("Select_boudicea");
// WAV: "Well done. You can be sure you have the right unit by looking at the name of
// the unit you've selected in the lower right panel. Now you can give Boudicea orders."
play_sound("boudicea_selected.wav");
// draw arrow to unit display info
unit_display_left = get_button_left("right_window");
unit_display_top = get_button_top("right_window");
draw_screen_arrow_line( unit_display_left - 100, unit_display_top - 100, unit_display_left, unit_display_top, 0 );
enable_trigger ("Move_a_unit");
enable_trigger ("Deselect_Boudicea");
set_timer("progress_check",objective_delay);
}
trigger Deselect_Boudicea( !object_selected(HUMAN, boudicea_id )) {
play_sound ("lostboud.wav");
//WAV: Left-clicking on the map will clear all selections. To regain control of Boudicea, left click on her, then
// right click where you want her to go.***/
set_timer("progress_check",objective_delay);
}
trigger Ping_Boudicea( sound_finished () && !object_selected(HUMAN, boudicea_id ) ) {
ping_object (1, 1, 1, boudicea_id);
set_timer("progress_check",objective_delay);
}
trigger Move_a_unit( sound_finished () && object_selected(HUMAN, boudicea_id ) ) {
clear_all_arrows();
add_objective("Select Boudicea and right click on the flag.", "Move_boudicea", "move_boudicea.wav");
play_objective_sound("Move_boudicea");
//WAV: "To move a unit, select it and then right-click on the map where you want it to go.
// With Boudicea selected, move her toward the flag in the upper right.
add_flag (FLAG_X, FLAG_Y);
enable_trigger("Flag");
enable_trigger("reveal_flag");
set_timer("progress_check",objective_delay);
}
trigger reveal_flag(sound_finished() ) {
set_explored( HUMAN, FLAG_X, FLAG_Y, 5 );
}
trigger Flag(object_near (HUMAN, boudicea_id, FLAG_X, FLAG_Y, 2)) {
disable_trigger("reveal_flag");
objective_complete("Move_boudicea");
clear_flags ();
play_sound ("at_flag.wav");
// WAV: "Very good. Now we'll guide your boudicea back to the village and rally the troops."
disable_trigger("Deselect_boudicea");
enable_trigger ("Learn_scroll");
set_timer("progress_check",objective_delay);
}
trigger Learn_scroll (sound_finished ()) {
// WAV: Briton is off the screen to the upper right. To see off the screen, move the mouse cursor to the edge of the screen and a little beyond.
// This is called scrolling. Scroll to find Briton in the upper right now.
add_objective("Locate Briton by scrolling to the upper right.", "Find_briton", "learnscroll.wav");
draw_screen_arrow_line (get_screen_width() - 100, 100, get_screen_width(), 0, 10 );
play_objective_sound("Find_briton");
set_timer("progress_check",objective_delay);
enable_trigger("camera_over_village");
}
trigger camera_over_village( is_on_screen (object_position_x(HUMAN, BRITON_ID)-1, object_position_y(HUMAN, BRITON_ID)-1)){
clear_all_arrows();
objective_complete("Find_briton");
// wav: Very good. You found the city of Briton. Now, right click to move boudicea to the flag outside the village.
add_objective("Right click to move your unit to the flag.", "Move_to_briton", "move_b_village.wav");
add_flag (FLAG2_X, FLAG2_Y);
enable_trigger("Deselect_boudicea");
play_objective_sound("Move_to_briton");
enable_trigger("Knows_moving");
}
trigger Knows_moving (object_near_build (HUMAN, boudicea_id, HUMAN, BRITON_ID, 8)) {
objective_complete("Move_to_briton");
clear_flags();
play_sound ("boudicearejoins.wav");
//WAV: "Good work! You've successfully guided Boudica back to Briton so we can start rallying our troops. But before we attack, we must first we must find our hated foe."
disable_all_triggers ();
disable_trigger("Deselect_boudicea");
enable_trigger ("Global");
enable_trigger ("Learn_zoom");
enable_trigger ("Objective_Reminder");
set_timer("progress_check",objective_delay);
}
trigger Learn_zoom (sound_finished ()) {
scrolling_lock ();
/***WAV: "To see more of the map and have a better chance of locating the Romans,"
"zoom out by rolling the mousewheel backward (or pressing the Page Up key twice)."***/
add_objective("Roll the mousewheel back or press PageUp twice to zoom out.", "zoom_out", "learnzoom.wav");
play_objective_sound("zoom_out");
enable_trigger ("Zoom_out");
set_timer("progress_check",objective_delay);
}
trigger Zoom_out (is_zoomed_out ()) {
scrolling_unlock ();
objective_complete("zoom_out");
add_objective("Locate the Roman camp by scrolling the map to the bottom right.", "find_camp", "zoomlearned.wav");
play_objective_sound("find_camp");
//WAV: Well done. Now that you know how to zoom out, it will be easier
//to locate the Roman camp. Scroll to the bottom right until you find it.
draw_screen_arrow_line (get_screen_width() - 100, get_screen_height() - 100, get_screen_width(), get_screen_height(), 10 );
enable_trigger ("Find_camp");
}
trigger Find_camp (is_on_screen (R_Barracks_X+10, R_Barracks_Y+10)) {
clear_all_arrows();
//ping_object (1, 1, 2, barracks_id);
mid_x = ( R_Barracks_X + lookout_x ) / 2;
mid_y = ( R_Barracks_Y + lookout_y ) / 2;
ping(1, 1, mid_x, mid_y );
add_flag( mid_x, mid_y );
objective_complete("find_camp");
play_sound ("foundcamp.wav");
//WAV: "Excellent, you've found the Roman camp. Now let's take a"
//"closer look at their defenses."
enable_trigger ("Mouseover");
set_timer("progress_check",objective_delay);
}
trigger Mouseover (sound_finished ()) {
clear_flags();
ping_object (1, 1, 2, barracks_id);
//WAV: Moving the mouse over anything in the game will show you the help text in the lower
// left corner. Move your mouse over the Roman Barracks.
add_objective("Move your mouse over the Roman barracks", "over_barracks", "mouseover.wav" );
play_objective_sound("over_barracks");
enable_trigger("Over_tower");
enable_trigger("Over_barracks");
set_timer("progress_check",objective_delay);
}
trigger Over_tower( sound_finished() && get_object_type_at_mouse (COMPUTER, "Lookout") ) {
play_sound("over_tower.wav");
//WAV: You have highlighted the roman tower. The barracks are just below it and to the right.
set_timer("progress_check",objective_delay);
}
trigger Over_barracks( sound_finished() && get_object_type_at_mouse (COMPUTER, "Barracks") ) {
objective_complete("over_barracks");
disable_trigger("Over_tower");
play_sound ("overbarracks.wav");
/***WAV: "Notice the help text in the lower left--it says this building is used to produce troops.
We'd better destroy it quickly! Let's get our units organized and attack!"***/
enable_trigger("scouting_complete");
}
trigger scouting_complete( sound_finished() ) {
play_sound("knowrposition.wav");
//WAV: Excellent! Now you know a lot about the Roman position. Let's get our units organized, and attack.
enable_trigger("Attack_the_Romans");
set_timer("progress_check", objective_delay);
}
trigger Attack_the_Romans (sound_finished ()) {
center_camera_on (HUMAN, find_military (HUMAN));
add_objective("Select all troops with a drag box.", "all_troops", "multiselect2.wav");
play_objective_sound("all_troops");
/***WAV: "You can select your whole army at once with a drag box."
"Hold the mouse near your units, left-click, then drag the mouse
"to create a box around all your troops."***/
enable_trigger ("All_troops");
enable_trigger ("Not_all_troops");
set_timer("progress_check",objective_delay);
}
trigger Not_all_troops ( (num_unit_selected (HUMAN) > 1) && (num_unit_selected (HUMAN) < num_military_units (HUMAN) )) {
play_sound ("notall.wav");
/***WAV: You selected some, but not all, of your troops. Try again, and make a bigger box.***/
set_timer("progress_check",objective_delay);
}
trigger All_troops (all_military_selected (HUMAN)) {
disable_trigger ("Not_all_troops");
objective_complete("all_troops");
add_objective("Right-click to move your troops into the Roman camp.","destroy_camp", "alltroops.wav");
play_objective_sound("destroy_camp");
mid_x = ( R_Barracks_X + lookout_x ) / 2;
mid_y = ( R_Barracks_Y + lookout_y ) / 2;
ping(1, 1, mid_x, mid_y );
add_flag( mid_x, mid_y );
/***WAV: "Good work. You successfully selected all of your troops. Now send"
"your troops toward the Roman position. If they stop close to an enemy building"
"or unit, they'll attack automatically. Destroy the Roman camp. We'll teach them"
"to march into our town!"***/
enable_trigger ("Deselect_army");
set_timer("deselect_timer", 1 );
enable_trigger("Destroy_camp");
set_timer("progress_check",objective_delay);
}
trigger Global (have_fought (HUMAN, COMPUTER)) {
clear_flags ();
clear_all_arrows ();
scrolling_unlock ();
create_unit(COMPUTER, R_Barracks_X - 4, R_Barracks_Y, "Legions", 2);
if (is_trigger_enabled ("Destroy_camp")) {
play_sound ("attackbegun.wav");
//WAV: "The attack is begun! To attack specific targets, select the attacking
//unit and right click on an enemy. If you want a better view of the action,
// you can zoom in by rolling the mouse wheel forward or pressing the page down key multiple times.
enable_trigger ("See_health");
enable_trigger ("Deselect_army");
} else {
play_sound ("earlyattack.wav");
/***WAV: Good work General. Apparently you don't need any help in order to conquer the Romans. Good luck!***/
clear_objectives();
disable_all_triggers ();
enable_trigger ("Destroy_camp");
}
objective_complete("destroy_camp");
add_objective("Destroy Roman army", "destroy_army", "alltroops.wav" );
add_objective("Destroy Roman barracks", "destroy_barracks", "alltroops.wav");
add_objective("Destroy Roman lookout", "destroy_lookout", "alltroops.wav");
enable_trigger ("Destroy_tower");
enable_trigger ("Destroy_barracks");
enable_trigger ("Destroy_army");
set_timer("progress_check",objective_delay);
}
trigger Deselect_army (sound_finished () && (num_unit_selected (HUMAN) == 0 ) && timer_expired("deselect_timer") ) {
play_sound ("lostarmy.wav");
/***WAV: You have troops that are not selected who are not attacking. Select them with a left click or
drag box and get them in the fight!***/
enable_trigger("Deselect_army");
set_timer("deselect_timer", 10);
}
trigger See_health (sound_finished ()) {
play_sound ("damage.wav");
/***WAV: As the fight progresses, you can see units and buildings taking damage. Each selected unit and building has a green
bar above it when it's at full strength. As they are hit by the enemy, this bar shrinks and becomes yellow and then
red. When the health bar is all gone, the unit or building is destroyed.***/
set_timer("progress_check",objective_delay);
}
trigger Destroy_tower (building_type_destroyed (COMPUTER, "Lookout")) {
tower_destroyed = true;
objective_complete("destroy_lookout");
}
trigger Destroy_barracks (building_type_destroyed (COMPUTER, "Barracks")) {
barracks_destroyed = true;
objective_complete("destroy_barracks");
}
trigger Destroy_army( num_military_units(COMPUTER) < 1 ) {
army_destroyed = true;
objective_complete("destroy_army");
}
trigger Destroy_camp (tower_destroyed && barracks_destroyed && army_destroyed) {
disable_all_triggers ();
play_sound ("congrats.wav");
/***WAV: Congratulations! You've leveled the Roman camp. But it won't be long before"
"they'll be back in strength. We'd best be ready.***/
enable_trigger ("Bonus");
disable_trigger("Objective_Reminder");
}
// ==================================================
========
//Putting it all together===================================
trigger Bonus (sound_finished ()) {
set_timer ("Help", 4);
Legions = create_unit (COMPUTER, BONUS_LEGIONS_X, BONUS_LEGIONS_Y, "Legions", 1);
unit_attack_order(COMPUTER, Legions, HUMAN, BRITON_ID);
zoom_in_on(HUMAN, BRITON_ID);
enable_trigger ("Help_out");
enable_trigger ("The_end");
}
trigger Help_out (timer_expired ("Help")) {
/***WAV: The vile Romans have launched a sneak attack against Briton! We must come to her aid.***/
center_camera_on(HUMAN, find_military(HUMAN) );
add_objective("Briton is under attack! Right-click to move your troops to defend the city!", "sneak_attack", "sneakattack.wav");
play_objective_sound("sneak_attack");
enable_trigger ("Reinforce");
enable_trigger("Deselect_army");
}
trigger Reinforce (num_military_units (HUMAN) < 1) {
create_unit (HUMAN, ARMY_CREATE_X, ARMY_CREATE_Y, "Hoplites", 7);
for (i = 0; i < num_military_units (HUMAN); i++) {
ID = find_military (HUMAN);
unit_attack_to_order (HUMAN, ID, ATTACK_TO_X, ATTACK_TO_Y);
}
}
trigger The_end (num_military_units (COMPUTER) < 1) {
objective_complete("sneak_attack");
play_sound ("victory.wav");
/***WAV: Congratulations! You have fended off the evil Romans***/
enable_trigger("The_real_end");
}
trigger The_real_end( sound_finished() ) {
victory( HUMAN );
}
// ==================================================
========
}
|
|
|  |
 |
|  |
 |
|
Vushum
|
|
Will the language be simplified so the people who can't read it can?
|
|
|  |
 |
|
tniem
|
|
Hope College
Apr 2000 time: 00:23
|
|
Wow! Allowing full scripting language for scenarios is incredibly powerful and fantastic for the game and the community.
Does anyone know the following questions:
Is there going to be a scenario editor that is easier than a scripting language?
Can we edit AI strategies with the scripting language?
|
|
|  |
 |
|
Peter Triggs
|
|
Gone Fishin, Canada
Jan 2000 time: 05:23
|
|
Yes, Tim Train confirmed that there will be the standard sort of scenario editor.
I think, but am not sure about this, that there may be some sort of intermediate scripting editor which will simplify writing triggers.
|
|
|  |
 |
|
Peter Triggs
|
|
Gone Fishin, Canada
Jan 2000 time: 05:23
|
|
What do you mean "the old way"? What game are you talking about? (Civ2?) If not, could you give an example of a trigger?
|
|
|  |
 |
|
Vushum
|
|
I thinkk maybe AoK or SWGB, that sort of thing, just with more options. All we would like to know BHG- Will it be simplified or will have to wait for a patch or for fellow players to make one?
|
|
|  |
 |
|
Peter Triggs
|
|
Gone Fishin, Canada
Jan 2000 time: 05:23
|
|
Obsidian has just posted a very lengthy account of the recent Fanstock event at BHG's headquarters:
http://ron.heavengames.com/press/ev...tock/day1.shtml
Herer's the part that's relevent to this thread:
quote:
Scenario Editor
Now for the part all you scenario designers have been waiting for, the Scenario Editor. One of the first things you do when you start the editor is select your map size. This gives you a large square area to work with as the starting template for the map. On this square you can draw a rough outline of your map. This keeps you from having to draw the entire map out tile by tile when you are starting your work. Scott began by drawing out a rough version of the boot shape for the Italian peninsula. With a simple click, the entire map was generated to reflect what he had drawn. After the map was created, the process of adding things like mountains, forests, cities and units to the scenario involved simply selecting what you wanted and clicking on where it should go.
[Scott Lewis, the Scenarios and tools programmer] created the city of Rome and gave it some citizens as well as a few Praetorian Guards for defense. We then went to the north and created a small city for the barbarians that we would be using to attack the city of Rome. It was here that Scott showed us the scripting engine that the game uses for its Scenarios. I’ll start by saying that when I saw what this thing was capable of, my jaw dropped.[My emph] The scripting language in and of itself was structured very similar to C++ or javascript. There are of course some proprietary commands that are specific to the game, but the syntax is very similar so anyone familiar with those languages should feel right at home. Scott wrote a small script that would cause the enemy city to the north to select an idle set of troops every few seconds and send them down to attack the city of Rome.
This is the part where the game really impressed me. You could set actual breakpoints in your scripts to verify that the script was executing as designed. “Why did that guy go over there? That’s not what I wanted him to do” Just set the break point in the script and you can start seeing where things went wrong. They have also included the ability to reference other scripts in your current script. So if I wrote an AI script that improved on the way the computer organized forces for attacks, all you would need to do is provide the path to the location of my script and you would have all the functionality available to you. About the only thing that is missing from the editor at this point is an immediate window where you can check the values of variables on the fly and intellesense. For those unfamiliar with intellisense, it is a nifty little feature where the editing screen gives you information about the command you are typing. It really helps in keeping all those function calls straight and free of errors. When I mentioned this to Scott he said that it was actually something they were considering adding.
|
It just keeps getting better, eh.
|
|
|  |
 |
|  |
 |
|
Peter Triggs
|
|
Gone Fishin, Canada
Jan 2000 time: 05:23
|
|
This isn't really about scripting, but is more info on RoN's modifiability. Rohag posted on the WebQuad forums:
http://www.webquad.com/forums/index...=ST&f=23&t=1285
quote:
One of the reasons I became interested in RoN is that the game’s developer, Big Huge Games of Baltimore, Maryland USA, seems to be relatively open to discussing the ideas behind the game and the design process.
I gather that in the process of design and coding developers have a number of in-game “tools” they use to modify, tweak and debug progressive builds of a game. Sometime last summer (?) the BHG design team decided to leave some of these tools in RoN for fans to use after release. Yes, there will be an editor, but these “sandbox” features (I’m using the term Brian Reynolds used) can be accessed directly from game setup.
You can set up a single-player “game” with all the players “human” – you can control everyone with or without a supporting national-level AI (unit-level AI remains). All you need do is click on a unit or building and you take control of that nation; you can repeatedly switch among allies and enemies. I took advantage of this in the Preview Beta to set up the Nuke Effects screens: I chose two human-controlled nations in the Modern Age without national-level AI support, developed one to attack and one to be attacked, advanced the target nation to the Information Age, took the "before" shot and saved the game, switched control to the attacker, sent over the Modern Age nuke, took the screenshot, reloaded the saved game, advanced the attacker to Information and developed ICBMs, attacked again and took the third screenshot.
After RoN is released I’m interested in using the editor and these sandbox features to set up some historical battles, with me controlling both sides. While paused I’ll give orders to both sides and then watch the action, trying out all sorts of maneuvers and what-ifs.
I would imagine if you’re really in for a single-player challenge, you could set up a game with several nations with national-level AI support for all. You could jump from nation to nation either helping the victors or the underdogs, perhaps your self-imposed goal being to keep every nation in the game until the Information age.
Well, these are pre-publication musings. I hope BHG retains all the sandbox features they now have. It was always fun in my days of cardboard counters and map gaming to play solitaire and set plan against plan.
|
The more tools, the better.
BTW: What, no arrays !
|
|
|  |
 |
|
Immortal Wombat
|
 |
in perpetuity
Dec 2000 time: 05:23
|
|
If you do maths, just imagine a matrix...
Bascially, arrays are variables that can store more than one value. Pretty much like a table. For example, in SLIC, the CtP/2 scripting language, you can have (one-dimensional) arrays that act like a row of a table, storing numbers for example.
In other languages they can store other variable types, strings, integers, etc.
One-D array with size 3:
defined as Array[3]
It was hoped that RoN scripting would allow multi-dimensional scripting, so that each array index (position in the array) would act as a row in itself, or in other words form a proper "table"
2D array with size 3,3
defined as: Array[3][3]
So a string array defined:
array NewArray[];
NewArray[0] = "Hello "
NewArray[1] = "Tassandar"
NewArray[2] = "5000"
print(NewArray[0] + NewArray[1] + NewArray[2])
would give "Hello Tassandar5000"
But of course their use is far more flexible, because it allows you to access the indices within 'for' loops and such, so it has a distinct advantage over just using many variables, not to mention the lines/time spent defining and remembering what each variable would otherwise be.
eg.
for(i=0; i < 3; i ++){
print(NewArray[i])
}
would again bring out "Hello Tassandar5000"
Last edited by Immortal Wombat on 01-04-2003 at 03:11
|
|
|  |
All times are GMT. The time now is 05:23. Apolyton Time is 00:23. |
top of page
|
|
|
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
|
|
|
|
|
|