1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
|
#appendto Dialogue
/* Pyrit dialogue */
func Dlg_Pyrit_1(object clonk)
{
SetBroadcast(true);
MessageBox("$Pyrit1$", clonk, clonk); // u pyrit?
return true;
}
func Dlg_Pyrit_2(object clonk)
{
MessageBox("$Pyrit2$", clonk, dlg_target); // ye. why u here?
return true;
}
func Dlg_Pyrit_3(object clonk)
{
MessageBox("$Pyrit3$", clonk, clonk); // my village got pwned
return true;
}
func Dlg_Pyrit_4(object clonk)
{
MessageBox("$Pyrit4$", clonk, dlg_target); // ye i saw. cuz u no pay tax
return true;
}
func Dlg_Pyrit_5(object clonk)
{
MessageBox("$Pyrit5$", clonk, clonk); // tax is communism
return true;
}
func Dlg_Pyrit_6(object clonk)
{
MessageBox("$Pyrit6$", clonk, dlg_target); // we pay but harx b greedy
return true;
}
func Dlg_Pyrit_7(object clonk)
{
MessageBox("$Pyrit7$", clonk, clonk); // so u help me?
return true;
}
func Dlg_Pyrit_8(object clonk)
{
MessageBox("$Pyrit8$", clonk, dlg_target); // how u get there?
return true;
}
func Dlg_Pyrit_9(object clonk)
{
MessageBox("$Pyrit9$", clonk, clonk); // can we build plane?
return true;
}
func Dlg_Pyrit_10(object clonk)
{
MessageBox("$Pyrit10$", clonk, dlg_target); // i can give plans, but not fuel
return true;
}
func Dlg_Pyrit_11(object clonk)
{
MessageBox("$Pyrit11$", clonk, clonk); // for gud reason
return true;
}
func Dlg_Pyrit_12(object clonk)
{
MessageBox("$Pyrit12$", clonk, dlg_target); // only way 2 get there
return true;
}
func Dlg_Pyrit_13(object clonk)
{
MessageBox("$Pyrit13$", clonk, dlg_target); // some ppl hide oil
return true;
}
func Dlg_Pyrit_14(object clonk)
{
MessageBox("$Pyrit14$", clonk, dlg_target); // ask around 4 oil
// 2nd time in dialogue omit last message
if (g_pyrit_spoken)
{
StopDialogue();
SetDialogueProgress(16);
}
return true;
}
func Dlg_Pyrit_15(object clonk)
{
MessageBox("$Pyrit15$", clonk, dlg_target); // take con plans for plane
g_pyrit_spoken = true;
g_goal->SetStagePlane();
AddTimer(this.CheckOilAtPlane, 10);
SetBroadcast(false);
StopDialogue();
SetDialogueProgress(16);
SetPlrKnowledge(NO_OWNER, Airplane);
// many NPCs get new texts now
Dialogue->FindByTarget(npc_newton)->SetDialogueProgress(200, nil, true);
Dialogue->FindByTarget(npc_mave)->SetDialogueProgress(100, nil, true);
Dialogue->FindByTarget(npc_clonko)->SetDialogueProgress(100, nil, true);
Dialogue->FindByTarget(npc_dora)->AddAttention(); // in case player spoke to Dora before speaking to Pyrit...
return true;
}
// called every 10 frames after plane+oil task has been given
func CheckOilAtPlane()
{
var barrel;
for (var plane in FindObjects(Find_ID(Airplane)))
if (barrel = plane->FindObject(plane->Find_AtRect(-30,-10,60,20), Find_ID(MetalBarrel)))
{
RemoveTimer(Scenario.CheckOilAtPlane);
ScheduleCall(nil, Global.GameCall, 1,1, "OnPlaneLoaded", plane, barrel);
}
return true;
}
func Dlg_Pyrit_16(object clonk)
{
// ask how to build plane unless it has been built
if (g_plane_built) return Dlg_Pyrit_18(clonk);
MessageBox("$Pyrit16$", clonk, clonk); // where i build plane?
return true;
}
func Dlg_Pyrit_17(object clonk)
{
MessageBox("$Pyrit17$", clonk, dlg_target); // in shipyard
return true;
}
func Dlg_Pyrit_18(object clonk)
{
// ask for oil unless we got the oil location from Mave already
if (g_mave_oil_spoken) return Dlg_Pyrit_19(clonk);
MessageBox("$Pyrit18$", clonk, clonk); // where oil?
SetDialogueProgress(13);
return true;
}
func Dlg_Pyrit_19(object clonk)
{
// after talking to Mave, we need a gold bar. ask where to find.
MessageBox("$Pyrit19$", clonk, clonk); // where gold?
SetDialogueProgress(20);
return true;
}
func Dlg_Pyrit_20(object clonk)
{
MessageBox("$Pyrit20$", clonk, dlg_target); // gold underground
StopDialogue();
SetDialogueProgress(16);
return true;
}
// Generic call on every dlg message of Pyrit
func Dlg_Pyrit(object clonk)
{
// Stop walking.
if (dlg_target->GetCommand())
{
this.was_walk_interrupted = true;
dlg_target->SetCommand("None");
dlg_target->SetComDir(COMD_Stop);
dlg_target->SetXDir();
}
// Yield animation
if (this.anim) dlg_target->StopAnimation(this.anim);
this.anim = 0;
this.anim_continue_frame = FrameCounter() + 50;
return false; // do call specific functions
}
/* NPC animations */
static const Pyrit_Hammer_SwingTime = 40;
func Dlg_Pyrit_Init(object clonk)
{
// Clonk moves slowly.
clonk.ActMap = { Prototype = Clonk.ActMap, Walk = { Prototype = Clonk.ActMap.Walk } };
clonk.ActMap.Walk.Speed /= 3;
clonk->SetAction("Walk");
// Hammering animation
AddEffect("PyritHammering", clonk, 1, Pyrit_Hammer_SwingTime+5, this);
return true;
}
func FxPyritHammeringTimer(object c, proplist fx, int time)
{
if (!fx.hat)
{
// Pyit has a red hat!
fx.hat = c->AttachMesh(Hat, "skeleton_head", "main", Trans_Translate(5500, 0, 0));
}
if (FrameCounter() < this.anim_continue_frame || c.has_sequence) return FX_OK;
this.anim = 0;
if (!fx.catapult) if (!(fx.catapult = c->FindObject(Find_ID(Catapult), Sort_Distance()))) return FX_OK;
if ((!Random(20) && GetPlayerCount()) || this.was_walk_interrupted)
{
// Move between two places (only if players are joined so Pyrit stays in place for object saving)
var new_pos = [fx.catapult->GetX()-24, fx.catapult->GetX()+26][c->GetX() < fx.catapult->GetX()];
c->SetCommand("MoveTo", nil, new_pos, fx.catapult->GetY());
this.anim_continue_frame = FrameCounter() + 50;
this.was_walk_interrupted = false;
}
else
{
// Ensure proper direction
if ((c->GetDir()==DIR_Right) != (c->GetX() < fx.catapult->GetX())) { c->SetDir(!c->GetDir()); return FX_OK; }
// No movement: Swing hammer
var anim_idx = Random(2);
var anim_name = ["SwordSlash1.R", "SwordSlash2.R"][anim_idx];
var anim_len = c->GetAnimationLength(anim_name);
this.anim = c->PlayAnimation(anim_name, CLONK_ANIM_SLOT_Arms, Anim_Linear(0,0,anim_len, Pyrit_Hammer_SwingTime, ANIM_Remove));
// Schedule effect when hammer hits object
var hit_delay = [50,50,30,30][anim_idx] * Pyrit_Hammer_SwingTime / 100;
ScheduleCall(c, Dialogue.Pyrit_HitFx, hit_delay, 1);
}
return FX_OK;
}
func Pyrit_HitFx()
{
var x = (GetDir()*2-1) * 14;
var y = 4;
CreateParticle("StarSpark", x*9/10,y*9/10, PV_Random(-20, 20), PV_Random(-20, 20), PV_Random(10, 20), Particles_Glimmer(), 10);
Sound("Objects::Pickaxe::Clang?");
return true;
}
func FxPyritHammeringStop(object c, proplist fx, int reason, bool temp)
{
if (!temp && this.anim)
{
c->StopAnimation(this.anim);
this.anim = 0;
}
return FX_OK;
}
|