add new world: horrid highway

install-platforms
Maikel de Vries 2017-07-06 10:18:27 +02:00
parent d458b0a25a
commit d34f0a689b
17 changed files with 970 additions and 0 deletions

View File

@ -0,0 +1,11 @@
Scheußliche Straße
Amidst the territory of the Skylanders there is an essential passage endangered by meteor strikes. The Skylanders have settlements on many of the sky islands and have roaring mining and industry. An essential part of their society is the train line that connects all main islands. In return for part of their wealth you must help to set up the last part of the tracks where protection from meteor showers is far from trivial.
Ziel: Construct and protect the locomotive highway.
Tipps:
- There are infinite sources of rock, coal, ore and water on the left and right island.
- You need a set up transport lines to get the necessary resources.
- Use the switch to signify that the train line is ready.
- To fulfill the goal 10 trains need to pass the line (protection for 5 minutes).

View File

@ -0,0 +1,11 @@
Horrid Highway
Amidst the territory of the Skylanders there is an essential passage endangered by meteor strikes. The Skylanders have settlements on many of the sky islands and have roaring mining and industry. An essential part of their society is the train line that connects all main islands. In return for part of their wealth you must help to set up the last part of the tracks where protection from meteor showers is far from trivial.
Goal: Construct and protect the locomotive highway.
Hints:
- There are infinite sources of rock, coal, ore and water on the left and right island.
- You need a set up transport lines to get the necessary resources.
- Use the switch to signify that the train line is ready.
- To fulfill the goal 10 trains need to pass the line (protection for 5 minutes).

View File

@ -0,0 +1,7 @@
[DefCore]
id=Goal_LocomotiveHighway
Version=8,0
Category=C4D_StaticBack|C4D_Goal
Width=64
Height=64
Offset=-32,-32

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -0,0 +1,169 @@
/**
Locomotive Highway
Construct and protect the locomotive highway.
@author Maikel
*/
#include Library_Goal
/*-- Control --*/
public func OpenDoor(object switch)
{
// Don't do anything here.
return;
}
public func CloseDoor(object switch)
{
if (!GetEffect("FxRunLocomotives", this) && !FindObject(Find_ID(Locomotive)))
CreateEffect(FxRunLocomotives, 100, 36, this);
switch->ControlSwitchDir(nil, -1);
return;
}
local FxRunLocomotives = new Effect
{
Construction = func(object goal)
{
this.goal = goal;
this.Interval = 36;
this.train_int = 15;
this.train_start = 1;
this.goal->SetPassed(0);
return FX_OK;
},
Timer = func(int time)
{
if (time > this.Interval * this.train_int * Target.LocomotiveGoal)
return FX_Execute_Kill;
// Launch a locomotive.
if ((time / this.Interval) % this.train_int == this.train_start)
{
var loco = CreateObjectAbove(Locomotive, 12, LandscapeHeight() / 2 - 3);
loco->SetEntrance(false);
loco.IsContainer = Goal_LocomotiveHighway.FxRunLocomotives.NoContainer;
loco.HasInteractionMenu = Goal_LocomotiveHighway.FxRunLocomotives.NoInteractions;
loco->SetDir(DIR_Right);
loco->CreateContents(Coal, 100);
loco.LiquidCapacity = 100000;
loco->PutLiquid(Water, 100000);
loco->ContainedRight();
loco->CreateEffect(Target.FxCheckLocomotive, 100, 2, this.goal);
}
return FX_OK;
},
NoContainer = func()
{
return false;
},
NoInteractions = func()
{
return false;
}
};
local FxCheckLocomotive = new Effect
{
Construction = func(object goal)
{
this.goal = goal;
// The allowed time means that no obstacles must be in the way.
// The train moves roughly at a pace of 1.3-1.4 pixels per frame.
this.time_allowed = 4 * LandscapeWidth() / 5;
this.Interval = 2;
return FX_OK;
},
Timer = func(int time)
{
if (Target->GetX() > LandscapeWidth() - 14)
{
Log("train passed after: %d", time);
if (time <= this.time_allowed)
this.goal->DoPassed(1);
Target->RemoveObject();
return FX_Execute_Kill;
}
return FX_OK;
}
};
/*-- Goal interface --*/
local nr_passed = 0;
public func SetPassed(int to_passed)
{
nr_passed = to_passed;
return;
}
public func GetPassed() { return nr_passed; }
public func DoPassed(int add_passed)
{
SetPassed(GetPassed() + add_passed);
return;
}
public func IsFulfilled()
{
return nr_passed >= this.LocomotiveGoal;
}
public func GetDescription(int plr)
{
var message;
if (IsFulfilled())
{
message = "$MsgGoalFulfilled$";
}
else
{
if (GetEffect("FxRunLocomotives", this) || FindObject(Find_ID(Locomotive)))
message = Format("$MsgGoalRunning$", GetPassed(), this.LocomotiveGoal);
else
message = "$MsgGoalUnfulfilled$";
}
return message;
}
// Shows or hides a message window with information.
public func Activate(int plr)
{
// If goal message open -> hide it.
if (GetEffect("GoalMessage", this))
{
CustomMessage("", nil, plr, nil, nil, nil, nil, nil, MSG_HCenter);
RemoveEffect("GoalMessage", this);
return;
}
// Otherwise open a new message.
AddEffect("GoalMessage", this, 100, 0, this);
var message;
if (IsFulfilled())
{
message = "@$MsgGoalFulfilled$";
}
else
{
if (GetEffect("FxRunLocomotives", this) || FindObject(Find_ID(Locomotive)))
message = Format("@$MsgGoalRunning$", GetPassed(), this.LocomotiveGoal);
else
message = "@$MsgGoalUnfulfilled$";
}
CustomMessage(message, nil, plr, 0, 16 + 64, 0xffffff, GUI_MenuDeco, this, MSG_HCenter);
return;
}
protected func FxGoalMessageStart() {}
/*-- Proplist --*/
local Name = "$Name$";
local LocomotiveGoal = 12;

