Krakatoa: new goal and intro sequence

issue1247
Maikel de Vries 2014-10-24 21:57:05 +02:00
parent 3e48809c20
commit e715fd4e70
16 changed files with 324 additions and 73 deletions

View File

@ -2,7 +2,7 @@
Icon=36
Title=AcidRift
Version=5,4,0,0
Difficulty=50
Difficulty=60
[Definitions]
Definition1=Objects.ocd

View File

@ -41,8 +41,6 @@ protected func OnGoalsFulfilled()
return false;
}
public func UpdatePicture() { Log("bla"); }
/*-- Player Initialization --*/

View File

@ -37,15 +37,15 @@ Difficulty: Medium (40)
Duration: 60 - 90 minutes
Description: Players have to transport a cannon up a chine carved out by a waterfall.
[Acid Rift]
Difficulty: Medium (50)
Duration: 60 - 100 minutes
Description: A rift is slowly filled by acid rain, gems need to be mined from an acid lake.
[Conquest of Krakatoa]
Difficulty: Medium (50)
Duration: 60 - 120 minutes
Description: A large volcano needs to be conquered and gold needs to be extracted from its core.
[Acid Rift]
Difficulty: Medium (60)
Duration: 60 - 100 minutes
Description: A large volcano needs to be conquered and gold needs to be extracted from its core.
Description: A rift is slowly filled by acid rain, gems need to be mined from an acid lake.
[Gem Grabbers]
Difficulty: Hard (80)

View File

@ -1,8 +1,6 @@
/**
Krakatoa
A Volcano with lot's of small islands and chasms.
TODO: Scaling with mapsize.
Krakatoa's Krach
A Volcano with one main chasm and a few side chasms.
@author Maikel
*/

View File

@ -2,10 +2,11 @@
Icon=23
Title=Krakatoa
Version=5,4,0,0
Difficulty=60
Difficulty=50
[Definitions]
Definition1=Objects.ocd
Definition2=Decoration.ocd\Misc.ocd\AltMaterials.ocd
[Player1]
Crew=Clonk=2

View File

