func Dlg_Pyrit_Init(object clonk) { // Pyit has a red hat! clonk->AttachMesh(Hat, "skeleton_head", "main", Trans_Translate(5500, 0, 0)); // 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; }