View File

@ -0,0 +1,6 @@
Name=Eisenbahnstraße
# Goal window
MsgGoalFulfilled=Done! All the locomotives safely passed the highway!
MsgGoalUnfulfilled=Construct the highway out of bridges and protect it against all of the disasters, then you can turn the switch to let the locomotives pass the highway.
MsgGoalRunning=The locomotives are currently running, %d out of %d have passed the highway!

View File

@ -0,0 +1,6 @@
Name=Locomotive Highway
# Goal window
MsgGoalFulfilled=Done! All the locomotives safely passed the highway!
MsgGoalUnfulfilled=Construct the highway out of bridges and protect it against all of the disasters, then you can turn the switch to let the locomotives pass the highway.
MsgGoalRunning=The locomotives are currently running, %d out of %d have passed the highway!

View File

@ -0,0 +1,218 @@
/**
Horrid Highway
Dynamic map with two separated sky islands.
@author Maikel
*/
#include Library_Map
// Called be the engine: draw the complete map here.
protected func InitializeMap(proplist map)
{
// Set the map size.
map->Resize(240 + 40 * SCENPAR_MapSize, 120);
// At which height the highway will be constructed.
var highway_height = map.Hgt / 2;
// Draw left island.
map->DrawLeftIsland(map, highway_height);
// Draw right island.
map->DrawRightIsland(map, highway_height);
// Draw middle island.
map->DrawMiddleIsland(map, highway_height);
// Draw small islands.
map->DrawSmallIslands(map);
// Return true to tell the engine a map has been successfully created.
return true;
}
public func DrawLeftIsland(proplist map, int highway_height)
{
var width = 54;
var height = 64;
var island1 = {Algo = MAPALGO_Rect, X = 0, Y = map.Hgt / 2 - height / 2, Wdt = width - 10, Hgt = height};
var island2 = {Algo = MAPALGO_Rect, X = 0, Y = highway_height, Wdt = width - 2, Hgt = height / 2 + map.Hgt / 2 - highway_height};
var island = {Algo = MAPALGO_Or, Op = [island1, island2]};
island = {Algo = MAPALGO_Or, Op = [island, {Algo = MAPALGO_Turbulence, Amplitude = 16, Scale = 12, Iterations = 4, Seed = Random(65536), Op = island}]};
island = {Algo = MAPALGO_Or, Op = [island, {Algo = MAPALGO_Turbulence, Amplitude = 16, Scale = 12, Iterations = 4, Seed = Random(65536), Op = island}]};
Draw("Earth-earth", island);
DrawMaterial("Earth-earth_root", island, 2, 16);
DrawMaterial("Earth-earth_spongy", island, 2, 16);
DrawMaterial("Rock", island, 4, 10);
DrawMaterial("Ore", island, 4, 10);
DrawMaterial("Coal", island, 4, 10);
DrawMaterial("Firestone", island, 4, 10);
var border = {Algo = MAPALGO_Border, Right = 4, Bottom = 4, Op = island};
Draw("Granite-granite", border);
DrawMaterial("Rock-rock", border, 3, 20);
DrawMaterial("Rock-rock_smooth", border, 3, 20);
var top = {Algo = MAPALGO_Border, Top = 4, Op = island};
Draw("Earth-earth", top);
DrawMaterial("Earth-earth_root", top, 2, 16);
DrawMaterial("Earth-earth_spongy", top, 2, 16);
var passage = {Algo = MAPALGO_Rect, X = 0, Y = highway_height - 7, Wdt = 2 * width, Hgt = 7};
passage = {Algo = MAPALGO_And, Op = [passage, island]};
Draw("Tunnel-tunnel", passage);
DrawMaterial("Tunnel-brickback", passage, 3, 20);
var road = {Algo = MAPALGO_Rect, X = 0, Y = highway_height, Wdt = 2 * width, Hgt = 2};
road = {Algo = MAPALGO_And, Op = [road, island]};
Draw("Brick", road);
var cave_up = {Algo = MAPALGO_Rect, X = 0, Y = highway_height - 20, Wdt = 30, Hgt = 10};
cave_up = {Algo = MAPALGO_Or, Op = [cave_up, {Algo = MAPALGO_Turbulence, Amplitude = 12, Scale = 12, Iterations = 4, Seed = Random(65536), Op = cave_up}]};
cave_up = {Algo = MAPALGO_And, Op = [cave_up, {Algo = MAPALGO_Rect, X = 0, Y = 0, Wdt = map.Wdt, Hgt = highway_height - 10}]};
Draw("Tunnel-tunnel", cave_up);
DrawMaterial("Tunnel-brickback", cave_up, 3, 20);
var cave_up_road = {Algo = MAPALGO_And, Op = [cave_up, {Algo = MAPALGO_Rect, X = 0, Y = highway_height - 12, Wdt = map.Wdt, Hgt = 2}]};
Draw("Brick", cave_up_road);
var cave_up_mat = {Algo = MAPALGO_Rect, X = 0, Y = 0, Wdt = 2, Hgt = map.Hgt};
cave_up_mat = {Algo = MAPALGO_Or, Op = [cave_up_mat, {Algo = MAPALGO_Turbulence, Amplitude = 12, Scale = 12, Iterations = 4, Seed = Random(65536), Op = cave_up_mat}]};
cave_up_mat = {Algo = MAPALGO_And, Op = [cave_up, cave_up_mat]};
Draw("Coal:Coal", cave_up_mat);
var cave_down = {Algo = MAPALGO_Rect, X = 0, Y = highway_height + 5, Wdt = 30, Hgt = 10};
cave_down = {Algo = MAPALGO_Or, Op = [cave_down, {Algo = MAPALGO_Turbulence, Amplitude = 12, Scale = 12, Iterations = 4, Seed = Random(65536), Op = cave_down}]};
cave_down = {Algo = MAPALGO_And, Op = [cave_down, {Algo = MAPALGO_Rect, X = 0, Y = highway_height + 2, Wdt = map.Wdt, Hgt = 13}]};
Draw("Tunnel-tunnel", cave_down);
DrawMaterial("Tunnel-brickback", cave_down, 3, 20);
var cave_down_road = {Algo = MAPALGO_And, Op = [cave_down, {Algo = MAPALGO_Rect, X = 0, Y = highway_height + 13, Wdt = map.Wdt, Hgt = 2}]};
Draw("Brick", cave_down_road);
var cave_down_mat = {Algo = MAPALGO_Rect, X = 0, Y = 0, Wdt = 6, Hgt = map.Hgt};
cave_down_mat = {Algo = MAPALGO_Or, Op = [cave_down_mat, {Algo = MAPALGO_Turbulence, Amplitude = 12, Scale = 12, Iterations = 4, Seed = Random(65536), Op = cave_down_mat}]};
cave_down_mat = {Algo = MAPALGO_And, Op = [cave_down, cave_down_mat, {Algo = MAPALGO_Rect, X = 0, Y = highway_height + 10, Wdt = map.Wdt, Hgt = 20}]};
Draw("Water:Water", cave_down_mat);
var cave_down_mat_border = {Algo = MAPALGO_Border, Right = 1, Bottom = 1, Op = cave_down_mat};
Draw("Everrock", cave_down_mat_border);
return;
}
public func DrawRightIsland(proplist map, int highway_height)
{
var width = 54;
var height = 64;
var island1 = {Algo = MAPALGO_Rect, X = map.Wdt - width + 10, Y = map.Hgt / 2 - height / 2, Wdt = width - 10, Hgt = height};
var island2 = {Algo = MAPALGO_Rect, X = map.Wdt - width, Y = highway_height, Wdt = width - 2, Hgt = height / 2 + map.Hgt / 2 - highway_height};
var island = {Algo = MAPALGO_Or, Op = [island1, island2]};
island = {Algo = MAPALGO_Or, Op = [island, {Algo = MAPALGO_Turbulence, Amplitude = 16, Scale = 12, Iterations = 4, Seed = Random(65536), Op = island}]};
island = {Algo = MAPALGO_Or, Op = [island, {Algo = MAPALGO_Turbulence, Amplitude = 16, Scale = 12, Iterations = 4, Seed = Random(65536), Op = island}]};
Draw("Earth-earth", island);
DrawMaterial("Earth-earth_root", island, 2, 16);
DrawMaterial("Earth-earth_spongy", island, 2, 16);
DrawMaterial("Rock", island, 4, 10);
DrawMaterial("Ore", island, 4, 10);
DrawMaterial("Coal", island, 4, 10);
DrawMaterial("Firestone", island, 4, 10);
var border = {Algo = MAPALGO_Border, Left = 4, Bottom = 4, Op = island};
Draw("Granite-granite", border);
DrawMaterial("Rock-rock", border, 3, 20);
DrawMaterial("Rock-rock_smooth", border, 3, 20);
var top = {Algo = MAPALGO_Border, Top = 4, Op = island};
Draw("Earth-earth", top);
DrawMaterial("Earth-earth_root", top, 2, 16);
DrawMaterial("Earth-earth_spongy", top, 2, 16);
var passage = {Algo = MAPALGO_Rect, X = map.Wdt - 2 * width, Y = highway_height - 7, Wdt = 2 * width, Hgt = 7};
passage = {Algo = MAPALGO_And, Op = [passage, island]};
Draw("Tunnel-tunnel", passage);
DrawMaterial("Tunnel-brickback", passage, 3, 20);
var road = {Algo = MAPALGO_Rect, X = map.Wdt - 2 * width, Y = highway_height, Wdt = 2 * width, Hgt = 2};
road = {Algo = MAPALGO_And, Op = [road, island]};
Draw("Brick", road);
var cave_up = {Algo = MAPALGO_Rect, X = map.Wdt - 30, Y = highway_height - 20, Wdt = 30, Hgt = 10};
cave_up = {Algo = MAPALGO_Or, Op = [cave_up, {Algo = MAPALGO_Turbulence, Amplitude = 12, Scale = 12, Iterations = 4, Seed = Random(65536), Op = cave_up}]};
cave_up = {Algo = MAPALGO_And, Op = [cave_up, {Algo = MAPALGO_Rect, X = 0, Y = 0, Wdt = map.Wdt, Hgt = highway_height - 10}]};
Draw("Tunnel-tunnel", cave_up);
DrawMaterial("Tunnel-brickback", cave_up, 3, 20);
var cave_up_road = {Algo = MAPALGO_And, Op = [cave_up, {Algo = MAPALGO_Rect, X = 0, Y = highway_height - 12, Wdt = map.Wdt, Hgt = 2}]};
Draw("Brick", cave_up_road);
var cave_up_mat = {Algo = MAPALGO_Rect, X = map.Wdt - 2, Y = 0, Wdt = 2, Hgt = map.Hgt};
cave_up_mat = {Algo = MAPALGO_Or, Op = [cave_up_mat, {Algo = MAPALGO_Turbulence, Amplitude = 12, Scale = 12, Iterations = 4, Seed = Random(65536), Op = cave_up_mat}]};
cave_up_mat = {Algo = MAPALGO_And, Op = [cave_up, cave_up_mat]};
Draw("Ore:Ore", cave_up_mat);
var cave_down = {Algo = MAPALGO_Rect, X = map.Wdt - 30, Y = highway_height + 5, Wdt = 30, Hgt = 10};
cave_down = {Algo = MAPALGO_Or, Op = [cave_down, {Algo = MAPALGO_Turbulence, Amplitude = 12, Scale = 12, Iterations = 4, Seed = Random(65536), Op = cave_down}]};
cave_down = {Algo = MAPALGO_And, Op = [cave_down, {Algo = MAPALGO_Rect, X = 0, Y = highway_height + 2, Wdt = map.Wdt, Hgt = 13}]};
Draw("Tunnel-tunnel", cave_down);
DrawMaterial("Tunnel-brickback", cave_down, 3, 20);
var cave_down_road = {Algo = MAPALGO_And, Op = [cave_down, {Algo = MAPALGO_Rect, X = 0, Y = highway_height + 13, Wdt = map.Wdt, Hgt = 2}]};
Draw("Brick", cave_down_road);
var cave_down_mat = {Algo = MAPALGO_Rect, X = map.Wdt - 2, Y = 0, Wdt = 2, Hgt = map.Hgt};
cave_down_mat = {Algo = MAPALGO_Or, Op = [cave_down_mat, {Algo = MAPALGO_Turbulence, Amplitude = 12, Scale = 12, Iterations = 4, Seed = Random(65536), Op = cave_down_mat}]};
cave_down_mat = {Algo = MAPALGO_And, Op = [cave_down, cave_down_mat]};
Draw("Rock:Rock", cave_down_mat);
return;
}
public func DrawMiddleIsland(proplist map, int highway_height)
{
var width = 22;
var height = 72;
var island = {Algo = MAPALGO_Ellipsis, X = map.Wdt / 2, Y = map.Hgt / 2, Wdt = width / 2, Hgt = height / 2};
island = {Algo = MAPALGO_Turbulence, Amplitude = 12, Scale = 8, Iterations = 2, Seed = Random(65536), Op = island};
Draw("Everrock", island);
var passage = {Algo = MAPALGO_Rect, X = map.Wdt / 2 - 2 * width, Y = highway_height - 7, Wdt = 4 * width, Hgt = 7};
passage = {Algo = MAPALGO_And, Op = [passage, island]};
Draw("Tunnel", passage);
DrawMaterial("Tunnel-brickback", passage, 3, 20);
var road = {Algo = MAPALGO_Rect, X = map.Wdt / 2 - 2 * width, Y = highway_height, Wdt = 4 * width, Hgt = 2};
road = {Algo = MAPALGO_And, Op = [road, island]};
Draw("Brick", road);
var core = {Algo = MAPALGO_And, Op = [island, {Algo = MAPALGO_Not, Op = {Algo = MAPALGO_Or, Op = [passage, road]}}]};
var core_border = {Algo = MAPALGO_Border, Op = core, Left = 5, Right = 5, Top = 5};
core = {Algo = MAPALGO_And, Op = [core, {Algo = MAPALGO_Not, Op = core_border}]};
Draw("Gold", core);
var core_bottom = {Algo = MAPALGO_Rect, X = map.Wdt / 2 - 1, Y = map.Hgt / 2 + height / 2 - 12, Wdt = 2, Hgt = map.Hgt};
core_bottom = {Algo = MAPALGO_Or, Op = [core_bottom, {Algo = MAPALGO_Turbulence, Amplitude = 8, Scale = 8, Iterations = 2, Seed = Random(65536), Op = core_bottom}]};
core = {Algo = MAPALGO_And, Op = [island, core_bottom]};
Draw("Gold", core);
return;
}
public func DrawSmallIslands(proplist map)
{
var width = 10;
var height = 14;
var x1 = 4 * map.Wdt / 11 + RandomX(-3, 3);
var x2 = 7 * map.Wdt / 11 + RandomX(-3, 3);
var y = 10 * map.Hgt / 11;
var island1 = {Algo = MAPALGO_Ellipsis, X = x1, Y = y, Wdt = width / 2, Hgt = height};
var island2 = {Algo = MAPALGO_Ellipsis, X = x2, Y = y, Wdt = width / 2, Hgt = height};
island1 = {Algo = MAPALGO_And, Op = [island1, {Algo = MAPALGO_Rect, X = 0, Y = 0, Wdt = map.Wdt, Hgt = y}]};
island2 = {Algo = MAPALGO_And, Op = [island2, {Algo = MAPALGO_Rect, X = 0, Y = 0, Wdt = map.Wdt, Hgt = y}]};
island1 = {Algo = MAPALGO_Or, Op = [island1, {Algo = MAPALGO_Turbulence, Amplitude = 12, Scale = 10, Iterations = 3, Seed = Random(65536), Op = island1}]};
island2 = {Algo = MAPALGO_Or, Op = [island2, {Algo = MAPALGO_Turbulence, Amplitude = 12, Scale = 10, Iterations = 3, Seed = Random(65536), Op = island2}]};
var islands = {Algo = MAPALGO_Or, Op = [island1, island2]};
var islands_border = {Algo = MAPALGO_Border, Left = 3, Right = 3, Top = 3, Op = islands};
var no_border = {Algo = MAPALGO_Not, Op = {Algo = MAPALGO_Or, Op = [{Algo = MAPALGO_Rect, X = x1 - 1, Y = y - 3, Wdt = 3, Hgt = map.Hgt}, {Algo = MAPALGO_Rect, X = x2 - 1, Y = y - 3, Wdt = 3, Hgt = map.Hgt}]}};
islands_border = {Algo = MAPALGO_And, Op = [islands_border, no_border]};
Draw("Gold", islands);
Draw("Everrock", islands_border);
return;
}

