Example #1
0
func Activate()
{
  SetComDir(COMD_Stop(),Contained());
  CreateMenu(NANO,Contained(),0,0,0,0,1);
  AddMenuItem("Selbst Injekzieren","Inject",GetID(Contained()),Contained());
  
  if(FindObject2(Find_Distance(15),Find_Exclude(Contained()),Find_OCF(OCF_Alive())))
  {
   for(next in FindObjects(Find_Distance(15),Find_Exclude(Contained()),Find_OCF(OCF_Alive())))
   {
    AddMenuItem(Format("%s von %s Injekzieren",GetName(next),GetPlayerName(GetOwner(next))),"OtherInject",GetID(next),Contained(),0,next,"Naniten Injekzieren");
   }
   return(1);
  }
  return(1);
}
Example #2
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 #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 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 #5
0
// Gewinnbedingung
//  1: Spieler hat gewonnen
//  0: gewinnen erlaubt wenn am Rand
// -1: kein gewinnen mögliche
func CheckRACEGoal(iPlr)
{
  // In diesem Fall müssen die Spieler das Nest erreichen
  if(FindObject2(Find_ID(DLAR), Find_Distance(50, GetX(GetCursor(iPlr)), GetY(GetCursor(iPlr)))))
      return(1); // Dann hat der Spieler gewonnen
  // Sonst muss er noch weiterspielen
  return(-1);
}
Example #6
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 #7
0
func Timer()
{
	var pDead2, pNewTarget;
	if(!pTarget)
	{
	for(var pDead in FindObjects(Find_Action("Dead"), Find_Distance(100)))
	{
		if(GetPhase(pDead) < 4)
			if(PathFree(GetX(), GetY(), pDead->GetX(), pDead->GetY()))
			{
				pDead2 = pDead;
				break;
			}
	}
	pDead = pDead2;
	if(pDead)
	{
		for(pNewTarget in FindObjects(Find_OCF(OCF_Alive), Find_Distance(100), Find_Hostile(GetOwner(pDead))))
		{
			if(PathFree(GetX(), GetY(), pNewTarget->GetX(), pNewTarget->GetY()))
			{
				iTimer = 0;
				pTarget = pNewTarget;
			}
		}
	}
	}
	if(pTarget)
	{
		iTimer++;
		if(iTimer%10 != 0) return;
		if(iTimer > 100) pTarget = 0;
		else if(!PathFree(GetX(), GetY(), pTarget->GetX(), pTarget->GetY()) && !pTarget->Contained()) pTarget = 0;
		if(!pTarget) return;
		Message("Töte niemanden an diesem heiligen Ort!", this);
		DrawLightning(GetX(),GetY(),pTarget->GetX(), pTarget->GetY());
		Punch(pTarget, 5);
	}
}
Example #8
0
func ActivateMe(object pCaller)
{
	CreateMenu(ASTR, User, 0, 0, "Asgard Teleporter Transponder",0,1);
	if(FindObject2(Find_ID(ASTE),Find_Distance(30,GetX(User)-GetX(),GetY(User)-GetY()),Sort_Distance())) AddMenuItem("Zu Transporter zuordnen", "Choose",  MEPU,User);
	var pTr;
	var i;
	for(pTr in aTrans)
	{
		if(pTr) AddMenuItem(Format("Zu %s beamen",aNames[i]), Format("Start(%d)",i),  MEPU,User);
		if(pTr) AddMenuItem(Format("%s löschen",aNames[i]), Format("Delete(%d)",i),  MEPU,User);
		i++;
	}
}
Example #9
0
func Initialize()
{
	// Setup testing environment: one object for context, a second object at the context object, one object at 0,0
	var ctx = CreateObject(Dummy, 100, 100, NO_OWNER);
	ctx->SetName("ctx");
	var at_origin = CreateObject(Dummy, 0, 0, NO_OWNER);
	at_origin->SetName("at_origin");
	var at_object = CreateObject(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();
}
Example #10
0
func Death()
{
	RemoveTimer(this.UpdateSwim);
	RemoveTimer(this.Activity);
	this.MeshTransformation = Trans_Rotate(160 + Random(41), 1, 0, 0);
	if (base_transform) this.MeshTransformation = Trans_Mul(base_transform, this.MeshTransformation);
	StopAnimation(swim_animation);
	AddTimer(this.Decaying, 500);
	this.Collectible = true;
	
	// maybe respawn a new fish if roe is near
	var roe = FindObject(Find_Distance(200), Find_ID(FishRoe));
	if (roe)
		roe->Hatch(GetID());
	
	return _inherited(...);
}
Example #11
0
func GDOControl(pwget)
{
  var cmp;
  if(cmp = FindObject(Find_Distance(1000),Find_ID(STWA),Sort_Distance()))
  {
   if(cmp.password == pwget)
   {
    Switch();
    return(1);
   }
   else
   {
    Message("Falsches Passwort zur öffnung entfangen:|<c 00ff00>%v</c>",target,pwget);
    Sound("Error");
    return(1);
   }
  }
  return(1);
}
Example #12
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));
}
Example #13
0
public func Hit(a,b,c,d,e,f,g,h)
{
  if(GetID()==1145851719 && !Global(11)) if(Var()=FindObject2(Find_ID(CastC4ID(1145851719)), Find_Distance(5), Find_Exclude(this()))){for(var x=83;x<486;x++)for(var y=189;y<388;y++)if(GetMaterial(x-GetX(),y-GetY())==Material("Acid"))DrawMaterialQuad ("Water",x,y,x,y+1,x+1,y+1,x+1,y,1);return(RemoveObject(Var()),CastParticles("MSpark",20,40,0,0,30,45,GetPlrColorDw(GetController())), Sound("Magic*"), RemoveObject(), Global(11)++); }
  return(_inherited(a,b,c,d,e,f,g,h));
}
Example #14
0
func Initialize()
{
	SetSolidMask();
	if(GBackSolid())
	{
		RemoveObject();
		return 0;
	}
	SetSolidMask(0,0,10,10);
	
	var random = Random(5);
	if(random)
	{
		SetGraphics(Format("%d", random));
	}
	SetR(Random(360));
	SetRDir(2);
	SetAction("Travel");
	AddEffect("Particles", this, 20, 1, this);
	
	for(var o in FindObjects(Find_OCF(OCF_Alive), Find_Distance(10)))
	{
		o->Unstuck();
	}
	
	var smoke = 
	{
		ForceX = PV_Wind(200 - 180),
		DampingX = 900, DampingY = 900,
		Alpha = PV_Linear(255, 0),
		R = 100, G = 100, B = 100,
		Size = PV_Linear(PV_Random(4, 10), PV_Random(20, 30)),
		Phase = PV_Random(0, 15)
	};
	CreateParticle("Smoke", PV_Random(-5,5), PV_Random(-5,5), PV_Random(-15, 15), PV_Random(-15, 15), 30, smoke, 15);
	
	
	sharpflame =
	{
		Size = 10,
		R = 50,
		G = 255,
		B = 50,
		Alpha = 20,
		Rotation = PV_Random(0, 360),
		Phase = PV_Random(0, 5),
		OnCollision = 0,
		BlitMode = GFX_BLIT_Additive,
	};
	
		
	lightning =
	{
		Prototype = Particles_ElectroSpark2(),
		Size = PV_Linear(PV_Random(2,5),0),
		BlitMode = GFX_BLIT_Additive,
		Rotation = PV_Random(0,360),
		R = 50,
		G = 255,
		B = 50,
	};
}
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
func Choose()
{
	aTrans[GetLength(aTrans)] = FindObject2(Find_ID(ASTE),Find_Distance(100,GetX(User)-GetX(),GetY(User)-GetY()),Sort_Distance());
	CallMessageBoard(0,false,"Bitte geben Sie eine passende Beschreibung ein:",GetOwner(User));
}
Example #17
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;
	}
	
}