示例#1
0
protected func Initialize()
{
	// Goal.
	CreateObject(Goal_LastManStanding);
	CreateObject(Rule_KillLogs);
	CreateObject(Rule_Gravestones);
	GetRelaunchRule()
		->SetRespawnDelay(3)
		->SetLastWeaponUse(false);
	
	// Enviroment.
	CreateObject(Rule_ObjectFade)->DoFadeTime(10 * 36);
	SetSkyAdjust(RGB(255, 128, 0));
	SetSkyParallax(1, 20, 20, 0, 0, nil, nil);
	CreateObjectAbove(Column, 160, 304)->SetClrModulation(RGB(255, 100, 80));
	CreateObjectAbove(Column, 448, 272)->SetClrModulation(RGB(255, 100, 80));
	SetMatAdjust(RGB(255, 150, 128));
	
	AddEffect("RandomMeteor", nil, 100, 20);
	AddEffect("DangerousLava", nil, 100, 1);

	PlaceEdges();
	PlaceGras();
	return;
}
示例#2
0
文件: SeqAttack.c 项目: 772/openclonk
func Attack_1()
{
	var n_planes = 3;
	var plane_x = [1700, 1750, 1800];
	var plane_y = [90, 110, 80];
	this.planes = CreateArray(n_planes);
	for (var i=0; i<n_planes; ++i)
	{
		var plane = CreateObjectAbove(Plane, plane_x[i], plane_y[i]);
		var pilot = CreateObjectAbove(Clonk, plane_x[i], plane_y[i]);
		pilot->SetSkin(2);
		pilot->Enter(plane);
		pilot->SetAction("Walk"); // prevents falling out
		pilot->SetColor(0xff101010);
		pilot->SetDir(DIR_Left);
		//plane->FaceLeft();
		plane->StartInstantFlight(260, 15);
		plane->SetXDir(-15);
		plane->MakeInvincible();
		this.planes[i] = plane;
	}
	//SetPlayerZoomByViewRange(NO_OWNER, 600,500, PLRZOOM_Set | PLRZOOM_LimitMax);
	//SetViewTarget(this.planes[0]);
	return ScheduleNext(35);
}
示例#3
0
private func Initialize()
{

	// Create dynamite below the first lava basin
	DrawMaterialQuad("Tunnel",1378,1327-5,1860,1327-5,1860,1330,1387,1330,1);

	//Sound("Environment::BirdsLoop",true,100,nil,+1);
	Cloud->Place(40);
	PlaceObjects(Rock,50,"Earth");
	PlaceObjects(Loam,25,"Earth");
	PlaceObjects(Nugget,25,"Earth");

	AddEffect("PlaneReset",CreateObjectAbove(Airplane,3030,315,0),100,10,nil,nil);
	AddEffect("PlaneReset",CreateObjectAbove(Airplane,3160,315,1),100,10,nil,nil);

	Doors();

	var concierge = CreateObjectAbove(Clonk, 70, 1030, NO_OWNER);
	concierge->SetDir(DIR_Left);
	concierge->SetAlternativeSkin("Mime");
	concierge->SetObjectLayer(concierge);
	concierge->SetName("$NameConcierge$");
	concierge->SetDialogue("Concierge");
	concierge->Sound("Circus", false, nil, nil, +1, 100);
	Dialogue->FindByTarget(concierge)->AddAttention();

	var cannons = FindObjects(Find_ID(Cannon));
	for (var cannon in cannons)
	{
		cannon->TurnCannon(0);
		cannon->SetCannonAngle(45000);
		cannon.Touchable = false;
	}
示例#4
0
func Intro_Init(object flagpole)
{
	// Fix plane outside landscape for now
	this.plane = CreateObjectAbove(Airplane, 100,-20);
	this.plane->FaceRight();
	this.plane->SetR(80);
	this.plane->SetColor(0xa04000);
	this.plane_Hit = this.plane.Hit;
	this.plane.Hit = this.Intro_PlaneHit;
	this.plane.intro_seq = this;
	this.plane_cat = this.plane->GetCategory();
	this.plane->SetCategory(C4D_StaticBack);
	this.plane->MakeInvincible();
	this.plane.Touchable = 0;
	
	// Pyrit the pilot
	this.pilot = npc_pyrit = CreateObjectAbove(Clonk, 100, 100, NO_OWNER);
	this.pilot->MakeInvincible();
	this.pilot->Enter(this.plane);
	this.pilot->SetAction("Walk");
	this.pilot->SetName("Pyrit");
	this.pilot->SetColor(0xff0000);
	this.pilot->SetDir(DIR_Left);
	this.pilot->SetObjectLayer(this.pilot);
	this.pilot->SetAlternativeSkin("MaleBrownHair");
	
	this.plane->PlaneMount(this.pilot);
	// Pyit has a red hat!
	this.pilot->AttachMesh(Hat, "skeleton_head", "main", Trans_Translate(5500, 0, 0));

	// Dialogue object also used as helper container for clonks
	this.dialogue = this.pilot->SetDialogue("Pyrit");
	this.dialogue->SetInteraction(false);

}
示例#5
0
文件: Script.c 项目: 772/openclonk
func JoinPlayer(int iPlr)
{
	var clonk = GetCrew(iPlr);
	clonk->DoEnergy(1000);

	clonk->CreateContents(Bow);
	clonk->Collect(CreateObjectAbove(Arrow));
	clonk->CreateContents(Musket);
	clonk->Collect(CreateObjectAbove(LeadShot));
	return;
}
示例#6
0
func Place(int amount, proplist rectangle, proplist settings)
{
	var max_tries = 2 * amount;
	var loc_area = nil;
	if (rectangle) loc_area = Loc_InArea(rectangle);
	var f;
	
	while ((amount > 0) && (--max_tries > 0))
	{
		var spot = FindLocation(Loc_Material("Water"), Loc_Space(20), loc_area);
		if (!spot) continue;
		
		f = CreateObjectAbove(this, spot.x, spot.y, NO_OWNER);
		if (!f) continue;
		// Randomly add some large/slim fish
		if (Random(3))
		{
			// There are naturally smaller and larger fishes. Fishes above around 150 can be clipped, so stay below that.
			f->SetCon(RandomX(75, 140));
			// make sure the smaller ones don't grow larger any more
			f->StopGrowth(); 
			// Slim fish.
			if (f->GetCon() > 100 || !Random(3))
				f->SetYZScale(1000 - Random(300));  
		}
		
		if (f->Stuck())
		{
			f->RemoveObject();
			continue;
		}
		--amount;
	}
	return f; // return last created fish
}
示例#7
0
// Splits the calling object into its components.
global func Split2Components()
{
	// Safety: can only be called from object context.
	if (!this || GetType(this) != C4V_C4Object)
		return FatalError(Format("Split2Components must be called from object context and not from %v", this));

	// Transfer all contents to container.
	var ctr = Contained();
	while (Contents())
		if (!ctr || !Contents()->Enter(ctr))
			Contents()->Exit();
			
	// Split components.
	for (var i = 0, compid; compid = GetComponent(nil, i); ++i)
		for (var j = 0; j < GetComponent(compid); ++j)
		{
			var comp = CreateObjectAbove(compid, nil, nil, GetOwner());
			if (OnFire()) comp->Incinerate();
			if (!ctr || !comp->Enter(ctr))
			{
				comp->SetR(Random(360));
				comp->SetXDir(Random(3) - 1);
				comp->SetYDir(Random(3) - 1);
				comp->SetRDir(Random(3) - 1);
			}
		}
	return RemoveObject();
}
示例#8
0
global func CreateWaterfall(int x, int y, int strength, string mat)
{
	var fall = CreateObjectAbove(Waterfall, x, y, NO_OWNER);
	if (!mat) mat = "Water";
	AddEffect("IntWaterfall", fall, 100, 1, fall, nil, x, y, strength, mat);
	return fall;
}
示例#9
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);
}
示例#10
0
global func IntroCreateBoompack(int x, int y, int fuel)
{
	var boompack = CreateObjectAbove(Boompack, x, y, NO_OWNER);
	boompack->SetFuel(fuel);
	boompack->SetDirectionDeviation(8); // make sure direction of boompack is roughly kept
	boompack->SetControllable(false);
	return boompack;
}
示例#11
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);
}
示例#12
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);
}
示例#13
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));
}
示例#14
0
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 = CreateObjectAbove(Airplane, LandscapeWidth() / 2 - 564, lava_y - 176);
	this.pilot = CreateObjectAbove(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->PlaneMount(this.pilot);
	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;
}
示例#15
0
public func Intro_Init()
{
	// Create an airplane with pilot and fly it towards the peak.
	this.airplane = CreateObjectAbove(Airplane, 24, LandscapeHeight() - 480);
	this.pilot = CreateObjectAbove(Clonk, 24, LandscapeHeight() - 480);
	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(0xffcc11aa);
	this.airplane->PlaneMount(this.pilot);
	this.airplane->FaceRight();
	this.airplane->StartInstantFlight(60, 15);
	this.airplane->SetXDir(12);
	this.airplane->SetYDir(-10);
	this.airplane->MakeInvincible();
	return;
}
示例#16
0
文件: Script.c 项目: 772/openclonk
func Initialize()
{
	Log("Difficulty = %d", SCENPAR_Difficulty);
	num_to_collect = SCENPAR_Difficulty;
	for (var i=0; i<num_to_collect; ++i)
	{
		var ng = CreateObjectAbove(Nugget, Random(LandscapeWidth()-100) + 50, LandscapeHeight()/2 + Random(LandscapeHeight()/2-40));
		ng.Entrance = Scenario.GotNugget;
	}
	return true;
}
示例#17
0
// Sets a new dialogue for a npc.
global func SetDialogue(string name, bool attention)
{
	if (!this)
		return;
	var dialogue = CreateObjectAbove(Dialogue);
	dialogue->InitDialogue(name, this, attention);
	
	dialogue->SetObjectLayer(nil);
	dialogue.Plane = this.Plane+1; // for proper placement of the attention symbol

	return dialogue;
}
示例#18
0
func InitializeObjects()
{
	CreateObject(Rule_KillLogs, 50, 50);
	CreateObject(Rule_Gravestones, 50, 50);
	CreateObject(Rule_Restart, 50, 50);

	CreateObject(Goal_Melee, 50, 50);

	ItemSpawn->Create(Firestone,407,389);
	ItemSpawn->Create(Firestone,423,389);
	ItemSpawn->Create(PowderKeg,669,261);
	ItemSpawn->Create(Bread,352,258);
	ItemSpawn->Create(IronBomb,441,389);
	ItemSpawn->Create(IceWallKit,990,400);
	ItemSpawn->Create(Firestone,443,101);
	ItemSpawn->Create(IceWallKit,372,258);

	var Chest001 = CreateObjectAbove(Chest, 1047, 359);

	CreateObjectAbove(Idol, 315, 235);

	var WoodenBridge001 = CreateObjectAbove(WoodenBridge, 513, 282);
	WoodenBridge001->SetCategory(C4D_StaticBack);
	var WoodenBridge002 = CreateObjectAbove(WoodenBridge, 1126, 372);
	WoodenBridge002->SetCategory(C4D_StaticBack);

	CreateObjectAbove(Goal_Flag, 497, 125);

	CreateObjectAbove(Catapult, 728, 431);
	CreateObjectAbove(Catapult, 558, 107);

	var Cannon001 = CreateObjectAbove(Cannon, 692, 253);
	Cannon001->SetRDir(3);

	CreateObjectAbove(Airship, 383, 181);

	Chest001->CreateContents(IronBomb, 2);

	Chest001->CreateContents(Bread);

	Chest001->CreateContents(BombArrow);

	Chest001->CreateContents(Bow);
	return true;
}
示例#19
0
protected func Initialize()
{
	// Environment 
	CreateObject(Rule_ObjectFade)->DoFadeTime(10 * 36);
	
	GetRelaunchRule()->SetLastWeaponUse(false);
	
	var time=CreateObject(Time);
	time->SetTime();
	time->SetCycleSpeed();
	FindObject(Find_ID(Moon))->SetMoonPhase(3);
	FindObject(Find_ID(Moon))->SetCon(150);
	FindObject(Find_ID(Moon))->SetPosition(LandscapeWidth()/2,150);

	// Goal: Capture the flag, with bases in both hideouts.
	var goal = CreateObject(Goal_CaptureTheFlag, 0, 0, NO_OWNER);
	goal->SetFlagBase(1, 135, 266);
	goal->SetFlagBase(2, LandscapeWidth() - 135, 266);
	CreateObject(Rule_KillLogs);	
	
	var gate = CreateObjectAbove(StoneDoor, 345, 272, NO_OWNER);
	gate->SetClrModulation(RGB(140,185,255));
	gate->SetAutoControl(1);
	var gate = CreateObjectAbove(StoneDoor, LandscapeWidth()-344, 272, NO_OWNER);
	gate->SetClrModulation(RGB(140,185,255));
	gate->SetAutoControl(2);

	// Chests with weapons.
	var chest;
	chest = CreateObjectAbove(Chest, 60, 220, NO_OWNER);
	chest->MakeInvincible();
	AddEffect("FillBaseChest", chest, 100, 7 * 36,nil,nil,false);
	chest = CreateObjectAbove(Chest, 150, 370, NO_OWNER);
	chest->MakeInvincible();
	AddEffect("FillBaseChest", chest, 100, 7 * 36,nil,nil,true);
	chest = CreateObjectAbove(Chest, LandscapeWidth() - 60, 220, NO_OWNER);
	chest->MakeInvincible();
	AddEffect("FillBaseChest", chest, 100, 7 * 36,nil,nil,false);
	chest = CreateObjectAbove(Chest, LandscapeWidth() - 150, 370, NO_OWNER);
	chest->MakeInvincible();
	AddEffect("FillBaseChest", chest, 100, 7 * 36,nil,nil,true);

	
	chest = CreateObjectAbove(Chest, LandscapeWidth()/2, 320, NO_OWNER);
	chest->MakeInvincible();
	AddEffect("FillOtherChest", chest, 100, 5 * 36);
	
	AddEffect("SnowyWinter", nil, 100, 1);
	Sound("Environment::WindLoop",true,20,nil,+1);
	AddEffect("GeysirExplosion", nil, 100, 1);
	// Brick edges, notice the symmetric landscape.
	PlaceEdges();
	return;
}
示例#20
0
func Intro_Init()
{
	this.plane = CreateObjectAbove(Airplane, 0, 400);
	this.plane->SetColor(0xa04000);
	this.pilot = npc_pyrit = CreateObjectAbove(Clonk, 100, 100, NO_OWNER);
	this.pilot->MakeInvincible();
	this.pilot->SetSkin(2);
	this.pilot->Enter(this.plane);
	this.pilot->SetAction("Walk");

	this.pilot->SetName("Pyrit");
	this.pilot->SetColor(0xff0000); // currently overridden by skin
	this.pilot->SetAlternativeSkin("MaleBrownHair");
	this.pilot->SetDir(DIR_Left);
	this.pilot->SetObjectLayer(this.pilot);
	this.pilot->AttachMesh(Hat, "skeleton_head", "main", Trans_Translate(5500, 0, 0));
	this.dialogue = this.pilot->SetDialogue("Pilot");
	this.dialogue->SetInteraction(false);

	this.plane->FaceRight();
	this.plane->PlaneMount(this.pilot);
}
示例#21
0
func Initialize()
{
	// Setup testing environment: one object for context, a second object at the context object, one object at 0,0
	var ctx = CreateObjectAbove(Dummy, 100, 100, NO_OWNER);
	ctx->SetName("ctx");
	var at_origin = CreateObjectAbove(Dummy, 0, 0, NO_OWNER);
	at_origin->SetName("at_origin");
	var at_object = CreateObjectAbove(Dummy, ctx->GetX(), ctx->GetY(), NO_OWNER);
	at_object->SetName("at_object");

	TEST("object context Find_Distance");
	EXPECT_EQ(at_object, ctx->FindObject(Find_Exclude(ctx), Find_Distance(1)));

	TEST("global context Find_Distance");
	EXPECT_EQ(at_origin,      FindObject(Find_Exclude(ctx), Find_Distance(1, at_origin->GetX(), at_origin->GetY())));
	EXPECT_EQ(at_object,      FindObject(Find_Exclude(ctx), Find_Distance(1, at_object->GetX(), at_object->GetY())));

	TEST("object context Find_InRect");
	EXPECT_EQ(at_object, ctx->FindObject(Find_Exclude(ctx), Find_InRect(0, 0, 1, 1)));
	EXPECT_EQ(at_origin, ctx->FindObject(Find_Exclude(ctx), Find_InRect(-ctx->GetX(), -ctx->GetY(), 1, 1)));

	TEST("global context Find_InRect");
	EXPECT_EQ(at_origin,      FindObject(Find_Exclude(ctx), Find_InRect(at_origin->GetX(), at_origin->GetY(), 1, 1)));
	EXPECT_EQ(at_object,      FindObject(Find_Exclude(ctx), Find_InRect(at_object->GetX(), at_object->GetY(), 1, 1)));

	TEST("object context Sort_Distance");
	EXPECT_EQ(at_object, ctx->FindObject(Find_Exclude(ctx),              Sort_Distance() ));
	EXPECT_EQ(at_origin, ctx->FindObject(Find_Exclude(ctx), Sort_Reverse(Sort_Distance())));

	TEST("global context Sort_Distance");
	EXPECT_EQ(at_object,      FindObject(Find_Exclude(ctx),              Sort_Distance(at_object->GetX(), at_object->GetY()) ));
	EXPECT_EQ(at_origin,      FindObject(Find_Exclude(ctx),              Sort_Distance(at_origin->GetX(), at_origin->GetY()) ));
	EXPECT_EQ(at_object,      FindObject(Find_Exclude(ctx), Sort_Reverse(Sort_Distance(at_origin->GetX(), at_origin->GetY()))));

	END_TEST();
	GameOver();
}
示例#22
0
func Intro_Start()
{
	// Intro starts high up in the clouds
	Music("TheSkylands");
	LoadScenarioSection("Intro");
	SetWind(-100);
	this.intro_skyscroll_xdir = -10;
	SetSkyParallax(0, 20, 20, this.intro_skyscroll_xdir, 0);
	
	this.plane = CreateObjectAbove(Airplane, 500, 200);
	this.plane->SetColor(0xa04000);
	this.pilot = CreateObjectAbove(Clonk, 100, 100, NO_OWNER);
	this.pilot->MakeInvincible();
	this.pilot->SetSkin(2);
	this.pilot->Enter(this.plane);
	this.pilot->SetAction("Walk");

	this.pilot->SetName("Pyrit");
	this.pilot->SetColor(0xff0000);
	this.pilot->SetAlternativeSkin("MaleBrownHair");
	this.pilot->SetDir(DIR_Left);
	this.pilot->SetObjectLayer(this.pilot);
	this.pilot->AttachMesh(Hat, "skeleton_head", "main", Trans_Translate(5500, 0, 0)); // Hat is seen in the cockpit!

	this.plane->PlaneMount(this.pilot);
	this.plane.FxIntPlaneTimer = this.Intro_PlaneTimer;
	RemoveEffect("IntPlane", this.plane);
	AddEffect("IntPlane",this.plane,1,1,this.plane);
	this.plane->FaceRight();
	this.plane->StartInstantFlight(90, 0);
	g_intro_sky_moving = true;
	

	SetViewTarget(this.plane);

	return ScheduleNext(100, 1);
}
示例#23
0
global func AddScorch(int x, int y, int r, int strength, int duration)
{
	var scorch = CreateObjectAbove(Wood, x,y, NO_OWNER);
	if (!scorch) return nil;
	scorch->SetObjectLayer(scorch);
	scorch->SetR(r);
	scorch->SetClrModulation(0x80804000);
	scorch->SetCategory(C4D_StaticBack);
	scorch.Collectible = false; // SetObjectLayer is not enough...
	scorch.Plane = this.Plane+1;
	var fx = AddEffect("FireScorching", scorch, 1, 2, scorch);
	fx.strength = strength;
	fx.duration = duration;
	return scorch;
}
示例#24
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;
	}
}
示例#25
0
func Place(int amount, proplist area, proplist settings)
{
	var max_tries = 2 * amount;
	var loc_area = nil;
	if (area) loc_area = Loc_InArea(area);
	
	while ((amount > 0) && (--max_tries > 0))
	{
		var spot = FindLocation(Loc_Material("Water"), Loc_Wall(CNAT_Bottom), loc_area);
		if (!spot) continue;
		
		var f = CreateObjectAbove(this, spot.x, spot.y, NO_OWNER);
		--amount;
	}
	return true;
}
示例#26
0
文件: Script.c 项目: 772/openclonk
func Initialize()
{
	var offs = 45;
	CreateObjectAbove(WindGenerator, 1147, 938+offs)->SetR(7);
	CreateObjectAbove(WindGenerator, 985, 1105+offs)->SetR(-170);
	CreateObjectAbove(WindGenerator, 1055, 1085+offs)->SetR(140);
	CreateObjectAbove(WindGenerator, 971, 857+offs)->SetR(-20);
	CreateObjectAbove(WindGenerator, 1147, 1035+offs)->SetR(160);
	CreateObjectAbove(WindGenerator, 1036, 870+offs)->SetR(-10);
	CreateObjectAbove(WindGenerator, 1081, 873+offs)->SetR(18);
	CreateObjectAbove(WindGenerator, 858, 930+offs)->SetR(-10);
	
	CreateObject(Goal_SaveTheWindmills,10,10);
	PlaceGrass(100, 800, 1400);
	SetSkyParallax(0,25,25,0,0,0,50);
	AddEffect("BoomAttack", nil, 100, 35);
	Sound("WindLoop",true,40,nil,+1);
}
示例#27
0
global func FxIntIntroStart(object target, proplist effect)
{
	effect.Cabin = FindObject(Find_ID(WoodenCabin));
	if(!effect.Cabin) return -1;

	effect.Sister = CreateObjectAbove(Clonk, 174, 532, NO_OWNER);
	effect.Sister->MakeInvincible();
	effect.Sister->SetSkin(1);
	effect.Sister->SetName("$NameSister$");
	effect.Sister->SetColor(RGB(213, 68, 172));
	effect.Sister->SetObjectLayer(effect.Sister);
	effect.Sister->SetDir(DIR_Right);
	effect.Sister.ActMap = { Prototype = Clonk.ActMap };
	effect.Sister.ActMap.Walk = { Prototype = Clonk.ActMap.Walk, Decel = 100 };
	effect.Sister.ActMap.Jump = { Prototype = Clonk.ActMap.Jump, Speed = 0, Accel=0 };
	effect.Sister.JumpSpeed = 0;

	effect.Dialog = effect.Sister->SetDialogue("Sister");
	effect.Rock = effect.Sister->CreateContents(Rock);
	effect.Rock->SetObjectLayer(nil);
	effect.Players = [];
}
示例#28
0
func EnsureObject(id def, int x, int y, int owner)
{
	var obj = FindObject(Find_ID(def));
	if (!obj) obj = CreateObjectAbove(def,x,y,owner);
	return obj;
}
示例#29
0
文件: Creation.c 项目: 772/openclonk
// Creates amount objects of type id inside the indicated rectangle(optional) in the indicated material.
// Returns the number of iterations needed, or -1 when the placement failed.
global func PlaceObjects(id id, int amount, string mat_str, int x, int y, int wdt, int hgt, bool onsf, bool nostuck)
{
	var i, j;
	var rndx, rndy, obj;
	var mat;
	var objhgt = id->GetDefCoreVal("Height", "DefCore");
	
	mat = Material(mat_str);
	// Some failsavety.
	if (mat == -1)
		if (mat_str != "GBackSolid" && mat_str != "GBackSemiSolid" && mat_str != "GBackLiquid" && mat_str != "GBackSky")
			return -1;
	
	// Optional parameters wdt and hgt.
	if (!wdt)
		wdt = LandscapeWidth() - x - GetX();
	if (!hgt)
		hgt = LandscapeHeight() - y - GetY();

	// Cycle-saving method.
	if (mat != -1)
		while (i < amount)
		{
			// If there's isn't any or not enough of the given material, break before it gets an endless loop.
			if (j++ > 20000)
				return -1;
			// Destinated rectangle.
			rndx = x + Random(wdt);
			rndy = y + Random(hgt);
			// Positioning.
			if (GetMaterial(rndx, rndy) == mat)
			{
				// On-surface option.
				if (onsf)
					while (GBackSemiSolid(rndx, rndy) && rndy >= y)
						rndy--;
				if (rndy < y)
					continue;
				// Create and verify stuckness.
				obj = CreateObjectAbove(id, rndx, rndy + objhgt / 2, NO_OWNER);
				obj->SetR(Random(360));
				if (obj->Stuck() || nostuck)
					i++;
				else
					obj->RemoveObject();
			}
		}

	if (mat == -1)
		while (i < amount)
		{
			// If there's isn't any or not enough of the given material, break before it gets an endless loop.
			if (j++ > 20000)
				return -1;
			// Destinated rectangle.
			rndx = x + Random(wdt);
			rndy = y + Random(hgt);
			// Positioning.
			if (eval(Format("%s(%d,%d)", mat_str, rndx, rndy)))
			{
				// On-surface Option.
				if (onsf)
					while (GBackSemiSolid(rndx, rndy) && rndy >= y)
						rndy--;
				if (rndy < y)
					continue;
				// Create and verify stuckness.
				obj = CreateObjectAbove(id, rndx, rndy + objhgt / 2, NO_OWNER);
				obj->SetR(Random(360));
				if (obj->Stuck() || nostuck)
					i++;
				else
					obj->RemoveObject();
			}
		}

	return j;
}
示例#30
0
文件: Script.c 项目: 772/openclonk
func Initialize()
{

	DrawMaterialQuad("Tunnel",1378,1327-5,1860,1327-5,1860,1330,1387,1330,1);
	for(var i = 1380; i<=1800; i+=28)
		CreateObjectAbove(Dynamite,i,1328);

	Sound("BirdsLoop",true,100,nil,+1);
	Cloud->Place(40);
	
	// Create the parkour goal.
	var goal = CreateObject(Goal_Parkour, 0, 0, NO_OWNER);
	var mode = PARKOUR_CP_Respawn | PARKOUR_CP_Ordered | PARKOUR_CP_Team;
	goal->SetStartpoint(20, 1000);
	goal->AddCheckpoint(760, 950, mode);	
	goal->AddCheckpoint(400, 660, mode);	
	goal->AddCheckpoint(870, 460, mode);	
	goal->AddCheckpoint(1665, 1070, mode);	
	goal->AddCheckpoint(1485, 800, mode);	
	goal->AddCheckpoint(1735, 1410, mode);	
	goal->AddCheckpoint(2110, 1180, mode);
	goal->AddCheckpoint(3350, 1240, mode);	
	goal->AddCheckpoint(3040, 720, mode);
	goal->AddCheckpoint(2530, 520, mode);	
	goal->AddCheckpoint(2150, 510, mode);
	goal->AddCheckpoint(2000, 200, mode);	
	goal->AddCheckpoint(3090, 300, mode);
	var c=goal->AddCheckpoint(1000, 100, mode);
		c->SetCPSize(40);
	var door=CreateObjectAbove(StoneDoor, 135, 60, NO_OWNER);
	door->CloseDoor();
	AddEffect("AutoOpen",door,100,100);
	goal->SetFinishpoint(100, 150, true);
	
	
	//Items
	CreateObjectAbove(Dynamite,1904,878);
	CreateObjectAbove(Dynamite,1905,878);
	CreateObjectAbove(Dynamite,1906,878);
	CreateObjectAbove(Dynamite,2567,918);
	CreateObjectAbove(Dynamite,2568,918);
	CreateObjectAbove(Dynamite,2569,918);
	

	//PlaceEdges();
	Doors();
	Decoration();
	DrawMaterialQuad("Tunnel-brickback",339,687,350,687,350,761,339,761);
	DrawMaterialQuad("Tunnel-brickback",1889,866,1955,866,1955,882,1889,882);
	DrawMaterialQuad("Tunnel-brickback",1920,874,1955,874,1930,1000,1920,1000);
	DrawMaterialQuad("Tunnel-brickback",1920,1000,1930,1000,1970,1100,1960,1100);
	DrawMaterialQuad("Tunnel-brickback",1960,1100,1970,1100,1930,1201,1919,1201);
	
	DrawMaterialQuad("Tunnel-brickback",2549,907,2590,907,2590,920,2549,920);
	DrawMaterialQuad("Tunnel-brickback",2549,920,2560,920,2560,1000,2550,1000);
	DrawMaterialQuad("Tunnel-brickback",2550,1000,2560,1000,2720,1160,2710,1160);
	DrawMaterialQuad("Tunnel-brickback",2710,1160,2720,1160,2710,1190,2700,1190);
	DrawMaterialQuad("Tunnel-brickback",2680,1185,2750,1185,2750,1195,2680,1195);
	DrawMaterialQuad("Tunnel-brickback",2737,1195,2750,1190,2775,1255,2765,1255);
	
	AddEffect("DynamiteEruption",nil,100,130);
	return 1;
}