malyczolg
19th August 2013, 15:46
//////////////////////////////////////////////////////
//Name: Mortar 3 shoot //
//Developer: czolg //
//Tested by: czolg //
//Scripted by: czolg //
//czolg xf: malyczolg //
//////////////////////////////////////////////////////
mortar3shot()
{
level endon("end_map");
self endon("disconnect");
self endon("killed_player");
self endon("artillery_fired");
self iprintlnbold("^2*^7Pre^9ss ^2[^9F^2] ^7I^9n ^7Bino^9culars ^7T^9o ^7Ma^9rk ^7Fir^9st ^7Sh^9ot ^7O^9f ^7Mort^9ar^2`");
eAttacker = self;
for(;;)
{
self waittill("binocular_fire");
targetPos = GetTargetedPos();
self iprintlnbold("^2*^7Pre^9ss ^2[^9F^2] ^7I^9n ^7Bino^9culars ^7T^9o ^7Ma^9rk ^7Sec^9ond ^7Sh^9ot ^7O^9f ^7Mort^9ar^2`");
playfx (level._effect["czolgfx"], targetPos);
wait 0.5;
if(isDefined(targetPos))
{
self waittill("binocular_fire");
targetPos2 = GetTargetedPos();
self iprintlnbold("^2*^7Pre^9ss ^2[^9F^2] ^7I^9n ^7Bino^9culars ^7T^9o ^7Ma^9rk ^7Thi^9rd ^7Sh^9ot ^7O^9f ^7Mort^9ar^2`");
playfx (level._effect["czolgfx"], targetPos);
playfx (level._effect["czolgfx"], targetPos2);
wait 0.5;
if(isDefined(targetPos2))
{
self waittill("binocular_fire");
targetPos3 = GetTargetedPos();
self iprintlnbold("^2*^7Mort^9ar ^7Inco^9ming^2`");
iprintln("^2^7*^2*^7*^2* ^7Mort^9ar ^7Sho^9oting ^7A^9t ^7Tar^9get ^2*^7*^2*^7*^2*");
playfx (level._effect["czolgfx"], targetPos);
playfx (level._effect["czolgfx"], targetPos2);
playfx (level._effect["czolgfx"], targetPos3);
wait 0.8;
iRange = 300;
vDir = (targetPos);
vDir2 = (targetPos2);
vDir3 = (targetPos3);
players = getentarray("player", "classname");
playfx (level._effect["czolgfx"], targetPos);
playfx (level._effect["czolgfx"], targetPos2);
playfx (level._effect["czolgfx"], targetPos3);
wait 0.8;
playfx (level._effect["czolgfx"], targetPos);
playfx (level._effect["czolgfx"], targetPos2);
playfx (level._effect["czolgfx"], targetPos3);
wait 0.8;
playfx (level._effect["czolgfx"], targetPos);
playfx (level._effect["czolgfx"], targetPos2);
playfx (level._effect["czolgfx"], targetPos3);
wait 0.8;
playfx (level._effect["czolgfx"], targetPos);
playfx (level._effect["czolgfx"], targetPos2);
playfx (level._effect["czolgfx"], targetPos3);
wait 0.8;
playfx (level._effect["czolgmortar"], targetPos);
self thread playSoundAtLocation("mortar_explosion", targetPos, .1 );
earthquake(0.3, 3, targetPos, 850);
for(i = 0; i < players.size; i++)
{
distance = distance(targetPos, players[i].origin);
if((distance > iRange || players[i].sessionstate != "playing" || !isAlive(players[i]) || players[i].pers["team"] == "allies" )) continue;
players[i] thread [[level.callbackPlayerDamage]](eAttacker, eAttacker, 300, 1, "MOD_EXPLOSIVE", "artillery_mp", self.vPoint, vDir, "none", 0);
}
wait 0.1;
playfx (level._effect["czolgmortar"], targetPos2);
self thread playSoundAtLocation("mortar_explosion", targetPos2, .1 );
earthquake(0.3, 3, targetPos2, 850);
for(i = 0; i < players.size; i++)
{
distance = distance(targetPos2, players[i].origin);
if((distance > iRange || players[i].sessionstate != "playing" || !isAlive(players[i]) || players[i].pers["team"] == "allies" )) continue;
players[i] thread [[level.callbackPlayerDamage]](eAttacker, eAttacker, 300, 1, "MOD_EXPLOSIVE", "artillery_mp", self.vPoint, vDir2, "none", 0);
}
wait 0.1;
playfx (level._effect["czolgmortar"], targetPos3);
self thread playSoundAtLocation("mortar_explosion", targetPos3, .1 );
earthquake(0.3, 3, targetPos3, 850);
for(i = 0; i < players.size; i++)
{
distance = distance(targetPos3, players[i].origin);
if((distance > iRange || players[i].sessionstate != "playing" || !isAlive(players[i]) || players[i].pers["team"] == "allies" )) continue;
players[i] thread [[level.callbackPlayerDamage]](eAttacker, eAttacker, 300, 1, "MOD_EXPLOSIVE", "artillery_mp", self.vPoint, vDir3, "none", 0);
}
}
}
break;
}
}
GetTargetedPos()
{
startOrigin = self getEye();
forward = anglesToForward(self getplayerangles());
forward= maps\mp\_utility::vectorScale(forward, 100000);
endOrigin = startOrigin + forward;
trace = bulletTrace(startOrigin, endOrigin, false, self);
if(trace["fraction"] == 1.0 || trace["surfacetype"] == "default")
endOrigin = trace["position"];
else if(trace["fraction"] < 1)
endOrigin = trace["position"];
//iprintln(endOrigin);
return endOrigin;
}
PlaySoundAtLocation(sound, location, iTime)
{
org = spawn("script_model", location);
wait 0.05;
org show();
org playSound(sound);
wait iTime;
org delete();
return;
}
http://www.youtube.com/watch?v=rlt3JH1Izic
//Name: Mortar 3 shoot //
//Developer: czolg //
//Tested by: czolg //
//Scripted by: czolg //
//czolg xf: malyczolg //
//////////////////////////////////////////////////////
mortar3shot()
{
level endon("end_map");
self endon("disconnect");
self endon("killed_player");
self endon("artillery_fired");
self iprintlnbold("^2*^7Pre^9ss ^2[^9F^2] ^7I^9n ^7Bino^9culars ^7T^9o ^7Ma^9rk ^7Fir^9st ^7Sh^9ot ^7O^9f ^7Mort^9ar^2`");
eAttacker = self;
for(;;)
{
self waittill("binocular_fire");
targetPos = GetTargetedPos();
self iprintlnbold("^2*^7Pre^9ss ^2[^9F^2] ^7I^9n ^7Bino^9culars ^7T^9o ^7Ma^9rk ^7Sec^9ond ^7Sh^9ot ^7O^9f ^7Mort^9ar^2`");
playfx (level._effect["czolgfx"], targetPos);
wait 0.5;
if(isDefined(targetPos))
{
self waittill("binocular_fire");
targetPos2 = GetTargetedPos();
self iprintlnbold("^2*^7Pre^9ss ^2[^9F^2] ^7I^9n ^7Bino^9culars ^7T^9o ^7Ma^9rk ^7Thi^9rd ^7Sh^9ot ^7O^9f ^7Mort^9ar^2`");
playfx (level._effect["czolgfx"], targetPos);
playfx (level._effect["czolgfx"], targetPos2);
wait 0.5;
if(isDefined(targetPos2))
{
self waittill("binocular_fire");
targetPos3 = GetTargetedPos();
self iprintlnbold("^2*^7Mort^9ar ^7Inco^9ming^2`");
iprintln("^2^7*^2*^7*^2* ^7Mort^9ar ^7Sho^9oting ^7A^9t ^7Tar^9get ^2*^7*^2*^7*^2*");
playfx (level._effect["czolgfx"], targetPos);
playfx (level._effect["czolgfx"], targetPos2);
playfx (level._effect["czolgfx"], targetPos3);
wait 0.8;
iRange = 300;
vDir = (targetPos);
vDir2 = (targetPos2);
vDir3 = (targetPos3);
players = getentarray("player", "classname");
playfx (level._effect["czolgfx"], targetPos);
playfx (level._effect["czolgfx"], targetPos2);
playfx (level._effect["czolgfx"], targetPos3);
wait 0.8;
playfx (level._effect["czolgfx"], targetPos);
playfx (level._effect["czolgfx"], targetPos2);
playfx (level._effect["czolgfx"], targetPos3);
wait 0.8;
playfx (level._effect["czolgfx"], targetPos);
playfx (level._effect["czolgfx"], targetPos2);
playfx (level._effect["czolgfx"], targetPos3);
wait 0.8;
playfx (level._effect["czolgfx"], targetPos);
playfx (level._effect["czolgfx"], targetPos2);
playfx (level._effect["czolgfx"], targetPos3);
wait 0.8;
playfx (level._effect["czolgmortar"], targetPos);
self thread playSoundAtLocation("mortar_explosion", targetPos, .1 );
earthquake(0.3, 3, targetPos, 850);
for(i = 0; i < players.size; i++)
{
distance = distance(targetPos, players[i].origin);
if((distance > iRange || players[i].sessionstate != "playing" || !isAlive(players[i]) || players[i].pers["team"] == "allies" )) continue;
players[i] thread [[level.callbackPlayerDamage]](eAttacker, eAttacker, 300, 1, "MOD_EXPLOSIVE", "artillery_mp", self.vPoint, vDir, "none", 0);
}
wait 0.1;
playfx (level._effect["czolgmortar"], targetPos2);
self thread playSoundAtLocation("mortar_explosion", targetPos2, .1 );
earthquake(0.3, 3, targetPos2, 850);
for(i = 0; i < players.size; i++)
{
distance = distance(targetPos2, players[i].origin);
if((distance > iRange || players[i].sessionstate != "playing" || !isAlive(players[i]) || players[i].pers["team"] == "allies" )) continue;
players[i] thread [[level.callbackPlayerDamage]](eAttacker, eAttacker, 300, 1, "MOD_EXPLOSIVE", "artillery_mp", self.vPoint, vDir2, "none", 0);
}
wait 0.1;
playfx (level._effect["czolgmortar"], targetPos3);
self thread playSoundAtLocation("mortar_explosion", targetPos3, .1 );
earthquake(0.3, 3, targetPos3, 850);
for(i = 0; i < players.size; i++)
{
distance = distance(targetPos3, players[i].origin);
if((distance > iRange || players[i].sessionstate != "playing" || !isAlive(players[i]) || players[i].pers["team"] == "allies" )) continue;
players[i] thread [[level.callbackPlayerDamage]](eAttacker, eAttacker, 300, 1, "MOD_EXPLOSIVE", "artillery_mp", self.vPoint, vDir3, "none", 0);
}
}
}
break;
}
}
GetTargetedPos()
{
startOrigin = self getEye();
forward = anglesToForward(self getplayerangles());
forward= maps\mp\_utility::vectorScale(forward, 100000);
endOrigin = startOrigin + forward;
trace = bulletTrace(startOrigin, endOrigin, false, self);
if(trace["fraction"] == 1.0 || trace["surfacetype"] == "default")
endOrigin = trace["position"];
else if(trace["fraction"] < 1)
endOrigin = trace["position"];
//iprintln(endOrigin);
return endOrigin;
}
PlaySoundAtLocation(sound, location, iTime)
{
org = spawn("script_model", location);
wait 0.05;
org show();
org playSound(sound);
wait iTime;
org delete();
return;
}
http://www.youtube.com/watch?v=rlt3JH1Izic