46 lines
1.6 KiB
Plaintext
46 lines
1.6 KiB
Plaintext
//: Place RO_LIGHTNINGX wp´s in the area where you want lightning, the X should be an identifying number //:: (1-6 in this case).
|
||
|
||
|
||
|
||
void main()
|
||
{
|
||
object oPc= GetFirstPC();
|
||
int oRandom =d6();//How many random "strikepoints" do you have d4(), d6(), d10(), d100()?
|
||
string oWhich =IntToString(oRandom);
|
||
object oLightning = GetObjectByTag("RO_LIGHTNING" + oWhich);//Gets one of the "strikepoints".
|
||
location oStrike=GetLocation(oLightning);
|
||
if (d6()==1)//How often will the lightning strike?
|
||
{
|
||
int iDirection=d4();
|
||
float fX;
|
||
float fY;
|
||
switch(iDirection)
|
||
{
|
||
case 1:
|
||
fX=0.0;
|
||
fY=15.0;
|
||
break;
|
||
case 2:
|
||
fX=15.0;
|
||
fY=0.0;
|
||
break;
|
||
case 3:
|
||
fX=0.0;
|
||
fY=-15.0;
|
||
break;
|
||
case 4:
|
||
fX=-15.0;
|
||
fY=0.0;
|
||
break;
|
||
}
|
||
vector vStart = GetPosition(oLightning);
|
||
vector vOffset = Vector(fX,fY);
|
||
vector vEndvector=vStart+vOffset;
|
||
location lEnd=Location(GetArea(oLightning),vEndvector,GetFacing(GetFirstPC()));
|
||
effect eGate=EffectVisualEffect(VFX_IMP_LIGHTNING_M);
|
||
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eGate, lEnd, 1.0);
|
||
}
|
||
}
|
||
|
||
|