2014-08-20 16:02:17 +00:00
|
|
|
/**
|
|
|
|
Raid
|
|
|
|
Intro mission
|
|
|
|
|
|
|
|
@authors Sven2
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Set in Objects.c
|
2017-01-03 15:38:47 +00:00
|
|
|
//static g_chemical, g_cabin, g_sawmill, g_workshop, g_flagpole, g_windmill, npc_newton, npc_lara, npc_lisa, npc_woody, npc_rocky, npc_mave, npc_pyrit, npc_clonko, npc_matthi, npc_dora;
|
2014-08-20 16:02:17 +00:00
|
|
|
|
|
|
|
// Created after intro
|
|
|
|
static g_goal;
|
|
|
|
|
|
|
|
// Story progress
|
|
|
|
static g_is_initialized, // intro started
|
|
|
|
g_attack_started, // enemy planes arriving
|
|
|
|
g_attack_done, // Clunker village got destroyed
|
|
|
|
g_challenge_accepted, // accepted to kill the king
|
|
|
|
g_pyrit_spoken, // spoke with Pyrit
|
|
|
|
g_plane_built, // built the airplane
|
|
|
|
g_mave_oil_spoken, // got the key offer from Mave
|
|
|
|
g_got_maves_key, // got the key from Mave
|
|
|
|
g_dora_spoken, // got rumour about oil lake from Clonko
|
2015-08-10 03:26:56 +00:00
|
|
|
g_clonko_spoken, // got rumour about oil lake from Dora
|
|
|
|
g_oil_delivered; // oil delivered, all done!
|
2014-08-20 16:02:17 +00:00
|
|
|
|
|
|
|
func Initialize()
|
|
|
|
{
|
2017-04-30 14:13:57 +00:00
|
|
|
var relaunch_rule = GetRelaunchRule();
|
|
|
|
relaunch_rule->SetInventoryTransfer(true);
|
|
|
|
relaunch_rule->SetFreeCrew(true);
|
|
|
|
relaunch_rule->SetRespawnDelay(1);
|
|
|
|
relaunch_rule->SetBaseRespawn(true);
|
2017-05-01 09:00:51 +00:00
|
|
|
relaunch_rule->SetDefaultRelaunchCount(nil);
|
|
|
|
relaunch_rule->SetAllowPlayerRestart(true);
|
2017-04-30 14:13:57 +00:00
|
|
|
relaunch_rule->SetLastClonkRespawn(true);
|
2017-05-01 09:46:34 +00:00
|
|
|
relaunch_rule->SetInitialRelaunch(false);
|
2016-01-09 14:55:45 +00:00
|
|
|
npc_newton->SetAlternativeSkin("MaleBlackHair");
|
|
|
|
npc_pyrit->SetAlternativeSkin("MaleBrownHair");
|
|
|
|
npc_woody->SetAlternativeSkin("Youngster");
|
2018-01-22 05:36:44 +00:00
|
|
|
g_guidepost1->SetInscription("$Post1$");
|
|
|
|
g_guidepost2->SetInscription("$Post2$");
|
2014-08-20 16:02:17 +00:00
|
|
|
MakeRuinsOnDamage(); // see System.ocg/Ruins.c
|
2014-08-21 13:27:58 +00:00
|
|
|
PlaceGrass(40);
|
2014-08-26 14:06:53 +00:00
|
|
|
return true;
|
2014-08-20 16:02:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func DoInit(int first_player)
|
|
|
|
{
|
|
|
|
StartSequence("Intro", 0, GetCrew(first_player));
|
2015-01-10 16:56:54 +00:00
|
|
|
//g_goal = CreateObject(Goal_Raid);
|
2014-08-20 16:02:17 +00:00
|
|
|
// Prepare trigger for attack sequence
|
|
|
|
for (var tree in FindObjects(Find_Func("IsTree")))
|
|
|
|
{
|
|
|
|
tree.ChopDown_A564F3 = tree.ChopDown;
|
|
|
|
tree.ChopDown = Scenario.Tree_Chopdown;
|
|
|
|
//tree->ChopDown();
|
|
|
|
}
|
2015-11-21 19:53:19 +00:00
|
|
|
//g_attack_done = true; GetCrew()->SetPosition(npc_pyrit->GetX(), npc_pyrit->GetY()); GetCrew()->CreateObjectAbove(Airplane); GetCrew()->CreateObjectAbove(MetalBarrel);
|
2014-08-20 16:02:17 +00:00
|
|
|
//GetCrew()->CreateContents(Shovel);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// called in tree context
|
|
|
|
func Tree_Chopdown(...)
|
|
|
|
{
|
|
|
|
// On tree chopped down: Start attack sequence!
|
|
|
|
if (!g_attack_started)
|
|
|
|
{
|
|
|
|
var chopping_clonk = FindObject(Find_ID(Clonk), Sort_Distance());
|
|
|
|
StartSequence("Attack", 0, chopping_clonk);
|
|
|
|
}
|
|
|
|
// tree falls anyway
|
|
|
|
return Call(this.ChopDown_A564F3, ...);
|
|
|
|
}
|
|
|
|
|
|
|
|
func InitializePlayer(int plr)
|
|
|
|
{
|
|
|
|
var crew;
|
|
|
|
// Ensure flag has owner
|
|
|
|
if (g_flagpole && g_flagpole->GetOwner()<0) g_flagpole->SetOwner(plr);
|
|
|
|
// Late join stuff
|
2015-11-21 19:53:19 +00:00
|
|
|
if (g_pyrit_spoken) SetPlrKnowledge(plr, Airplane);
|
2014-08-20 16:02:17 +00:00
|
|
|
// Join intro listening or regular scenario
|
2015-04-19 11:40:33 +00:00
|
|
|
SetPlayerViewLock(plr, true);
|
2014-08-20 16:02:17 +00:00
|
|
|
JoinPlayer(plr);
|
|
|
|
// Scenario init
|
|
|
|
if (!g_is_initialized) g_is_initialized = DoInit(plr);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
func JoinPlayer(int plr, object crew, bool no_placement)
|
|
|
|
{
|
|
|
|
if (!crew) crew = GetCrew(plr);
|
|
|
|
if (!crew) return false;
|
|
|
|
if (!no_placement) crew->SetPosition(471, 338);
|
|
|
|
var tools;
|
|
|
|
if (g_attack_done) tools = [Shovel, Axe]; else tools = [];
|
|
|
|
for (var tool in tools)
|
|
|
|
if (!crew->ContentsCount(tool)) crew->CreateContents(tool);
|
|
|
|
SetPlayerZoomByViewRange(NO_OWNER, 400,300, PLRZOOM_Set | PLRZOOM_LimitMax);
|
|
|
|
SetCursor(crew->GetOwner(), crew);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Attack sequence */
|
|
|
|
|
|
|
|
func StartAttackSequence(object chopping_clonk)
|
|
|
|
{
|
2015-08-10 03:26:56 +00:00
|
|
|
if (!chopping_clonk) chopping_clonk = GetCursor(GetPlayerByIndex());
|
|
|
|
return StartSequence("Attack", 0, chopping_clonk);
|
2014-08-20 16:02:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Finished */
|
|
|
|
|
|
|
|
func OnPlaneLoaded(object plane, object oil)
|
|
|
|
{
|
2015-08-10 03:26:56 +00:00
|
|
|
if (!plane || !oil || g_oil_delivered) return false; // disappeared in that one frame?
|
|
|
|
g_oil_delivered = true;
|
2014-08-20 16:02:17 +00:00
|
|
|
oil->Enter(plane);
|
|
|
|
g_goal->SetStageDone();
|
2014-10-04 09:23:04 +00:00
|
|
|
g_goal->SetFulfilled();
|
2014-08-20 16:02:17 +00:00
|
|
|
return StartSequence("Outro", 0, plane);
|
|
|
|
}
|
2014-10-04 09:23:04 +00:00
|
|
|
|
|
|
|
func OnGoalsFulfilled()
|
|
|
|
{
|
2018-04-04 19:22:04 +00:00
|
|
|
SetNextScenario("Missions.ocf/Crash.ocs");
|
2018-04-05 17:36:50 +00:00
|
|
|
GainScenarioAccess("S2Raid");
|
2014-10-04 09:23:04 +00:00
|
|
|
GainScenarioAchievement("Done");
|
|
|
|
return true; // GameOver done by outro
|
|
|
|
}
|