Example #1
0
/**
Extract liquid from this
@param sznMaterial: Material to extract
@param inMaxAmount: Max Amount of Material being extracted 
@param pnPump: Object which extracts the liquid
@param pnPipe: Pipe which extracts the liquid (connected to pnPump)
@param bnWildcard: Usefull to extract random liquids; use '*' for sznMaterial for all Materials
@return [irMaterial,irAmount]
	-irMaterial: Material being extracted
	-irAmount: Amount being extracted
*/
public func LiquidOutput(string sznMaterial, int inMaxAmount, object pnPump, object pnPipe, bool bnWildcard)
{
	//Search liquid to pump
	if (bnWildcard)
	{
		var ptBarrel = FindObject(Find_Container(this), Find_Func("IsBarrel"), Find_Func("IsBarrelForMaterial", sznMaterial), Find_Not(Find_Func("BarrelIsEmpty")));
		var sztMaterial="";
		if (ptBarrel)
			sztMaterial = ptBarrel->GetBarrelMaterial();
		//Nothing to pump
		if (sztMaterial == "")
			return ["", 0];
		sznMaterial = sztMaterial;
	}
	var itFound = 0;
	for (var ptBarrel in FindObjects(Find_Container(this), Find_Func("IsBarrel"), Find_Func("IsBarrelForMaterial", sznMaterial), Find_Not(Find_Func("BarrelIsEmpty")))) 
	{
		var atFound = ptBarrel->GetLiquid(sznMaterial, inMaxAmount - itFound, this);
		//Crazy stuff happend?
		itFound += BoundBy(atFound[1], 0, inMaxAmount - itFound);
		if (itFound == inMaxAmount)
			break;
	}
	return [sznMaterial, itFound];
}
Example #2
0
protected func Activate(pCaller)
{
  if(FindObject2(Find_Container(pCaller),Find_ID(STBW),Find_Not(Find_Func("HasCell"))))
  {
   ShiftContents(Contained(),0,STBW);
   Enter(FindObject2(Find_Container(pCaller),Find_ID(STBW),Find_Not(Find_Func("HasCell"))));
  }
  return 1;
}
Example #3
0
func CheckForEnemies(Size)
{
	for(var o in FindObjects(Find_Distance(Size), Find_Func("CanBeHit", this)))
	{
		if(o->GetOwner() == GetOwner() || GetEffect("BallHitCD", o))
			continue;
		
		o->AddBallHitEffect();
		o->Fling(0, -2);
		AddEffect("BallHitCD", o, 1, 15);
		
		var trailparticles =
		{
			Prototype = Particles_ElectroSpark2(),
			Size = PV_Linear(PV_Random(5,15),0),
			BlitMode = GFX_BLIT_Additive,
			Rotation = PV_Random(0,360),
			R = pR,
			G = pG,
			B = pB,
		};
		
		CreateParticle("Lightning", o->GetX() - GetX(), o->GetY() - GetY(), 0, 0, 10, trailparticles, 5);
		
		WeaponDamage(o, SpellDamage);
		Sound("Ball::ball_hit", false, 50);
	}
}
Example #4
0
func FxCheckEnemiesTimer(object target, proplist effect, int time)
{
	for(var o in FindObjects(Find_Distance(Size), Find_Not(Find_ID(Hook)), Find_Or(Find_Func("IsReflectable"), Find_Func("CanBeHit", this))))
	{
		if(GetEffect("SawBladeCD", o) || (o->GetOwner() == GetOwner() && time < 15))
		{
			continue;
		}
		
		var angle = Angle(GetX(), GetY(), o->GetX(), o->GetY());
		AddEffect("SawBladeCD", o, 1, 25);
		
		
		if(!o->GetAlive())
		{
			if(o->~IsWallElement())
				continue;
			
			var speed = Distance(0, 0, o->GetXDir(), o->GetYDir());
			o->SetVelocity(angle, speed);
			o->~Blocked(this);
			WeaponDamage(o, SpellDamage);
			
			Sound("Hits::GeneralHit*", false, 50);
			continue;
		}
		
		Sound("Objects::Weapons::WeaponHit*", false, 50);
		o->Fling(Sin(angle, 8), -Cos(angle, 8));
		WeaponDamage(o, SpellDamage);
	}
}
Example #5
0
func Hit()
{
	CastObjects(Flame, RandomX(1,2), RandomX(10,15));
	for(var o in FindObjects(Find_Distance(SpellDamage), Find_Func("CanBeHit", this)))
	{
		o->AddFireHitEffect();
	}
	Explode(SpellDamage);
}
Example #6
0
protected func CheckBorders()
{
	// Prüfen ob ein Objekt gerade aus dem Spielfeld fliegt
	var mapwdt = LandscapeWidth();
	var xdir, xoff, x;
	for (var obj in FindObjects(Find_Func("GetXDir"))) {
		xdir = GetXDir(obj)/10; xoff = obj->GetDefOffset();
		if (xdir < 0) { // Linker Rand
			x = (GetX(obj)+xoff)+xdir;
			if (x <= 0)
				SetPosition(BoundBy(mapwdt+x-xoff, 0, mapwdt+xoff), GetY(obj)+GetYDir(obj)/10, obj, 1);
		}
		else { // Rechter Rand
			x = (GetX(obj)-xoff)+xdir-mapwdt;
			if (x >= 0)
				SetPosition(BoundBy(x+xoff, -xoff, mapwdt), GetY(obj)+GetYDir(obj)/10, obj, 1);
		}
	}
	return 1;
}
Example #7
0
func DoInit(int first_player)
{
	// Test
	//CreateObjectAbove(LiftTower, 178,405, first_player);
	// Set time of day to evening and create some clouds and celestials.
	Cloud->Place(15);
	EnsureObject(Rule_BuyAtFlagpole,0,0,-1);
	SetSkyAdjust(0xff000000);
	var storm = EnsureObject(Storm,0,0,NO_OWNER);
	storm->SetStorm(-20,0,1000);
	SetSkyParallax(1); // move background with the wind
	var time = EnsureObject(Time,0,0,-1);
	time->SetTime(600);
	time->SetCycleSpeed(20);
	// Goal
	CreateObject(Goal_Plane);
	// Plane part restore
	for (var part in FindObjects(Find_Func("IsPlanePart"))) part->AddRestoreMode();
	return true;
}
Example #8
0
func Initialize()
{
	// singleton
	g_storm = this;
	SetPosition();
	// defaults
	storm_particles = 
	{
		Size = 1,
		Stretch = PV_Speed(PV_Linear(4000, 0), 0),
		Alpha = PV_KeyFrames(0, 0, 0, 100, 255, 1000, 255),
		Rotation = PV_Direction(),
		CollisionVertex = 1000,
		OnCollision = PC_Die()
	};
	StormStream = {
		max_segment_stretch = 100, // maximum number of pixels per segment that can be deviated from dir in either direction
		max_segment_stretch_want = 5, // maximum movement back into original position that is preferred (i.e.: speed at which gaps behind sky islands close)
		search_steps = 10,        // steps in pixels in which to search for holes to blow through
		search_steps_mult = 200,  // multiplyer, in percent, by which search steps get larger with each iteration
	};
	find_mask = Find_And(Find_Category(C4D_Vehicle | C4D_Living | C4D_Object), Find_Not(Find_Func("IsEnvironment")));
	SetStorm(20,0, 2000);
}
Example #9
0
/*  Function: Find_Procedure
	FindObject2/FindObjects criteria: Find objects with the given procedure.

	Parameters:
	procedure - The procedure to look for. */
