add fire arrow
|
@ -0,0 +1,16 @@
|
|||
[DefCore]
|
||||
id=FireArrow
|
||||
Version=6,0
|
||||
Category=C4D_Object
|
||||
Width=4
|
||||
Height=15
|
||||
Offset=-2,-7
|
||||
Vertices=3
|
||||
VertexY=-6,6,0
|
||||
VertexFriction=120,120,120
|
||||
Value=25
|
||||
Mass=8
|
||||
Components=Wood=3;Firestone=1;Coal=1;
|
||||
Picture=12,0,64,64
|
||||
Rotate=1
|
||||
Float=1
|
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 4.6 KiB |
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
Fire Arrow
|
||||
Same as an arrow but is ignited when being fired. Overloads from the arrow script
|
||||
and implements additional features.
|
||||
|
||||
@author Maikel
|
||||
*/
|
||||
|
||||
#include Arrow
|
||||
|
||||
|
||||
// Callback from the bow: add burning effect to the arrow here.
|
||||
public func Launch(int angle, int str, object shooter)
|
||||
{
|
||||
AddEffect("IntBurning", this, 1, 1, this);
|
||||
// Forward to the arrow for other functionality.
|
||||
return _inherited(angle, str, shooter, ...);
|
||||
}
|
||||
|
||||
|
||||
// Burning effect: takes care of the particles and light radius.
|
||||
public func FxIntBurningStart(object target, proplist effect, int temp)
|
||||
{
|
||||
if (temp)
|
||||
return 1;
|
||||
// The arrow burns for 8 seconds.
|
||||
effect.burn_time = 36 * 8;
|
||||
// Set interval to every frame.
|
||||
effect.Interval = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
public func FxIntBurningTimer(object target, proplist effect, int time)
|
||||
{
|
||||
// Check if burn time already has been exceeded.
|
||||
if (time >= effect.burn_time)
|
||||
{
|
||||
// If the fire arrow is burned up it changes to a normal arrow.
|
||||
ChangeDef(Arrow);
|
||||
// Update picture and set light range to zero in the new arrow.
|
||||
this->UpdatePicture();
|
||||
SetLightRange(0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// In the last second the burning reduces a bit.
|
||||
var burn_level = BoundBy(3 * (effect.burn_time - time), 10, 100);
|
||||
// The rotation of the arrow determines the offset for the particles.
|
||||
var x = Sin(GetR(), 2);
|
||||
var y = -Cos(GetR(), 2);
|
||||
// Fire effects.
|
||||
var particle_fire = Particles_Fire();
|
||||
particle_fire.Size = PV_KeyFrames(0, 0, PV_Random(2, 4), 500, 2, 1000, 0);
|
||||
CreateParticle("Fire", PV_Random(x - 2, x + 2), PV_Random(y - 2, y + 2), PV_Random(-1, 1), PV_Random(-1, 1), 20 + Random(10), particle_fire, burn_level / 30);
|
||||
// Smoke effects.
|
||||
var particle_smoketrail = Particles_SmokeTrail();
|
||||
particle_smoketrail.Size = PV_KeyFrames(0, 0, PV_Random(2, 3), 200, PV_Random(4, 6), 1000, PV_Random(4, 6));
|
||||
particle_smoketrail.ForceY = nil;
|
||||
CreateParticle("Smoke", PV_Random(x - 1, x + 1), PV_Random(y - 1, y + 1), PV_Random(-1, 1), PV_Random(-1, 1), 40 + Random(20), particle_smoketrail, burn_level / 30);
|
||||
var particle_smoke = Particles_Smoke();
|
||||
particle_smoke.Size = PV_Linear(PV_Random(1, 3), PV_Random(2, 4));
|
||||
CreateParticle("Smoke", PV_Random(x - 1, x + 1), PV_Random(y - 1, y + 1), PV_Random(-2, 2), PV_Random(-2, 2), 40 + Random(20), particle_smoke, burn_level / 30);
|
||||
// Light level.
|
||||
SetLightRange(burn_level / 3, burn_level / 3);
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
public func FxIntBurningStop(object target, proplist effect, int reason, bool temp)
|
||||
{
|
||||
if (temp)
|
||||
return 1;
|
||||
// Set light range to zero.
|
||||
SetLightRange(0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Callback from the engine on entering another object.
|
||||
protected func Entrance()
|
||||
{
|
||||
// Remove the burning effect when this object is collected, light range is set to zero automatically.
|
||||
// Collecting the fire arrow fast enough means you can reuse it again.
|
||||
RemoveEffect("IntBurning", this);
|
||||
return _inherited(...);
|
||||
}
|
||||
|
||||
// Callback from the hitcheck effect: incinerate target on impact.
|
||||
public func HitObject(object obj)
|
||||
{
|
||||
// Incinerate object just to the amount where a clonk (ContactIncinerate = 10) won't fully burn.
|
||||
// Hitting the same clonk twice with a fire arrow means it while burn indefinitely.
|
||||
if (obj.ContactIncinerate)
|
||||
obj->Incinerate(BoundBy(140 - 10 * obj.ContactIncinerate + Random(10), 0, 100), GetController());
|
||||
// Additional damage from normal arrow hit.
|
||||
return _inherited(obj, ...);
|
||||
}
|
||||
|
||||
// Determines the arrow strength: only 70% that of the normal arrow.
|
||||
public func ArrowStrength() { return 7; }
|
||||
|
||||
|
||||
/*-- Properties --*/
|
||||
|
||||
local Name = "$Name$";
|
||||
local Description = "$Description$";
|
||||
local Collectible = 1;
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Name=Feuerpfeile
|
||||
Description=Feuerige Munition f<>r den Bogen.
|
|
@ -0,0 +1,2 @@
|
|||
Name=Fire Arrows
|
||||
Description=Fiery ammunition for the bow.
|