View File

@ -0,0 +1,47 @@
[ParameterDef]
Name=$Difficulty$
Description=$DescDifficulty$
ID=Difficulty
Default=1
LeagueValue=3
[Options]
[Option]
Name=$DiffNormal$
Description=$DescDiffNormal$
Value=1
[Option]
Name=$DiffHard$
Description=$DescDiffHard$
Value=2
[Option]
Name=$DiffInsane$
Description=$DescDiffInsane$
Value=3
[ParameterDef]
Name=$MapSize$
Description=$DescMapSize$
ID=MapSize
Default=1
LeagueValue=1
[Options]
[Option]
Name=$MapSmall$
Description=$DescMapSmall$
Value=1
[Option]
Name=$MapAverage$
Description=$DescMapAverage$
Value=2
[Option]
Name=$MapLarge$
Description=$DescMapLarge$
Value=3

View File

@ -0,0 +1,33 @@
[Head]
Title=HorridHighway
Icon=37
Version=6,0
Difficulty=110
[Definitions]
Definition1=Objects.ocd
Definition2=Decoration.ocd
[Player1]
Crew=Clonk=2
[Player2]
Crew=Clonk=2
[Player3]
Crew=Clonk=2
[Player4]
Crew=Clonk=2
[Landscape]
Sky=Clouds1
TopOpen=1
BottomOpen=1
[Weather]
Climate=0
StartSeason=0
YearSpeed=0
Wind=0,100,-100,100