global func Find_Procedure(string procedure) {
	return Find_Func("CompareProdecure", procedure);
}
Example #10
0
func FxFireDashTimer(object target, proplist effect, int time)
{
	var a = effect.angle;
		
	var x = target->GetX();
	var y = target->GetY();
	
	target->SetPosition(target->GetX() + Sin(a, 6, effect.angle_prec), target->GetY() + -Cos(a, 6, effect.angle_prec));

	for(var o in FindObjects(Find_Distance(effect.Size1, x, y), Find_Func("CanBeHit", target)))
	{
		if(o->GetOwner() == target->GetOwner())
			continue;
		if(!GetEffect("DashCD", o))
		{
			o->Fling(0, -5);
			AddEffect("DashCD", o, 20, 10);
			o->AddFireHitEffect();
			target->WeaponDamage(o, effect.SpellDamage1);
		}
		
	}
	
	var chaoticspark =
	{
		Size = PV_Linear(1, 0),
		ForceX = PV_KeyFrames(10, 0, PV_Random(-6, 6), 333, PV_Random(-6, -6), 666, PV_Random(6, 6), 1000, PV_Random(-6, 6)),
		ForceY = PV_KeyFrames(10, 0, PV_Random(-8, 5), 333, PV_Random(-8, 5), 666, PV_Random(-10, 10), 1000, PV_Random(-10, 15)),
		Stretch = PV_Speed(1000, 500),
		Rotation = PV_Direction(),
		CollisionVertex = 0,
		OnCollision = PC_Die(),
		R = 255,
		G = PV_Linear(255,100),
		B = PV_Random(0, 100),
		DampingX=950,
		DampingY=950,
		Alpha = PV_Random(100,180),
		BlitMode = GFX_BLIT_Additive
	};
	CreateParticle("Magic", x + RandomX(-5, 5), y + RandomX(-10, 10), RandomX(25, -25) + target->GetXDir(), RandomX(-25, 12) + target->GetYDir(), 50, chaoticspark, 4);


	var firetrailparticles =
	{
		Prototype = Particles_FireTrail(),
		Size = PV_Linear(effect.Size1,0),
		BlitMode = GFX_BLIT_Additive,
		OnCollision=nil,
	};
	CreateParticle("Fire", x, y, PV_Random(-7,7), PV_Random(-7,7), 20, firetrailparticles, 3);
	
	var dist = Distance(x, y, effect.startx + effect.tx, effect.starty + effect.ty);
	if(dist < 10 || (dist > effect.dist + 1 && time > 10))
	{
		effect.clonk->SetObjectLayer(nil);
		return -1;
	}
	else
	{
		//Log("%d %d", dist, effect.dist);
		effect.dist = dist;
	}
	
}
Example #11
0
func FxFireDashStop(object target, proplist effect, int reason, bool temporary)
{
	if(temporary)
		return;
	
	target->Unstuck();
	target->SetObjectLayer(nil);
	
	target->SetAction("Jump");
	ExplosionEffect(effect.Size2, target->GetX(), target->GetY(),0,0,0);
	
	for(var o in FindObjects(Find_Distance(effect.Size2, target->GetX(), target->GetY()), Find_Func("CanBeHit", target)))
	{
		if(o->GetOwner() == target->GetOwner())
			continue;
			
		var angle = Angle(target->GetX(), target->GetY(), o->GetX(), o->GetY());
		
		o->AddFireHitEffect();
		o->Fling(Sin(angle, 8), -Cos(angle, 8) - 2);
		target->WeaponDamage(o, effect.SpellDamage2);
	}
	
	target->CastObjects(Flame, RandomX(6,8), RandomX(10,25));
	//effect.marker->RemoveObject();
	//effect.clonk->MakeHitable(true);

}
Example #12
0
global func DoInitialize() {
    if(fInitialized) return();
    fInitialized = 1;
    fUseHungerThirst = 1;

    if(!FindObject(NOPC)) CreateObject(NOPC);

    if(fUseHungerThirst) if (!ObjectCount(NDWA)) CreateObject(NDWA, 50,50, -1); // Durst
    if(fUseHungerThirst) if (!ObjectCount(NDFO)) CreateObject(NDFO, 50,50, -1); // Hunger

    if(FindObject(_ETG)) RemoveObject(FindObject(_ETG));
    if(FindObject(REPR)) RemoveObject(FindObject(REPR));
    CreateObject(REPR, 50,50, -1); // Nachwuchs
    if(FindObject(TREP)) RemoveObject(FindObject(TREP));
    CreateObject(TREP, 50,50, -1); // Baumnachwuchs

    // NPC's sollen Position halten
    var i, pObj;
    while(pObj = FindObjectOwner(0,-1,0,0,0,0,OCF_CrewMember,0,0,pObj))
        AddEffect("StayThere",pObj,1,35,pObj);

//  if (!GetPlayerCount()) return();
    // Banditen erstellen
    pObj = CreateObject(BNDT, 3917, 570, -1);
    pObj->SetAI("BanditNoMove", 3);
    pObj->SetColorDw(RGB(150));
    pObj = CreateObject(BNDT, 4120, 560, -1);
    pObj->SetAI("BanditNoMove", 3);
    pObj->SetColorDw(RGB(150));
    pObj = CreateObject(BNDT, 4175, 520, -1);
    pObj->SetAI("BanditNoMove", 3);
    pObj->SetColorDw(RGB(150));
    pObj = CreateObject(BNDT, 4044, 477, -1);
    pObj->SetAI("BanditNoMove", 3);
    pObj->SetColorDw(RGB(150));
    pObj = CreateObject(BNDT, 4309, 471, -1);
    pObj->SetAI("BanditBoss", 3);
    pObj->SetColorDw(RGB(150));
    pObj->MakeBoss();
    pObj->Enter(FindObject(MTNT, 4309, 471, -1, -1));
    // Startmaterial erstellen
    pWagon = CreateObject(COAC, 28, 270, -1);
    pHorse = CreateObject(HORS, 77, 270, -1);
    pHorse->ConnectWagon(pWagon);
    SetDir(1, pWagon);
    SetDir(1, pHorse);

    // Startmaterial
    CreateContents(MEAC,pWagon,6);
    CreateContents(WHKY,pWagon,3);
    for(i=0; i<2; i++) {
        pObj = CreateContents(WSKI, pWagon);
        LocalN("iWater", pObj) = 90;
        pObj->~UpdateGraphics();
    }
    CreateContents(MLLT,pWagon);
    CreateContents(KNFE,pWagon);
    CreateContents(IGNB,pWagon);
    CreateContents(DYNB,pWagon,2);
    CreateContents(METL,pWagon,7);
    CreateContents(WOOD,pWagon,21);
    CreateContents(CNKT,pWagon,4);
    CreateContents(LNKT,pWagon);

    // Höhle muss immer vom  Indianer zu betreten sein!
    FreeRect(1970,589,40,9);

    // Brauchbare Gebäude mit unzerstörbarkeit belegen
    for(pObj in FindObjects(Find_Category(C4D_StaticBack|C4D_Structure|C4D_Vehicle),Find_Not(Find_Category(32768)),Find_InRect(1130,190,300,140)))
        AddEffect("NoDmg",pObj,200);
    for(pObj in FindObjects(Find_Category(C4D_StaticBack|C4D_Structure|C4D_Vehicle),Find_Func("IsIndianHandcraft"),
                            Find_Or(Find_InRect(1830,230,560,340),Find_InRect(3190,160,670,360))))
        AddEffect("NoDmg",pObj,200);

    // Weil die Kanone hier bearbeitet worden ist
    if(pObj = FindObject(CCAN)) pObj->~Initialize();

    if(fTestSection==1) return(ChangeSection("AshCity"));
    if(fTestSection==2) return(ChangeSection("Caves"));

    // ... und los!
    if(!fTesting) ScriptGo(1);
    return(1);
}
Example #13
0
global func GetMarkerForIndex(index, plr)
{
	return FindObject(Find_ID(Marker), Find_Owner(plr), Find_Func("IsIndex", index));
}
Example #14
0
func DoStartSzen()
{

	RemoveAll(TIME);
	CreateObject(DARK,0,0,-1);
	CreateObject(TIME,0,0,-1);

	FindObjects( Find_Func("SetLightOff",1) );
	FindObjects( Find_Func("SetLightOn") );


	giPlrEnemy = 0;
	giPlrFriend = 1;

	gpIntroCandle1 = Object(302);
	gpIntroCandle2 = Object(303);
	gpIntroCandle3 = Object(301);
	gpIntroChandelier = Object(300);
	gpIntroTorch = Object(211);

	gDrawbridge = FindObject(CPT3);

	// Glühwürmchen erstellen

	CreateObject(FFAC, 627, 705, -1);
	CreateObject(FFAC, 1905, 770, -1);
	CreateObject(FFAC, 2170, 745, -1);
	CreateObject(FFAC, 2675, 490, -1);

	// Königin erstellen
	gNPCQueen = CreateObject( _PRC,0,0,giPlrFriend);
	MakeCrewMember( gNPCQueen, giPlrFriend );
	gNPCQueen->SetPosition(40,660);
	gNPCQueen->SetDir(1);
	gNPCQueen->SetName("$NPCQueen$");
	//AttachDialogue(gNPCQueen,"");

	// Hexe erstellen
	gNPCWitch = CreateObject( CLNK,0,0,giPlrFriend );
	MakeCrewMember( gNPCWitch, giPlrFriend );
	gNPCWitch->~SetName("Frau");
	gNPCWitch->~SetPosition(1170,750);
	AttachDialogue(gNPCWitch,"Alvelin");
	CreateContents(TIM1,gNPCWitch); // a dummy such that he does not collect the last barrel after ejecting it
	CreateContents(LAXE,gNPCWitch); // lumberjack's axe for looting the witch

	// Schmied erstellen
	gNPCBlacksmith = CreateObject( CLNK,0,0,giPlrFriend );
	MakeCrewMember( gNPCBlacksmith, giPlrFriend );
	gNPCBlacksmith->~SetName("Heinz");
	gNPCBlacksmith->~SetPosition(1515,770);
	AttachDialogue(gNPCBlacksmith,"Heinz");

	// Erfinder erstellen
	gNPCInventor = CreateObject( CLNK,0,0,giPlrFriend );
	MakeCrewMember( gNPCInventor, giPlrFriend );
	gNPCInventor->~SetName("Ingalf");
	gNPCInventor->SetPosition(865,800);
	AttachDialogue(gNPCInventor,"Ingalf");

	// Bürger erstellen
	gNPCCitizen = CreateObject( CLNK,0,0,giPlrFriend );
	MakeCrewMember( gNPCCitizen, giPlrFriend );
	gNPCCitizen->~SetName("Odilbert");
	gNPCCitizen->SetPosition(1215,750);
	AttachDialogue(gNPCCitizen,"Odilbert");

	// Abenteurer erstellen
	gNPCAdventurer1 = CreateObject( CLNK,0,0,giPlrFriend );
	MakeCrewMember( gNPCAdventurer1, giPlrFriend );
	gNPCAdventurer1->~SetName("Gernot");
	gNPCAdventurer1->SetPosition(2715,495);
	AttachDialogue(gNPCAdventurer1,"Gernot");

	// Abenteurer erstellen
	gNPCAdventurer2 = CreateObject( CLNK,0,0,giPlrFriend );
	MakeCrewMember( gNPCAdventurer2, giPlrFriend );
	gNPCAdventurer2->~SetName("Linnert");
	gNPCAdventurer2->SetPosition(2740,495);
	AttachDialogue(gNPCAdventurer2,"Linnert");

	// Farmer erstellen
	gNPCFarmer = CreateObject( CLNK,0,0,giPlrFriend );
	MakeCrewMember( gNPCFarmer, giPlrFriend );
	gNPCFarmer->~SetName("Armin");
	gNPCFarmer->SetPosition(1840,765);
	AttachDialogue(gNPCFarmer,"Armin");
	AttachDayNightCycle(gNPCFarmer,"Armin");
	CreateContents(TIM1,gNPCFarmer); // a dummy such that he does not collect items

	// Wirtin erstellen
	gNPCInnkeeper = CreateObject( CLNK,0,0,giPlrFriend );
	MakeCrewMember( gNPCInnkeeper, giPlrFriend );
	gNPCInnkeeper->~SetName("Bernika");
	gNPCInnkeeper->SetPosition(1315,750);
	AttachDialogue(gNPCInnkeeper,"Bernika");

	// Dirne erstellen
	gNPCProstitute = CreateObject( CLNK,0,0,giPlrFriend );
	MakeCrewMember( gNPCProstitute, giPlrFriend );
	gNPCProstitute->~SetName("Rovena");
	gNPCProstitute->SetPosition(1435,770);
	AttachDialogue(gNPCProstitute,"Rovena");

	// Wache erstellen
	gNPCGuard1 = CreateObject( CLNK,0,0,giPlrFriend );
	MakeCrewMember( gNPCGuard1, giPlrFriend );
	gNPCGuard1->~SetName("Helmar");
	gNPCGuard1->SetPosition(1615, 769);
	gNPCGuard1->SetDir(1);
	AttachDialogue(gNPCGuard1,"Helmar");

	// Wache erstellen
	gNPCGuard2 = CreateObject( CLNK,0,0,giPlrFriend );
	MakeCrewMember( gNPCGuard2, giPlrFriend );
	gNPCGuard2->~SetName("Eboreus");
	gNPCGuard2->SetPosition(395,690);
	AttachDialogue(gNPCGuard2,"Eboreus");

	// Wache erstellen
	gNPCGuard3 = CreateObject( CLNK,0,0,giPlrFriend );
	MakeCrewMember( gNPCGuard3, giPlrFriend );
	gNPCGuard3->~SetName("Radulf");
	gNPCGuard3->SetPosition(225, 448);
	AttachDialogue(gNPCGuard3,"Radulf");

	// Holzfäller erstellen
	gNPCLumberjack = CreateObject( CLNK,0,0,giPlrFriend );
	MakeCrewMember( gNPCLumberjack, giPlrFriend );
	gNPCLumberjack->~SetName("Answin");
	gNPCLumberjack->SetPosition(2000,755);
	AttachDialogue(gNPCLumberjack,"Answin");

	// Inuk erstellen
	gNPCInuk1 = CreateObject( CLNK,0,0,giPlrFriend );
	MakeCrewMember( gNPCInuk1, giPlrFriend );
	gNPCInuk1->~SetName("Bardrik");
	gNPCInuk1->SetPosition(3685,45);
	AttachDialogue(gNPCInuk1,"Bardrik");

	// Inuk erstellen
	gNPCInuk2 = CreateObject( CLNK,0,0,giPlrFriend );
	MakeCrewMember( gNPCInuk2, giPlrFriend );
	gNPCInuk2->~SetName("Jallik");
	gNPCInuk2->SetPosition(4465,340);
	AttachDialogue(gNPCInuk2,"Jallik");
	// Er hat 3 Fischfässer
	CreateContents(TIM1,gNPCInuk2); // a dummy such that he does not collect the last barrel after ejecting it
	CreateContents(FBRL,gNPCInuk2);
	CreateContents(FBRL,gNPCInuk2);
	CreateContents(FBRL,gNPCInuk2);

	// Magier erstellen
	gNPCCourtmage = CreateObject( MAGE,0,0,giPlrFriend );
	MakeCrewMember( gNPCCourtmage, giPlrFriend );
	gNPCCourtmage->~SetName("Nestor");
	gNPCCourtmage->SetPosition(200,480);
	AttachDialogue(gNPCCourtmage,"Nestor");


	//////////////////////////////////////////////////////////////

	// Bösen Magier erstellen
	gNPCGrandmaster = CreateObject( MAGE,0,0,giPlrEnemy );
	MakeCrewMember( gNPCGrandmaster, giPlrEnemy );
	gNPCGrandmaster->~SetName("OBW");


	//////////////////////////////////////////////////////////////

	// die Könige der KI-Spieler vernichten
	RemoveAll(KING);

	// erstellen
	//gNPC = CreateObject( CLNK,0,0,giPlrFriend );
	//MakeCrewMember( gNPC, giPlrFriend );
	//gNPC->~SetName("");

	CreateQuest("MainQuest");
	CreateQuest("Bandits");
	CreateQuest("MissingLooters");
	CreateQuest("KingsChalice");
	CreateQuest("DeepTreasure");
	CreateQuest("HuskyHunt");
	CreateQuest("Lumberjack");
	CreateQuest("SomethingFishy");
	CreateQuest("Whipped");
	CreateQuest("FunkyBread");
	//GetStory()->~CreateQuests();


	return;
}
Example #15
0
func FxDischargeStop(object target, proplist effect, int reason, bool temporary)
{
	if(temporary)
		return;
		
	Sound("Ball::ball_discharge", false, 70);
		
	var flashparticle =
	{
		Alpha = 100,
		Size = DischargeSize * 2,
		R = pR,
		G = pG,
		B = pB,
		Rotation = PV_Random(0,360),
		BlitMode = GFX_BLIT_Additive,
	};
	CreateParticle("StarSpark", 0, 0, 0, 0, 10, flashparticle, 5);
	
	for(var o in FindObjects(Find_Distance(DischargeSize), Find_Func("CanBeHit", this)))
	{
		var angle = Angle(GetX(), GetY(), o->GetX(), o->GetY());
		o->AddBallHitEffect();
		o->Fling(Sin(angle, 8), -Cos(angle, 8));
		WeaponDamage(o, DischargeDamage);
	}
	
	for(var r = 5; r < DischargeSize; r += 5)
	{
		for(var i = 0; i < 360; i+= 1)
		{
			var props = {
				Size = PV_Linear(4, 0),
				Rotation = PV_Random(0, 360),
			    R = pR,
			    G = pG,
			    B = pB,
			    Alpha = PV_Linear(255,0),
				BlitMode = GFX_BLIT_Additive,
			};
			
			var x = Sin(i, r + RandomX(-2, 2));
			var y = -Cos(i, r + RandomX(-2, 2));
			
			CreateParticle("StarSpark", x, y, 0, 0, 25, props, 2);
		}
	}
	
	var props = {
		Size = PV_Linear(20, 200),
	    R = pR,
	    G = pG,
	    B = pB,
	    Alpha = PV_Linear(180, 0),
		BlitMode = GFX_BLIT_Additive,
	};
	CreateParticle("Shockwave2", 0, 0, 0, 0, 10, props, 1);
	Sound("Ball::ball_after_discharge", false, 30);
	
	Idle();
}
Example #16
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--;
	}