Ejemplo n.º 1
0
func Initialize()
{
  var iTimeout,pWipf;
  SetGamma(RGB(15,15,15),RGB(118,118,118),RGB(215,215,215));
  SetSkyParallax(0,15,17,0,0,0,0); 
  //Handgemacht... ;)
  Meeresrauschen(170);
  Meeresrauschen(1100);
  Meeresrauschen(2060);
  Meeresrauschen(2900);
  Meeresrauschen(3800);
  Meeresrauschen(4800);
  Meeresrauschen(5700);
  Moewen(900);
  Moewen(2300);
  Moewen(3900);
  Moewen(5000);
  //Nebel platzieren
  for(var i;i<260;++i) 
    CreateParticle("Fog",Random(LandscapeWidth()),Random(LandscapeHeight()*2/3),RandomX(3,9),0,RandomX(1000,1500));
  //Wipfe platzieren
  while(pWipf=FindObject(WIPF,0,0,0,0,0,0,0,0,pWipf)) {
    iTimeout=0;
    while(Stuck(pWipf)||GetMaterial(GetX(pWipf),GetY(pWipf))!=Material("Tunnel")) {
      SetPosition(Random(LandscapeWidth()),RandomX(LandscapeHeight()*2/3,LandscapeHeight()),pWipf);
      if(iTimeout++ > 50000) { RemoveObject(pWipf); break; }
    }
  }  
  ScriptGo(1);
}
Ejemplo n.º 2
0
Archivo: Script.c Proyecto: tyronx/gze
func Initialize() {
	MusicLevel(50);
	
	// We place some extra in-earth objects nearby certain materials for awesome looks
	PlaceObjects2(COAL, 250, [0,0,LandscapeWidth(),LandscapeHeight()], 0, Material("Coal")); // Coal nearby coal 
	PlaceObjects2(FLNT, 80, [0,0,LandscapeWidth(),LandscapeHeight()], 0, Material("Flint"));
	PlaceObjects2(LOAM, 100, [0,0,LandscapeWidth(),LandscapeHeight()], 0, Material("Loam"));
	PlaceObjects2(ORE1, 150, [0,0,LandscapeWidth(),LandscapeHeight()], 0, Material("Ore"));

	return(1);
}
Ejemplo n.º 3
0
func Timer()
{
	if(!Enabled) return();
	DrawParticleLine("MSpark", -10, 0, -10,LandscapeHeight(), 10, 100, RGBa(255,50,50,50), RGBa(255,255,50,100), -10);
	DrawParticleLine("MSpark", 10, 0, 10,LandscapeHeight(), 10, 100, RGBa(255,50,50,50), RGBa(255,255,50,100), -10);
	var pObj;
	for(pObj in FindObjects(Find_InRect(-10,-500,20,LandscapeHeight() + 1000)))
	{
		SetXDir(GetXDir(pObj) * -2,pObj);
		SetYDir(GetYDir(pObj) * -2,pObj);
	}
}
Ejemplo n.º 4
0
global func MaterialDepthCheck(int x, int y, string mat, int depth)
{
	var travelled;
	var xval = x;
	var yval = y;

	//If depth is equal to zero, the function will always measure the depth of the material.
	//If depth is not equal to zero, the function will return true if the material is as deep or deeper than depth (in pixels).
	if (depth == nil)
		depth = LandscapeHeight();

	while (travelled != depth)
	{
		if (GetMaterial(xval, yval) == Material(mat))
		{
			travelled++;
			yval++;
		}
		if (GetMaterial(xval, yval) != Material(mat))
			return travelled; // Returns depth of material.
	}
	if (travelled == depth)
		return true;
	return false;
}
Ejemplo n.º 5
0
func InitializePlayer(int iPlr, int iX, int iY, object pBase, int iTeam)
{
	SetFoW(false,iPlr);
	JoinPlayer(iPlr);
	GetHiRank(iPlr)->SetPosition(LandscapeWidth()/2, LandscapeHeight()/2);
	return;
}
Ejemplo n.º 6
0
func StartGame(array players)
{
	time = 0;
	AddTimer(this.Timer, 30);
	var wdt = LandscapeWidth(), hgt = LandscapeHeight();
	var m = 15; // border margin
	borders = [
		{ x=m,       xl=wdt-2*m, y=0,       yl=0,       d=+1, nx=0,  ny=+1 }, // top
		{ x=wdt-1,   xl=0,       y=m,       yl=hgt-2*m, d=+1, nx=-1, ny=0  }, // right
Ejemplo n.º 7
0
func InitClouds()
{
	for(var i = 0; i < 8; i++)
	{
		var cloud = CreateObject(DecoCloud, Random(LandscapeWidth() + 400) - 200, Random(LandscapeHeight()), -1);
		cloud->SetClrModulation(RGBa(255, 128, 0, 40));
		cloud->SetXDir(RandomX(1, 3));
	}
}
Ejemplo n.º 8
0
func Initialize()
{
  DrawIslands(0,353,415,369);
  DrawIslands(0,722,559,651);
  for(var i=0; i < 60; i++)
    PlaceVegetation(TRE1, 0, 0, LandscapeWidth(), LandscapeHeight(), -1);
  for(var i=0; i < 60; i++)
    PlaceVegetation(TRE2, 0, 0, LandscapeWidth(), LandscapeHeight(), -1);
  for(var i=0; i < 60; i++)
    PlaceVegetation(TRE3, 0, 0, LandscapeWidth(), LandscapeHeight(), -1);
  DoPlaceObjects(LOAM,60,"Earth");
  DoPlaceObjects(CNKT,20,"Earth");
  DoPlaceObjects(WOOD,50,"Earth");
  DoPlaceObjects(ROCK,60,"Earth");
  DoPlaceObjects(FLNT,60,"Earth");
  DoPlaceObjects(METL,50,"Earth");
  DoPlaceAnimal(BIRD, 14);
  return();
}
Ejemplo n.º 9
0
Archivo: Script.c Proyecto: tyronx/gze
func InitializePlayer(player) {
	var x = 20 + Random(LandscapeWidth() - 40);
	
	while(FindObject2(Find_InRect(x-30, 0, 60, LandscapeHeight()), Find_Category (C4D_Structure))) {
		x = Random(LandscapeWidth());
	}
	
	// Find a goot spot
	var miny = (4*LandscapeHeight())/10;
	var spawnpoint = findSpawnPoint(miny);
	
	// Place player and hut there
	var hut = CreateConstruction(HUT2, spawnpoint[0], spawnpoint[1],player,100,1);
	SetPosition(spawnpoint[0] - 5, spawnpoint[1]-8, GetCrew(player,0));
	
	// Amboss drüberklatschen
	hut->CreateObject(ANVL, 17, 23);
	hut->CreateContents(FLAG);
}
Ejemplo n.º 10
0
// always global coordinates, stepping parameter is optional
// e.g. GetYSolid(LandscapeWidth()/2) - finds the Y Coordinate of the first solid pixel in the middle of the landscape
global func GetYSolid(int x, int y, int stepping) {
	if (!stepping) stepping = 1;
	while (!GBackSolid(x - GetX(),y - GetY())) {
		y+=stepping;
		if (y>=LandscapeHeight() || y <= 0) {
			return (-1);
		}
	}
	return(y);
}
Ejemplo n.º 11
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;
}
Ejemplo n.º 12
0
Archivo: Script.c Proyecto: tyronx/gze
func findSpawnPoint(miny) {
	var x,y;
	
	while (true) {
		x = 20 + Random(LandscapeWidth() - 40);
		y = miny;
		
		while (GBackSolid(x, y) && y < LandscapeHeight()) {
			y++;
		}
		y = GetYSolid(x, y);
		
		if (LandscapeHeight() - y < 10) continue;
		if (FindObject2(Find_InRect(x-30, y - 80, 60, 160), Find_Category (C4D_Structure))) continue;
		if (GBackLiquid(x, y-3)) continue;
		
		return [x,y];
	}
	return [];
}
Ejemplo n.º 13
0
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;
}
Ejemplo n.º 14
0
func InitializePlayer(int iPlayer)
{
	_inherited();
	var pClonk;
	if(GetPlayerTeam(iPlayer) == 1)
	{
		pClonk = CreateObject(JAFA,0,0,iPlayer);
		pClonk -> Enter(FindObject(GOEB,0,0,LandscapeWidth(),LandscapeHeight()/2));
		MakeCrewMember(pClonk,iPlayer);
		CreateContents(FLAG,pClonk);
		SetCursor(iPlayer,pClonk);
		pClonk = CreateObject(JAFA,0,0,iPlayer);
		pClonk -> Enter(FindObject(GOEB,0,0,LandscapeWidth(),LandscapeHeight()/2));
		MakeCrewMember(pClonk,iPlayer);
	}
	if(GetPlayerTeam(iPlayer) == 2)
	{
		pClonk = CreateObject(WRAT,0,0,iPlayer);
		pClonk -> Enter(FindObject(GOEB,0,LandscapeHeight()/2,LandscapeWidth(),LandscapeHeight()/2));
		MakeCrewMember(pClonk,iPlayer);
		CreateContents(FLAG,pClonk);
		SetCursor(iPlayer,pClonk);
		pClonk = CreateObject(WRAT,0,0,iPlayer);
		pClonk -> Enter(FindObject(GOEB,0,LandscapeHeight()/2,LandscapeWidth(),LandscapeHeight()/2));
		MakeCrewMember(pClonk,iPlayer);
	}
}
Ejemplo n.º 15
0
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;
	}
}
Ejemplo n.º 16
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;
}
Ejemplo n.º 17
0
private func CheckStuck()
{
  var pClonk,iYChange,iX,iY;
  // Alle feststeckenden Clonks in der Nähe suchen
  for (pClonk in FindObjects(Find_InRect(-20,-20,40,40), Find_OCF(OCF_CrewMember),Find_NoContainer()))
  {
    iX=GetX(pClonk);
    iY=GetY(pClonk);
    while(Stuck(pClonk) && Inside(GetY(pClonk)-GetY(),-20,20))
    {
      if(!(iYChange=BoundBy(GetY(pClonk)-GetY(),-1,1))) iYChange=1;
      // Zur Sicherheit...
      if(!Inside(GetY(pClonk)+iYChange,-100,LandscapeHeight())) break;
      SetPosition(GetX(pClonk),GetY(pClonk)+iYChange,pClonk);
    }
    // verschieben fehlgeschlagen: rückgängig machen
    if(Stuck(pClonk)) SetPosition(iX,iY,pClonk);
  }
}
Ejemplo n.º 18
0
public func Place(int amount, proplist rectangle)
{
	// No calls to objects, only definitions
	if (GetType(this) == C4V_C4Object) return;
	// Default parameters
	if (!amount) amount = 1;
	if (!rectangle) rectangle = Rectangle(0,0, LandscapeWidth(), LandscapeHeight());

	var trees = FindObjects(Find_InRect(rectangle.x, rectangle.y, rectangle.w, rectangle.h), Find_OCF(OCF_Fullcon), Find_Func("IsTree"), Find_Func("IsStanding"));
	var hives = CreateArray(), hive;
	while (amount)
	{
		hive = nil;
		ShuffleArray(trees);
		for (var tree in trees)
		{
			hive = tree->CreateObjectInTreetop(this);
			if (hive) break;
		}
		if (hive)
			hives[GetLength(hives)] = hive;
		amount--;
	}
Ejemplo n.º 19
0
public func Initialize() {
  SetGamma(RGB(0,0,0),RGB(68,68,83),RGB(147,147,173));
  for(var y=0; y<LandscapeHeight(); (y+=510) && (x=0))
	for(var x=0; x<LandscapeWidth(); x+=530)
		ObjectSetAction(CreateObject(_CSN,x,y,-1),Format("Wait%d",Random(4)));
}
Ejemplo n.º 20
0
// 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;
}
Ejemplo n.º 21
0
func GetGameStartPos(int player, int start_index, int max_index) { return {x=Random(LandscapeWidth()-100)+50, y=Random(LandscapeHeight()-100)+50}; }
Ejemplo n.º 22
0
func Moewen()
{
  ObjectSetAction(CreateObject(SL9Z,Par(),LandscapeHeight()/3,-1),"Moewen");
}
Ejemplo n.º 23
0
//Sound-Objekte platzieren
func Meeresrauschen()
{
  ObjectSetAction(CreateObject(SL9Z,Par(),LandscapeHeight()/2,-1),"Meer");
}
Ejemplo n.º 24
0
func Script0()
{
  CreateParticle("Fog",0,Random(LandscapeHeight()*2/3),RandomX(3,9),0,RandomX(1000,1500)); 
}