View File

@ -0,0 +1,300 @@
/**
Horrid Highway
Players need to completely excavate the sky island far away.
@author Maikel
*/
// Whether the intro has been initialized.
static intro_init;
protected func Initialize()
{
// Show wealth in HUD.
GUI_Controller->ShowWealth();
// Goal: locomotive highway.
var goal = CreateObject(Goal_LocomotiveHighway);
goal.LocomotiveGoal = 8 * SCENPAR_Difficulty;
// Rules: team account and buying at flagpole.
CreateObject(Rule_TeamAccount);
CreateObject(Rule_BuyAtFlagpole);
// Allow for base respawns.
var relaunch_rule = GetRelaunchRule();
relaunch_rule->SetInventoryTransfer(false);
relaunch_rule->SetLastClonkRespawn(true);
relaunch_rule->SetFreeCrew(false);
relaunch_rule->SetAllowPlayerRestart(true);
relaunch_rule->SetBaseRespawn(true);
relaunch_rule->SetRespawnDelay(0);
// Initialize different parts of the scenario.
InitEnvironment(SCENPAR_Difficulty);
InitVegetation();
InitAnimals(SCENPAR_Difficulty);
InitBridges();
InitLeftIsland();
InitMiddleIsland();
InitRightIsland();
InitDisasters(SCENPAR_Difficulty);
return;
}
protected func OnGoalsFulfilled()
{
// Give the remaining players their achievement.
GainScenarioAchievement("Done", BoundBy(SCENPAR_Difficulty, 1, 3));
return false;
}
/*-- Player Initialization --*/
protected func InitializePlayer(int plr)
{
// Zoom range.
SetPlayerZoomByViewRange(plr, 1200, nil, PLRZOOM_LimitMax);
SetPlayerZoomByViewRange(plr, 500, nil, PLRZOOM_Direct | PLRZOOM_Set);
SetPlayerViewLock(plr, true);
// Position and materials.
var i, crew;
for (i = 0; crew = GetCrew(plr, i); ++i)
{
crew->SetPosition(100, LandscapeHeight() / 2 - 10);
crew->CreateContents(Shovel);
}
// Give the player its knowledge.
GivePlayerBasicKnowledge(plr);
GivePlayerPumpingKnowledge(plr);
GivePlayerFarmingKnowledge(plr);
GivePlayerWeaponryKnowledge(plr);
GivePlayerArtilleryKnowledge(plr);
GivePlayerAdvancedKnowledge(plr);
GivePlayerAirKnowledge(plr);
// Give the player its base materials.
GivePlayerElementaryBaseMaterial(plr);
GivePlayerToolsBaseMaterial(plr);
GivePlayerSpecificBaseMaterial(plr, [[Dynamite, 20, 10]]);
// Claim ownership of structures, last player who joins owns all the flags.
for (var structure in FindObjects(Find_Or(Find_Category(C4D_Structure), Find_Func("IsFlagpole"))))
structure->SetOwner(plr);
// Ensure mimimum player wealth.
var add_wealth = Max(0, 75 - 25 * SCENPAR_Difficulty - GetWealth(plr));
DoWealth(plr, add_wealth);
// Initialize the intro sequence if not yet started.
if (!intro_init)
{
StartSequence("Intro", 0);
intro_init = true;
}
return;
}
/*-- Scenario Initialization --*/
// Initializes environment and disasters.
private func InitEnvironment(int difficulty)
{
// Init time and have normal cycle.
Time->Init();
// Set a certain parallax.
SetSkyParallax(0, 20, 20);
// Clouds and rain.
Cloud->Place(15);
Cloud->SetPrecipitation("Water", 60);
if (difficulty == 3)
Cloud->SetPrecipitation("Acid", 60);
return;
}
// Initializes grass, trees and in-earth objects.
private func InitVegetation()
{
// Grass on all islands.
Grass->Place(100);
// Vegetation around all islands.
Flower->Place(20);
Mushroom->Place(20);
Fern->Place(12);
Branch->Place(30);
Trunk->Place(8);
Vine->Place(18, nil, {attach_material = Loc_Or(Loc_Material("Granite"), Loc_Material("Rock"), Loc_Material("Everrock"), Loc_Material("Gold"))});
Cotton->Place(8);
Wheat->Place(8);
// Some objects in the earth.
PlaceObjects(Rock, 40, "Earth");
PlaceObjects(Firestone, 40, "Earth");
PlaceObjects(Loam, 30, "Earth");
// Place some trees.
Tree_Deciduous->Place(20, Rectangle(0, 0, 600, LandscapeHeight()));
Tree_Deciduous->Place(20, Rectangle(LandscapeWidth() - 600, 0, 600, LandscapeHeight()));
Tree_Coniferous2->Place(12, Rectangle(0, 0, 600, LandscapeHeight()));
Tree_Coniferous2->Place(12, Rectangle(LandscapeWidth() - 600, 0, 600, LandscapeHeight()));
return;
}
// Initializes animals.
private func InitAnimals(int difficulty)
{
// Some fireflies attracted to trees.
Firefly->Place(6);
// Place some bats depending on difficulties.
Bat->Place(10 * difficulty**2, Rectangle(LandscapeWidth() - 600, 0, 600, LandscapeHeight()), {tunnel_only = true});
// Place zaps on higher difficulties.
if (difficulty >= 2)
Zaphive->Place(2 * difficulty);
return;
}
private func InitBridges()
{
// Create four indestructible bridges to connect.
var height = LandscapeHeight() / 2 + 6;
var x4 = 4;
while (GetMaterial(x4, height) == Material("Brick"))
x4 += 8;
var x1 = x4;
while (GetMaterial(x4, height) != Material("Brick") || x4 < LandscapeWidth() / 4)
x4 += 8;
var x2 = x4;
while (GetMaterial(x4, height) == Material("Brick") || x4 < LandscapeWidth() / 2)
x4 += 8;
var x3 = x4;
while (GetMaterial(x4, height) != Material("Brick") || 3 * x4 < LandscapeWidth() / 4)
x4 += 8;
var bridge;
bridge = CreateObject(WoodenBridge, x1 + 20, height);
bridge->MakeInvincible();
bridge->SetClrModulation(RGB(80, 120, 200));
bridge = CreateObject(WoodenBridge, x2 - 20, height);
bridge->MakeInvincible();
bridge->SetClrModulation(RGB(80, 120, 200));
bridge = CreateObject(WoodenBridge, x3 + 20, height);
bridge->MakeInvincible();
bridge->SetClrModulation(RGB(80, 120, 200));
bridge = CreateObject(WoodenBridge, x4 - 20, height);
bridge->MakeInvincible();
bridge->SetClrModulation(RGB(80, 120, 200));
return;
}
private func InitLeftIsland()
{
var switch = CreateObjectAbove(Switch, 20, LandscapeHeight() / 2);
var goal = FindObject(Find_ID(Goal_LocomotiveHighway));
switch->SetTarget(goal);
switch->SetSwitchDir(-1);
var guidepost = CreateObjectAbove(EnvPack_Guidepost2, 40, LandscapeHeight() / 2);
guidepost->SetInscription("$MsgHorridHighwayEast$");
var lorry = CreateObjectAbove(Lorry, 80, LandscapeHeight() / 2 - 2);
lorry->CreateContents(Shovel, 2);
lorry->CreateContents(Hammer, 2);
lorry->CreateContents(Axe, 2);
lorry->CreateContents(Barrel, 2);
var elevator = CreateObjectAbove(Elevator, 180, 384);
elevator->CreateShaft(196);
CreateObjectAbove(Compensator, 230, 384);
var workshop = CreateObjectAbove(ToolsWorkshop, 156, 480);
workshop->CreateContents(Wood, 8);
workshop->CreateContents(Metal, 8);
var chemical_lab = CreateObjectAbove(ChemicalLab, 160, 584);
chemical_lab->CreateContents(Firestone, 8);
chemical_lab->CreateContents(Coal, 8);
CreateObjectAbove(Flagpole, 120, 584);
var bridge = FindObject(Find_ID(WoodenBridge), Sort_Distance(0, LandscapeHeight() / 2));
bridge->CreateObjectAbove(WindGenerator, 0, -4);
bridge->CreateObjectAbove(Flagpole, -36, -4);
bridge->CreateObjectAbove(Catapult, 6, -6);
return;
}
private func InitMiddleIsland()
{
var lorry = CreateObjectAbove(Lorry, LandscapeWidth() / 2 + RandomX(-20, 20), LandscapeHeight() / 2 - 2);
lorry->CreateContents(Firestone, 12);
lorry->CreateContents(Dynamite, 12);
lorry->CreateContents(DynamiteBox, 8);
lorry->CreateContents(PowderKeg, 8);
lorry->CreateContents(Pickaxe, 2);
return;
}
private func InitRightIsland()
{
var guidepost = CreateObjectAbove(EnvPack_Guidepost2, LandscapeWidth() - 40, LandscapeHeight() / 2);
guidepost->SetInscription("$MsgHorridHighwayWest$");
var elevator = CreateObjectAbove(Elevator, LandscapeWidth() - 180, 384);
elevator->CreateShaft(196);
var foundry = CreateObjectAbove(Foundry, LandscapeWidth() - 100, 384);
foundry->CreateContents(Coal, 8);
CreateObjectAbove(WoodenCabin, LandscapeWidth() - 100, 480);
return;
}
private func InitDisasters(int difficulty)
{
// Lightning: clouds are already inited.
Cloud->SetLightning(3 * difficulty**2 + difficulty + 2);
// Rockfall: appears around the central sky island.
if (difficulty >= 2)
{
Rockfall->SetChance(10 * (difficulty - 1));
Rockfall->SetArea(Rectangle(LandscapeWidth() / 2 - 200, 0, 400, 20));
if (difficulty >= 3)
Rockfall->SetExplosiveness(true);
}
// Meteors: controlled by effect to happen between the main islands.
var meteor_chance = 15 * difficulty;
if (difficulty == 3)
meteor_chance = 60;
CreateEffect(FxControlMeteors, 100, 1, meteor_chance);
return;
}
static const FxControlMeteors = new Effect
{
Construction = func(int chance)
{
this.chance = chance;
this.Interval = 10;
// Find spawn range according to outer bridges.
var bridge_left = FindObject(Find_ID(WoodenBridge), Sort_Distance(0, LandscapeHeight() / 2));
var bridge_right = FindObject(Find_ID(WoodenBridge), Sort_Distance(LandscapeWidth(), LandscapeHeight() / 2));
this.spawn_range = [bridge_left->GetX() + 132, bridge_right->GetX() - 132];
return FX_OK;
},
Timer = func(int time)
{
if (Random(100) >= 100 - this.chance)
{
var x = RandomX(this.spawn_range[0], this.spawn_range[1]);
LaunchMeteor(x, 0, RandomX(40, 60), RandomX(-15, 15), RandomX(40, 50));
}
return FX_OK;
}
};

