示例#1
0
文件: Script.c 项目: 772/openclonk
func DoInit(int first_player)
{
	// Message when first player enters shroom area
	ScheduleCall(nil, Scenario.ShroomCaveCheck, 21, 0xffffff);
	// Scorching village
	g_ruin1->AddScorch(-20,-10, -45, 50, 1500);
	g_ruin2->AddScorch(-15,42, 90, 50, 1200);
	g_ruin3->AddScorch(-12,18, 130, 80, 1300);
	// Horax
	g_king.JumpSpeed = 200;
	// Update AI stuff
	var fx;
	for (var enemy in FindObjects(Find_ID(Clonk), Find_Owner(NO_OWNER)))
		if (fx = S2AI->GetAI(enemy))
		{
			fx.weapon = fx.target = nil;
			S2AI->BindInventory(enemy);
			enemy->DoEnergy(10000);
			enemy->AddEnergyBar();
		}
	g_farmer.portrait = { Source=DialogueCastle };
	// Start intro if not yet started
	StartSequence("Intro", 0, GetCrew(first_player));
	return true;
}
示例#2
0
public func Interact(object clonk)
{
	if (!dlg_interact || !dlg_name)
		return inherited(clonk, ...);
	var guide = FindObject(Find_ID(TutorialGuide), Find_Owner(clonk->GetOwner()));
	if (!guide)
		return inherited(clonk, ...);
	if (dlg_status == DLG_Status_Stop)
	{
		if (this.guide_was_shown)
		{
			this.guide_was_shown = false;
			guide->ShowGuide();				
		}
	}
	else if (dlg_status != DLG_Status_Remove && dlg_status != DLG_Status_Wait)
	{
		if (!guide->IsHidden())
		{
			this.guide_was_shown = true;
			guide->HideGuide();	
		}
	}
	return inherited(clonk, ...);
}
示例#3
0
global func DoBaseProduction(int plr, id def, int change)
{
	var base = FindObject(Find_ID(BaseMaterial), Find_Owner(plr));
	if (!base) 
		base = CreateObjectAbove(BaseMaterial, AbsX(10), AbsY(10), plr);
	if (base) 
		return base->DoBaseProd(def, change);
}
示例#4
0
global func GetBaseProduction(int plr, id def, int index, int category)
{
	var base = FindObject(Find_ID(BaseMaterial), Find_Owner(plr));
	if (!base)
		base = CreateObjectAbove(BaseMaterial, AbsX(10), AbsY(10), plr);
	if (base) 
		return base->GetBaseProd(def, index, category);
}
示例#5
0
global func SetBaseMaterial(int plr, id def, int cnt)
{
	var base = FindObject(Find_ID(BaseMaterial), Find_Owner(plr));
	if (!base) 
		base = CreateObjectAbove(BaseMaterial, AbsX(10), AbsY(10), plr);
	if (base)
		return base->SetBaseMat(def, cnt);
}
示例#6
0
文件: Script.c 项目: 772/openclonk
func RemovePlayer(int iPlr)
{
	for(var obj in FindObjects(Find_Owner(iPlr)))
	{
		if(obj)
			obj->RemoveObject();
	}
}
示例#7
0
文件: Script.c 项目: 772/openclonk
func RelaunchPlayer(int plr)
{
	var clonk = CreateObjectAbove(Clonk, LandscapeWidth()/2, 600, plr);
	clonk->MakeCrewMember(plr);
	SetCursor(plr, clonk);
	JoinPlayer(plr);
	var gui_arrow = FindObject(Find_ID(GUI_GoalArrow), Find_Owner(plr));
	gui_arrow->SetAction("Show", GetCursor(plr));
}
示例#8
0
func Outro_Start(object plane)
{
	// Player closest to plane becomes outro protagonist
	this.plane = plane;
	this.hero = plane->FindObject(Find_ID(Clonk), Find_Not(Find_Owner(NO_OWNER)), plane->Sort_Distance());
	SetPlayerZoomByViewRange(NO_OWNER, 200,100, PLRZOOM_Set | PLRZOOM_LimitMax);
	SetViewTarget(this.hero);
	npc_pyrit.has_sequence = true; // Pyrit stops hammering
	return ScheduleNext(5);
}
示例#9
0
func Outro_Start(object goal, object plane)
{
	this.goal = goal;
	this.plane = plane;
	this.hero = plane->FindObject(Find_Not(Find_Owner(NO_OWNER)), Find_ID(Clonk), plane->Sort_Distance());
	
	SetViewTarget(this.plane);
	
	MessageBoxAll("$Outro1$", this.hero, true);
	
	return ScheduleNext(150);
}
示例#10
0
文件: Plane.c 项目: 772/openclonk
func Initialize(...)
{
	// (first) plane built? Story advances.
	// only after attack, so enemy planes don't count
	if (g_attack_done && !g_plane_built)
	{
		g_plane_built = true;
		var closest_clonk = FindObject(Find_ID(Clonk), Find_Not(Find_Owner(NO_OWNER)), Sort_Distance());
		SetColor(0xa04000); // Make sure it has the same color in all missions
		Dialogue->MessageBoxAll("$PlaneBuilt$", closest_clonk, true);
	}
	return _inherited(...);
}
示例#11
0
func Special2(object clonk, int x, int y, bool released, bool mouseclick, bool abletocast,  bool cooldown)
{
	if (released || mouseclick || cooldown) return;
	
	var existing = FindObjects(Find_ID(StickyBomb), Find_Owner(clonk->GetOwner()));
	if (existing)
	{
		SoundAt("UI::Click");
		for (var bomb in existing)
			bomb->BlowUp();
		return;
	}
}
示例#12
0
global func CyclopsFindTarget(fx)
{
	// Consider hostile clonks, or all clonks if the AI does not have an owner.
	var hostile_criteria = Find_Hostile(fx.cyclops->GetOwner());
	if (fx.cyclops->GetOwner() == NO_OWNER)
		hostile_criteria = Find_Not(Find_Owner(fx.cyclops->GetOwner()));

	for (var target in FindObjects(Find_InRect(fx.guard_range.x,fx.guard_range.y,fx.guard_range.wdt,fx.guard_range.hgt), Find_OCF(OCF_CrewMember), hostile_criteria, Find_NoContainer(), Sort_Random()))
		if (PathFree(fx.cyclops->GetX(),fx.cyclops->GetY(),target->GetX(),target->GetY()))
			return target;

	// Nothing found.
	return;
}
示例#13
0
func DoInit(int first_player)
{
	// Message when first player enters shroom area
	ScheduleCall(nil, Scenario.ShroomCaveCheck, 21, 0xffffff);
	// Scorching village
	g_ruin1->AddScorch(-20,-10, -45, 50, 1500);
	g_ruin2->AddScorch(-15,42, 90, 50, 1200);
	g_ruin3->AddScorch(-12,18, 130, 80, 1300);
	// Update AI stuff
	var fx;
	for (var enemy in FindObjects(Find_ID(Clonk), Find_Owner(NO_OWNER)))
		if (fx = AI->GetAI(enemy))
		{
			fx.weapon = fx.target = nil;
			AI->BindInventory(enemy);
			enemy->DoEnergy(10000);
			enemy->AddEnergyBar();
		}
	return true;
}
示例#14
0
func InitializePlayer (plr,x,y,bas,team) {
  // Gebäude in den Besitz
  for (var obj in FindObjects(Find_Category(C4D_Structure), Find_Owner(NO_OWNER), Find_Distance(300, x,y)))
    SetOwner(plr, obj);
  // Hörx ist ein König!
  if (team == 2) {
    var obj = GetHiRank (plr);
    obj->CLNK::Redefine2 (_HRX);
    SetPortrait ("random", obj, _HRX);
    SetName ("$Herx$", obj);
  }
  // Alle ins Haus!
  var home;
  if (team == 2) home = FindObject2(Find_ID(CST3)); else home = FindObject2(Find_ID(HUT3));
  for (var mat in FindObjects(Find_Category(C4D_Object | C4D_Vehicle | C4D_Living), Find_Not(Find_ID(CSTE)), Find_Owner(plr)))
    Enter(home, mat);
  // Den besten Clonks auswählen und vor die Tür
  SetCursor(plr, GetHiRank(plr));
  SetCommand(GetCursor(plr), "Exit");
  // Und auf den Gegner schauen
  SetDir(2-team, GetCursor(plr));
}
示例#15
0
文件: Script.c 项目: 772/openclonk
global func CreateAttackWave(int angle, int rockets, int anglespread)
{
	var radius = Min(LandscapeWidth()/2, LandscapeHeight()/2);
	var rocket_id = Boomattack;
	// boss
	if(rockets == -1)
	{
		rockets = 1;
		rocket_id = BigBoomattack;
	}
	
	for(var i=0; i<rockets; ++i)
	{
		var rocket_angle = angle + Random(anglespread) - anglespread/2;
		var rocket_radius = radius * RandomX(80,100) / 100;
		var x =  Sin(rocket_angle, rocket_radius)+LandscapeWidth()/2;
		var y = -Cos(rocket_angle, rocket_radius)+LandscapeHeight()/2;

		CreateObjectAbove(rocket_id, x, y)->Launch(rocket_angle + 180);
	}
	
	for(var i=0; i<GetPlayerCount(); ++i)
	{
		var owner = GetPlayerByIndex(i);
		var gui_arrow = FindObject(Find_ID(GUI_GoalArrow), Find_Owner(owner));
		if(!gui_arrow)
		{
			gui_arrow = CreateObjectAbove(GUI_GoalArrow,0,0,owner);
			gui_arrow->SetAction("Show", GetCursor(owner));
			gui_arrow->SetClrModulation(RGB(255,0,0));
			gui_arrow->SetObjectBlitMode(GFX_BLIT_Mod2);
		}
		gui_arrow->SetR(angle);
		gui_arrow.Plane = 500;
	}
}
示例#16
0
global func GetMarkerForIndex(index, plr)
{
	return FindObject(Find_ID(Marker), Find_Owner(plr), Find_Func("IsIndex", index));
}
示例#17
0
// Open for all players
func Find_Allied(plr) { return Find_Not(Find_Owner(NO_OWNER)); }
示例#18
0
func Outro_5()
{
	if (npc_pyrit->Contained() != this.plane) return ScheduleSame(5);
	// After Pyrit is inside, rest enters freely
	this.plane->SetEntrance(true);
	for (var clonk in this.plane->FindObjects(this.plane->Find_AtRect(-60,-30,120,60), Find_ID(Clonk), Find_Not(Find_Owner(NO_OWNER))))
		clonk->SetCommand("Enter", this.plane);
	return ScheduleNext(100);
}
示例#19
0
func CleanUp(object clonk)
{
	for (var bomb in FindObjects(Find_ID(StickyBomb), Find_Owner(clonk->GetOwner())))
		bomb->Remove();
}