@ -1,23 +1,29 @@
/**
Krakatoa
Players are challenged to build up a settlement on top of an active volcano.
The goal is to expand your reign by building flags to cover the landscape.
Also you need to gather some gold to show your skills of entering a volcano.
Krakatoa's Krach
Players are challenged to build up a settlement on top of an active volcano
after their airplane crashed. They need to gather gold from the core of the
volcano to show your skills of entering a volcano. The gold bars need to be
transported out by a newly constructed airplane.
@author Maikel
*/
static volcano_location;
static plr_init;
// Whether the intro has been initialized.
static intro_init;
protected func Initialize()
{
// Create expansion and wealth goal.
var goal = CreateObject(Goal_Wealth);
goal->SetWealthGoal(100 + 100 * SCENPAR_Difficulty);
goal = CreateObject(Goal_Expansion);
goal->SetExpansionGoal(200 + 50 * SCENPAR_Difficulty);
// Goal: construct an airplane and fill it with gold bars.
var goal = CreateObject(Goal_Script);
// Add an effect to check whether the goal is fulfilled.
var effect = AddEffect("GoalCheck", nil, 100, 2, nil);
effect.goal = goal;
effect.barcnt = 8 * SCENPAR_Difficulty;
// Set goal name and description.
goal.Name = "$GoalName$";
goal.Description = Format("$GoalDesc$", effect.barcnt);
// Some rules.
CreateObject(Rule_TeamAccount);
@ -43,16 +49,10 @@ protected func Initialize()
protected func InitializePlayer(int plr)
{
// Move all crew to start position.
var index = 0, crew;
while (crew = GetCrew(plr, index++))
crew->SetPosition(volcano_location[0] + RandomX(-5, 5), volcano_location[1]);
// Give only the first joined player some wealth.
if (!plr_init)
{
SetWealth(plr, 50);
plr_init = true;
}
// Set zoom range.
SetPlayerZoomByViewRange(plr, 500, nil, PLRZOOM_Direct | PLRZOOM_LimitMax);
SetPlayerViewLock(plr, true);
// Give the player its knowledge and base materials.
GivePlayerBasicKnowledge(plr);
GivePlayerPumpingKnowledge(plr);
@ -64,7 +64,7 @@ protected func InitializePlayer(int plr)
GivePlayerElementaryBaseMaterial(plr);
// Give crew some equipment.
var index = 0;
var index = 0, crew;
while (crew = GetCrew(plr, index++))
{
if (index == 1)
@ -73,38 +73,34 @@ protected func InitializePlayer(int plr)
crew->CreateContents(Axe);
crew->CreateContents(Shovel);
}
// Harsh zoom range.
SetPlayerZoomByViewRange(plr, 5000, nil, PLRZOOM_Direct | PLRZOOM_LimitMax);
SetPlayerViewLock(plr, true);
// Initialize the intro sequence if not yet started.
if (!intro_init)
{
StartSequence("Intro", 0, SCENPAR_Difficulty);
intro_init = true;
// Give only the first joined player some wealth.
SetWealth(plr, 75 - 25 * SCENPAR_Difficulty);
}
return;
}
// Returns a suitable location to start the conquest.
private func FindVolcanoLocation()
/*-- Goal Check --*/
global func FxGoalCheckTimer(object target, proplist effect)
{
// Default to the middle of the map.
var wdt = LandscapeWidth();
var hgt = LandscapeHeight();
volcano_location = [wdt / 2, hgt / 2];
var x, y, cnt = 1000;
for (var i = cnt; i > 0; i--)
// Complete goal if there is an airplane with the required amount of gold bars.
for (var plane in FindObjects(Find_ID(Plane), Find_Not(Find_Func("IsBroken"))))
{
// Random x coordinate, biased to the middle of the map.
var var_wdt = wdt * (300 - 200 * i / cnt) / 400;
var x = wdt / 2 + RandomX(-var_wdt, var_wdt);
var y = 0;
// Find corresponding y coordinate.
while (!GBackSolid(x, y) && y < 9 * hgt / 10)
y += 2;
// Check if surface is relatively flat (check for flatter surfaces first).
var d = i / 150 + 1;
if (!GBackSolid(x+d, y-4) && !GBackSolid(x-d, y-4) && GBackSolid(x+d, y+4) && GBackSolid(x-d, y+4))
if (plane->ContentsCount(GoldBar) >= effect.barcnt)
{
volcano_location = [x, y - 10];
break;
if (effect.goal)
effect.goal->Fulfill();
return -1;
}
}
return;
return 1;
}
@ -182,17 +178,6 @@ private func InitAnimals()
private func InitMaterial(int amount)
{
// Find start location and place lorry plus extras there.
FindVolcanoLocation();
var lorry = CreateObject(Lorry);
lorry->SetPosition(volcano_location[0], volcano_location[1]);
lorry->CreateContents(Loam, 5);
lorry->CreateContents(Bread, 5);
lorry->CreateContents(Wood, 8);
lorry->CreateContents(Rock, 4);
lorry->CreateContents(Metal, 4);
for (var i = 0; i < 5; i++)
lorry->CreateContents(Barrel)->PutLiquid("Water", 300);
return;
}

View File

@ -1,3 +1,7 @@
# Goal name and description
GoalName=Gold Transport
GoalDesc=Construct an airplane and load it with %d gold bars to transport them to a safe location.
# Scenario parameters: difficulty
Difficulty=Schwierigkeit
DescDifficulty=Setzt die Schwierigkeit dieser Runde.

View File

@ -1,3 +1,7 @@
# Goal name and description
GoalName=Gold Transport
GoalDesc=Construct an airplane and load it with %d gold bars to transport them to a safe location.
# Scenario parameters: difficulty
Difficulty=Difficulty
DescDifficulty=Sets this round's difficulty.

View File

@ -0,0 +1,41 @@
// The airplane acts as a container for gold bars and starting material.
#appendto Plane
public func IsContainer() { return true; }
private func MaxContentsCount()
{
return 25;
}
protected func RejectCollect(id object_id, object obj)
{
// Objects can collected if gold bar and not above max contents count.
if (ContentsCount() < MaxContentsCount() && object_id == GoldBar)
return false;
return true;
}
// The plane may be broken, which prevents entering it.
local broken;
public func MakeBroken()
{
broken = true;
SetEntrance(false);
return;
}
public func IsBroken()
{
return broken;
}
public func ActivateEntrance(object clonk)
{
if (IsBroken())
return;
return _inherited(clonk, ...);
}

View File

@ -0,0 +1,192 @@
// Intro sequence for Krakatoa: Players crash with an airplane on the slope of the volcano.
#appendto Sequence
public func Intro_Init(int difficulty)
{
// Set wind to the left, so that less lava is on the starting place.
SetWind(-50 - Random(50));
// Determine crater lava height.
var lava_y = 0;
while (!GBackLiquid(LandscapeWidth() / 2, lava_y) && lava_y < LandscapeHeight())
lava_y++;
// Create an airplane with pilot and fly it towards the peak.
this.airplane = CreateObject(Plane, LandscapeWidth() / 2 - 564, lava_y - 176);
this.pilot = CreateObject(Clonk, LandscapeWidth() / 2 - 564, lava_y - 176);
this.pilot->SetName("$PilotName$");
this.pilot->SetSkin(2);
this.pilot->Enter(this.airplane);
this.pilot->SetAction("Walk");
this.pilot->SetDir(DIR_Right);
this.pilot->SetColor(0xff0000aa);
this.airplane->FaceRight();
this.airplane->StartInstantFlight(90, 15);
this.airplane->SetXDir(12);
this.airplane->SetYDir(-1);
this.airplane->MakeInvincible();
this.airplane.intro_seq = this;
// Fill the airplane with some materials.
this.difficulty = difficulty;
if (difficulty <= 2)
{
this.airplane->CreateContents(Loam, 5);
this.airplane->CreateContents(Bread, 5);
this.airplane->CreateContents(Wood, 8);
this.airplane->CreateContents(Rock, 4);
this.airplane->CreateContents(Metal, 4);
if (difficulty <= 1)
{
this.airplane->CreateContents(Pickaxe, 2);
for (var i = 0; i < 5; i++)
this.airplane->CreateContents(Barrel)->PutLiquid("Water", 300);
}
}
return;
}
public func Intro_Start()
{
return ScheduleNext(4);
}
public func Intro_JoinPlayer(int plr)
{
// Move player's crew into the plane.
var j = 0, crew;
while (crew = GetCrew(plr, j++))
{
crew->Enter(this.airplane);
crew->SetAction("Walk");
}
// Increase zoom.
SetPlayerZoomByViewRange(plr, 700, nil, PLRZOOM_Set | PLRZOOM_LimitMax);
SetViewTarget(this.pilot);
return;
}
public func Intro_1()
{
// Prepare players for drop.
MessageBoxAll("$MsgNearVolcano$", this.pilot, true);
return ScheduleNext(108);
}
public func Intro_2()
{
// Determine crater lava height.
var lava_y = 0;
while (!GBackLiquid(LandscapeWidth() / 2, lava_y) && lava_y < LandscapeHeight())
lava_y++;
// Launch a big eruption from this location.
AddEffect("BigEruption", nil, 100, 1, nil, nil, LandscapeWidth() / 2, lava_y - 2);
return ScheduleNext(12);
}
public func Intro_3()
{
// Message about volcano eruption.
MessageBoxAll("$MsgEruption$", this.pilot, true);
return ScheduleNext(23);
}
public func Intro_4()
{
// Determine crater lava height.
var lava_y = 0;
while (!GBackLiquid(LandscapeWidth() / 2, lava_y) && lava_y < LandscapeHeight())
lava_y++;
// Launch the killing chunk.
this.chunk = CreateObject(LavaChunk, LandscapeWidth() / 2, lava_y);
this.chunk->SetSpeed(36, -100);
return ScheduleNext(28);
}
public func Intro_5()
{
// Explide lava chunk at plane location.
this.chunk->Explode(36);
// Destroy and fling the plane.
this.airplane->SetMeshMaterial("CrashedAirplane");
this.airplane->MakeBroken();
this.airplane->CancelFlight();
RemoveEffect("IntPlane", this.airplane);
this.airplane->SetRDir(10);
this.airplane->SetSpeed(46, -56);
// Forward plane hit call to sequence.
this.plane_hitcall = this.airplane.Hit;
this.airplane.Hit = this.Intro_PlaneHit;
// Eject message.
MessageBoxAll("$MsgEject$", this.pilot, true);
SetViewTarget(this.airplane);
return ScheduleNext(24);
}
public func Intro_6()
{
// Let pilot get away in boompack.
this.pilot->Exit();
var boompack = this.pilot->CreateObject(Boompack);
boompack->SetFuel(1000);
boompack->SetDirectionDeviation(8);
boompack->SetControllable(false);
boompack->Launch(40, this.pilot);
ScheduleCall(boompack, "RemoveObject", 100);
ScheduleCall(this.pilot, "RemoveObject", 100);
// Rest of intro will be triggered on plane hit.
return true;
}
public func Intro_PlaneHit()
{
// Plane hit ground! Continue sequence.
Sound("PlaneCrash", true);
var particles = Particles_Smoke(true);
particles.Size = PV_Linear(PV_Random(20, 60), PV_Random(50, 100));
CreateParticle("Smoke", PV_Random(-30,30), PV_Random(-30,30), PV_Random(-60, 60), PV_Random(-20,0), PV_Random(200, 500), particles, 20);
particles.Size = PV_Linear(PV_Random(50, 80), PV_Random(100, 200));
CreateParticle("Smoke", PV_Random(-30,30), PV_Random(-30,30), PV_Random(-20, 20), PV_Random(-20,0), PV_Random(100, 200), particles, 20);
for (var i = 0; i < GetPlayerCount(C4PT_User); ++i)
{
var plr = GetPlayerByIndex(i, C4PT_User);
var icrew = 0, crew;
while (crew = GetCrew(plr, icrew++))
{
crew->Exit(0,-5, 0, 1 + Random(2), Random(3) - 5);
crew->SetAction("Tumble");
crew->ClearInvincible();
crew->DoEnergy(-this.intro_seq.difficulty * RandomX(5, 8));
crew->MakeInvincible();
}
}
// Stop plane movement and rotate for crash effect.
SetXDir(0);
this.Hit = this.intro_seq.plane_hit;
this.MeshTransformation=Trans_Mul(Trans_Rotate(10,0,2,1), Plane.MeshTransformation);
this.intro_seq->ScheduleNext(50);
return true;
}
public func Intro_7()
{
// Message from first clonk to other crew members.
for (var i = 0; i < GetPlayerCount(C4PT_User); ++i)
{
var plr = GetPlayerByIndex(i, C4PT_User);
MessageBox("$MsgConstructPlane$", GetCrew(plr, 0), GetCrew(plr, 0), plr, true);
}
return ScheduleNext(12);
}
public func Intro_8()
{
return Stop();
}
public func Intro_Stop()
{
// Reset player zoom.
SetPlayerZoomByViewRange(NO_OWNER, 500, nil, PLRZOOM_Set | PLRZOOM_LimitMax);
return true;
}

View File

@ -0,0 +1,8 @@
# Pilot Name
PilotName=Kapit<69>n Wilbur
# Intro sequence messages
MsgNearVolcano=We are almost at the volcano's crater, did you know its core is made out of gold?
MsgEruption=Oh no! The volcano erupts, prepare for emergency landing.
MsgEject=We have been hit ... eject! eject!
MsgConstructPlane=Seems our pilot is gone and the plane is broken. Let's construct a new plane, fill it with gold bars and get out of here.

View File

@ -0,0 +1,8 @@
# Pilot Name
PilotName=Captain Wilbur
# Intro sequence messages
MsgNearVolcano=We are almost at the volcano's crater, did you know its core is made out of gold?
MsgEruption=Oh no! The volcano erupts, prepare for emergency landing.
MsgEject=We have been hit ... eject! eject!
MsgConstructPlane=Seems our pilot is gone and the plane is broken. Let's construct a new plane, fill it with gold bars and get out of here.

View File

@ -0,0 +1,12 @@
// The wall kit produces rock walls, because granite is indestructible.
#appendto WallKit
private func CreateBridge(object clonk, int x, int y)
{
var c = Offset2BridgeCoords(clonk, x, y);
x=clonk->GetX(); y=clonk->GetY();
DrawMaterialQuad("Rock-rock", x+c.x1-c.dx,y+c.y1-c.dy, x+c.x1+c.dx,y+c.y1+c.dy, x+c.x2+c.dx,y+c.y2+c.dy, x+c.x2-c.dx,y+c.y2-c.dy, DMQ_Bridge);
clonk->Sound("WallKitLock");
return true;
}

View File

@ -1,2 +1,2 @@
DE:Bezwingung des Krakataus
US:Conquest of Krakatoa
DE:Krakatau's Krach
US:Krakatoa's Krach