View File

@ -0,0 +1,23 @@
# Scenario parameters: difficulty
Difficulty=Schwierigkeit
DescDifficulty=Setzt die Schwierigkeit dieser Runde.
DiffNormal=Normal
DescDiffNormal=Die Schwierigkeit dieser Runde ist normal.
DiffHard=Schwer
DescDiffHard=Die Schwierigkeit dieser Runde ist schwer.
DiffInsane=Irrsinnig
DescDiffInsane=Die Schwierigkeit dieser Runde ist irrsinnig.
# Scenario parameters: map size
MapSize=Kartengröße
DescMapSize=Setzt die Kartengröße dieser Runde.
MapSmall=Klein
DescMapSmall=Die Karte dieser Runde wird klein sein
MapAverage=Durchschnittlich
DescMapAverage=Die Karte dieser Runde wird durchschnittlich sein.
MapLarge=Groß
DescMapLarge=Die Karte dieser Runde wird groß sein.
# Scenario
MsgHorridHighwayEast=Scheußliche Straße im Osten.
MsgHorridHighwayWest=Scheußliche Straße im Westen.

View File

@ -0,0 +1,23 @@
# Scenario parameters: difficulty
Difficulty=Difficulty
DescDifficulty=Sets this round's difficulty.
DiffNormal=Normal
DescDiffNormal=This round's difficulty will be set to normal.
DiffHard=Hard
DescDiffHard=This round's difficulty will be set to hard.
DiffInsane=Insane
DescDiffInsane=This round's difficulty will be set to insane.
# Scenario parameters: map size
MapSize=Map size
DescMapSize=Sets this round's map size.
MapSmall=Small
DescMapSmall=This round's map will be small.
MapAverage=Average
DescMapAverage=This round's map will be average.
MapLarge=Large
DescMapLarge=This round's map will be large.
# Scenario
MsgHorridHighwayEast=Horrid Highway to the east.
MsgHorridHighwayWest=Horrid Highway to the west.

