1 /*--
2 Scroll: Wind
3 Author: Mimmo
4
5 Create a storm to blow away your enemies.
6 --*/
7
8
ControlUse(object pClonk,int ix,int iy)9 public func ControlUse(object pClonk, int ix, int iy)
10 {
11 AddEffect("WindScrollStorm", nil, 100, 1, nil, GetID(), Angle(0,0,ix,iy),pClonk->GetX(), pClonk->GetY(), pClonk->GetOwner());
12 RemoveObject();
13 return 1;
14 }
15
16
17
FxWindScrollStormStart(pTarget,effect,iTemp,angle,x,y,owner)18 public func FxWindScrollStormStart(pTarget, effect, iTemp, angle, x, y, owner)
19 {
20 if(iTemp) return;
21 effect.xdir=Sin(angle,32);
22 effect.ydir=-Cos(angle,32);
23 effect.x=x+Sin(angle,43);
24 effect.y=y-Cos(angle,43);
25 effect.owner=owner;
26
27 effect.particles =
28 {
29 Prototype = Particles_Air(),
30 Size = PV_Random(2, 5)
31 };
32 }
33
FxWindScrollStormTimer(pTarget,effect,iEffectTime)34 public func FxWindScrollStormTimer(pTarget, effect, iEffectTime)
35 {
36 var xdir=effect.xdir;
37 var ydir=effect.ydir;
38 var x=effect.x;
39 var y=effect.y;
40
41 if(iEffectTime<36)
42 {
43 var r=Random(360);
44 var d=Random(40);
45 CreateParticle("Air", Sin(r,d)+x,-Cos(r,d)+y, xdir/3, ydir/3, PV_Random(10, 30), effect.particles, 1);
46 return 1;
47 }
48 else if(iEffectTime<180 )
49 {
50 CreateParticle("Air", PV_Random(x - 20, x + 20), PV_Random(y - 20, y + 20), xdir/2, ydir/2, PV_Random(10, 30), effect.particles, 5);
51
52 for(var obj in FindObjects(Find_Distance(40,x,y),Find_Not(Find_Category(C4D_Structure))))
53 {
54 if(PathFree(x,y,obj->GetX(),obj->GetY()))
55 {
56 if(obj->GetID() == Clonk)
57 obj->SetKiller(effect.owner);
58 if(xdir<0)
59 {if(obj->GetXDir() > xdir) obj->SetXDir(obj->GetXDir(100) + (xdir*3)/2,100); }
60 else
61 {if(obj->GetXDir() < xdir) obj->SetXDir(obj->GetXDir(100) + (xdir*3)/2,100); }
62
63 if(ydir<0)
64 {if(obj->GetYDir() > ydir) obj->SetYDir(obj->GetYDir(100) + (ydir*3)/2,100); }
65 else
66 {if(obj->GetYDir() < ydir) obj->SetYDir(obj->GetYDir(100) + (ydir*3)/2,100); }
67 }
68 }
69 return 1;
70 }
71 return -1;
72
73
74 }
75
76 local Name = "$Name$";
77 local Description = "$Description$";
78 local Collectible = 1;
79