Example #1
0
func Initialize()
{
	leftcharge = CreateObject(Compensator_ChargeShower, 7 * GetCalcDir(), 10, NO_OWNER);
	leftcharge->Init(this);
	rightcharge = CreateObject(Compensator_ChargeShower, -6 * GetCalcDir(), 10, NO_OWNER);
	rightcharge->Init(this);
	AddTimer("EnergyCheck", 100);
	return _inherited(...);
}
Example #2
0
func RefreshAnimationPosition()
{
	var charge = (power_seconds * 100) / Compensator_max_seconds;
	/*var current = GetAnimationPosition(anim);
	var len = GetAnimationLength("Charge");
	SetAnimationPosition(anim, Anim_Linear(current, current, len - (charge * len) / 100, 35, ANIM_Hold));*/
	leftcharge->To(Min(charge, 50)*2);
	rightcharge->To(Max(0, charge-50)*2);
}	
Example #3
0
func HomeCall()
{
	ClearEffects();
	
	Sound("Ball::ball_call", false, 20);
	
	var eff = AddEffect("HomeCall", this, 1, 1, this);
	eff.x = master->GetX();
	eff.y = master->GetY();
	
	var angle = Angle(GetX(), GetY(), eff.x, eff.y, 10);
	SetVelocity(angle, Speed, 10);
}
Example #4
0
func AttackOrder(x, y)
{
	ClearEffects();

	Sound("Ball::ball_order", false, 20);
		
	var eff = AddEffect("MoveTo", this, 1, 1, this);
	eff.x = master->GetX() + x;
	eff.y = master->GetY() + y;

	var angle = Angle(GetX(), GetY(), eff.x, eff.y, 10);
	SetVelocity(angle, Speed, 10);
}
Example #5
0
func Destruction()
{
	if(partner)
		partner->LoseConnection();
	if(elevator)
		elevator->LostCase();
		
	for(var i = 0; i < 3; ++i)
	{
		var wood = CreateObject(Wood, 0, 0, NO_OWNER);
		wood->Incinerate();
		wood->SetXDir(RandomX(-10, 10));
		wood->SetYDir(RandomX(-2, 0));
	}
}
Example #6
0
func FxFollowMasterTimer(object target, proplist effect, int time)
{
	if(!master)
	{
		KillBall();
		return -1;
	}

	MoveToPos(master->GetX(), master->GetY() - 15);
	
	
	DrawParticleLine("Flash", 0, 0, ox-GetX(), oy-GetY(), 1, 0, 0, 15, followtrailparticles);
	ox=GetX();
	oy=GetY();
}
Example #7
0
func KillBall()
{
	Sound("Ball::ball_die", false, 50);
	if(rangedummy)
		rangedummy->RemoveObject();
	RemoveObject();
}
Example #8
0
func FxParticlesDamage(object target, proplist effect, int damage, int cause)
{
	if(Master)
		Master->GotDamage(damage);
		
	return 0;
}
Example #9
0
func Initialize()
{
	AddEffect("CheckAutoMoveTo", this, 1, 30, this);
	AddEffect("ElevatorUpperLimitCheck", this, 1, 1, this);
	AddEffect("FetchVehicles", this, 1, 10, this);
	
	case_speed = ElevatorCase_move_speed;
	case_speed_automatic = 2 * case_speed;
	
	partner_was_synced = false;
	
	front = CreateObject(Elevator_Case_Front, 0,13, GetOwner());
	back = CreateObject(Elevator_Case_Back, 0,13, GetOwner());
	
	front->SetAction("Attach", this);
	back->SetAction("Attach", this);
}
Example #10
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 #11
0
func Check()
{
	if(!target) return RemoveObject();
  if(!update)
  {
   if(temp > 100)
   {
    Break();
   }
  }
  else
  {
   if(temp > 200)
   {
    Break();
   }
  }
  SetPosition(target->GetX()+55,target->GetY()+40);
  if(target->~IsPegasusGate() && !update)
  {
  	Update();
  }
  return(1);
}
Example #12
0
func EditCursorDeselection(object new_selection)
{
	// If new selection is neither this nor the taget object, ensure target removes any editor markers
	if (cb_obj && new_selection != cb_obj) cb_obj->EditCursorDeselection(new_selection);
	return true;
}
Example #13
0
func OnMoved()
{
	lx = GetX(); ly = GetY();
	if (!cb_obj) return RemoveObject();
	return cb_obj->Call(cb_fn, cb_par, lx, ly);
}
Example #14
0
func Initialize()
{
	SetAction("Travel");
	SetRDir(10);
	SetObjectLayer(nil);
	//AddEffect("MoveTo", this, 1, 1, this);
	
	ox=GetX();
	oy=GetY();
	
	rangedummy = CreateObject(Dummy, 0, 0, GetOwner());
	rangedummy.Visibility = VIS_Owner;
	rangedummy->SetAction("HangOnto", this);
		var props =
		{
			R = 255,
			G = 0,
			B = 0,
			Alpha = 40,
			Size = 70,
			BlitMode = GFX_BLIT_Additive,
			Rotation = PV_Step(10, 0, 1),
			Attach = ATTACH_Back | ATTACH_MoveRelative
			
		};
	rangedummy->CreateParticle("Shockwave2", 0, 0, 0, 0, 0, props, 1);
	
	moveparticle =
	{
		Alpha = 100,
		Size = AttackSize * 2,
		R = pR,
		G = pG,
		B = pB,
		Rotation = PV_Random(0,360),
		BlitMode = GFX_BLIT_Additive,
	};
	
	moveparticle2 =
	{
		Size = PV_Linear(2,0),
		BlitMode = GFX_BLIT_Additive,
		R = pR,
		G = pG,
		B = pB,
		Attach=ATTACH_Back,
	};
	
	movetrailparticles =
	{
		Size = PV_Linear(5,0),
		BlitMode = GFX_BLIT_Additive,
		R = pR,
		G = pG,
		B = pB,
		Attach=ATTACH_Back,
	};
	
	followtrailparticles =
	{
		Size = PV_Linear(5,0),
		BlitMode = GFX_BLIT_Additive,
		R = 50,
		G = 50,
		B = 50,
		Attach=ATTACH_Back,
	};
	
	hometrailparticles =
	{
		Size = PV_Linear(5,0),
		BlitMode = GFX_BLIT_Additive,
		R = 0,
		G = 255,
		B = 255,
		Attach=ATTACH_Back,
	};
	
	hometrailparticles2 =
	{
		Size = PV_Linear(2,0),
		BlitMode = GFX_BLIT_Additive,
		R = 0,
		G = 255,
		B = 255,
		Attach=ATTACH_Back,
	};
	
	
}
Example #15
0
func FxHomeCallTimer(object target, proplist fx, int time)
{
	if(!master)
	{
		KillBall();
		return -1;
	}	
	
	if(GetEffect("Blocked", this))
	{
		ox=GetX();
		oy=GetY();
		return;
	}
	
	DrawParticleLine("Flash", 0, 0, ox-GetX(), oy-GetY(), 1, 0, 0, 15, hometrailparticles);
	
	if(time%7 == 0)
	{
		for(var i = 0; i < 360; i+=5)
		{
			CreateParticle("Flash", Sin(i, 3), -Cos(i, 5), 0, 0, 10, hometrailparticles2, 2);
		}
	}

	fx.x = master->GetX();
	fx.y = master->GetY();
	var angle = Angle(GetX(), GetY(), fx.x, fx.y, 10);
	var txdir = Sin(angle, Speed + 12, 10);
	var tydir = -Cos(angle, Speed + 12, 10);
	SetXDir((GetXDir() + (txdir - GetXDir())/2));
	SetYDir((GetYDir() + (tydir - GetYDir())/2));
	
	CheckForEnemies(HomeCallSize);
	
	ox=GetX();
	oy=GetY();
	
	var dst = Distance(GetX(), GetY(), fx.x, fx.y);
	if(dst < 8)
	{
		AddShield(master);
		Sound("Ball::ball_shield", false, 20);
		
		var particles =
		{
			Prototype = Particles_Glimmer(),
			R = pR,
			G = pG,
			B = pB,
			Alpha = 255,
			Size = PV_Linear(10, 0),
			OnCollision = PC_Bounce(),
		};
		CreateParticle("StarSpark", 0, 0, PV_Random(-60,60), PV_Random(-60, 60), 25, particles, 5);
		
		var particle =
		{
			Alpha = PV_Linear(255, 0),
			Size = 50,
			R = pR,
			G = pG,
			B = pB,
			BlitMode = GFX_BLIT_Additive,
		};
		master->CreateParticle("StarSpark", 0, 0, 0, 0, 7, particle, 4);
		
		FollowMaster();
		return -1;
	}
}