View File

@ -0,0 +1,104 @@
// Intro sequence for Horrid Highway.
#appendto Sequence
public func Intro_Init()
{
this.bridge_left = FindObject(Find_ID(WoodenBridge), Sort_Distance(0, LandscapeHeight() / 2));
var start_x = this.bridge_left->GetX() - 130;
this.locomotive = CreateObjectAbove(Locomotive, start_x, LandscapeHeight() / 2 - 3);
this.locomotive->SetDir(DIR_Right);
this.locomotive->CreateContents(Coal, 100);
this.locomotive.LiquidCapacity = 100000;
this.locomotive->PutLiquid(Water, 100000);
this.npc = CreateObjectAbove(Clonk, start_x, LandscapeHeight() / 2 - 3);
this.npc->SetName("Kummerog");
this.npc->Enter(this.locomotive);
this.npc->SetAlternativeSkin("Carpenter");
this.locomotive->ContainedRight(this.npc);
return true;
}
public func Intro_Start()
{
return ScheduleNext(4);
}
public func Intro_JoinPlayer(int plr)
{
SetPlayerZoomByViewRange(plr, 300, nil, PLRZOOM_Set | PLRZOOM_Direct);
var crew, index = 0;
while (crew = GetCrew(plr, index++))
crew->Enter(this.locomotive);
return;
}
public func Intro_1()
{
for (var i = 0; i < GetPlayerCount(C4PT_User); ++i)
{
var plr = GetPlayerByIndex(i, C4PT_User);
MessageBox(Format("$MsgWelcomeHorridHighway$", GetCrew(plr, 0)->GetName()), GetCrew(plr, 0), this.npc, plr, true);
}
return ScheduleNext(3 * 36);
}
public func Intro_2()
{
this.locomotive->ContainedDown(this.npc);
LaunchMeteor(this.bridge_left->GetX() + 132, 0, RandomX(40, 60), -15, RandomX(40, 50));
return ScheduleNext(1 * 36);
}
public func Intro_3()
{
for (var i = 0; i < GetPlayerCount(C4PT_User); ++i)
{
var plr = GetPlayerByIndex(i, C4PT_User);
MessageBox("$MsgHighwayBroken$", GetCrew(plr, 0), this.npc, plr, true);
}
return ScheduleNext(5 * 36);
}
public func Intro_4()
{
this.locomotive->ContainedLeft(this.npc);
for (var i = 0; i < GetPlayerCount(C4PT_User); ++i)
{
var plr = GetPlayerByIndex(i, C4PT_User);
var crew, index = 0;
while (crew = GetCrew(plr, index++))
crew->Exit();
}
return ScheduleNext(1 * 36);
}
public func Intro_5()
{
for (var i = 0; i < GetPlayerCount(C4PT_User); ++i)
{
var plr = GetPlayerByIndex(i, C4PT_User);
MessageBox("$MsgFixHighway$", GetCrew(plr, 0), this.npc, plr, true);
}
return ScheduleNext(6 * 36);
}
public func Intro_6()
{
for (var i = 0; i < GetPlayerCount(C4PT_User); ++i)
{
var plr = GetPlayerByIndex(i, C4PT_User);
MessageBox("$MsgRunLocomotives$", GetCrew(plr, 0), this.npc, plr, true);
}
return Stop();
}
public func Intro_Stop()
{
// Reset player zoom.
SetPlayerZoomByViewRange(NO_OWNER, 500, nil, PLRZOOM_Set | PLRZOOM_Direct);
// Remove objects.
this.npc->RemoveObject();
this.locomotive->RemoveObject();
return true;
}

View File

@ -0,0 +1,5 @@
# Intro sequence messages
MsgWelcomeHorridHighway=Hi %s, welcome to the horrid highway.
MsgHighwayBroken=Oh no! The highway is broken again, these damn meteors.
MsgFixHighway=I am leaving you here, fix the highway for our locomotives then we can give you plenty resources.
MsgRunLocomotives=You can let me know with the lever if you are ready, then I will send over some locomotives.

View File

@ -0,0 +1,5 @@
# Intro sequence messages
MsgWelcomeHorridHighway=Hi %s, welcome to the horrid highway.
MsgHighwayBroken=Oh no! The highway is broken again, these damn meteors.
MsgFixHighway=I am leaving you here, fix the highway for our locomotives then we can give you plenty resources.
MsgRunLocomotives=You can let me know with the lever if you are ready, then I will send over some locomotives.

View File

@ -0,0 +1,2 @@
DE:Scheußliche Straße
US:Horrid Highway