const
rocketFuel = 45; // default 45;
accuracy = 40; //0 - the best accuracy, default 40;
acceleration = 3; // default 3;
flametraceMovement = 2; // default 2;
procedure nova(X,Y,dir_x,dir_y,r,speed,power: single; n: word; style, id: byte);
var
angle,sine,cosine: single;
begin
angle:=6.28318/n;
for n:=n downto 1 do
begin
sine:=sin(angle*n);
cosine:=cos(angle*n);
CreateBullet(cosine*r + X, sine*r + Y,cosine*speed + dir_x,sine*speed + dir_y,power, style, ID);
end;
end;
procedure Missile(owner_ID, target_ID: Byte; X, Y: Single);
{v. 1.6}
var
poly_coll, target_coll: Boolean;
n, interval: Word;
X2, Y2, dist, next_dist_x, next_dist_y, prev_dist_x, prev_dist_y, rd: Single;
begin
GetPlayerXY(target_ID,X2,Y2);
dist:=Distance(X,Y,X2,Y2);
next_dist_x:=(X2-X)/(dist/10);
next_dist_y:=(Y2-Y)/(dist/10);
X:=X + next_dist_x;
Y:=Y + next_dist_y;
prev_dist_x:=next_dist_x;
prev_dist_y:=next_dist_y;
interval:=40;
while n < rocketFuel do
begin
Sleep(interval);
next_dist_x:=((X2-X)/(dist/(20+accuracy*2))+prev_dist_x*accuracy) / (accuracy+1);
next_dist_y:=((Y2-Y)/(dist/(24+accuracy*2))+prev_dist_y*accuracy) / (accuracy+1);
prev_dist_x:=next_dist_x;
prev_dist_y:=next_dist_y;
X:=X + next_dist_x;
Y:=Y + next_dist_y;
GetPlayerXY(target_ID,X2,Y2);
dist:=Distance(X,Y,X2,Y2);
if dist > 80 then //poly dodging
begin
if not rayCast(X,Y,X+15,Y,rd,16) then X:=X - 15 else
if not rayCast(X,Y,X-15,Y,rd,16) then X:=X + 15;
if not rayCast(X,Y,X,Y+18,rd,19) then Y:=Y - 18 else
if not rayCast(X,Y,X,Y-18,rd,19) then Y:=Y + 18;
end;
if dist < 25 then //check for collision
begin
target_coll:=true;
break;
end else
if not RayCast(X,Y,X,Y,rd,1) then
begin
poly_coll:=true;
break;
end;
if dist > 10*flametraceMovement then //create one flame
CreateBullet(X, Y, next_dist_x/10*flametraceMovement, next_dist_y/10*flametraceMovement, 0, 5, owner_ID);
if interval > 9 then
interval:=interval-acceleration; //acceleration
n:=n+1;
end;
if target_coll then //collision with target
begin
DoDamageBy(target_ID, owner_ID, GetPlayerStat(target_ID, 'health')-1);
nova(X,Y,next_dist_x/2,next_dist_y/2,20,5,2,7,14,owner_ID);
nova(X2,Y2,0,0,30,8,2,9,14,owner_ID);
nova(X2,Y2,0,0,12,-3,10,5,4,owner_ID);
end else
if poly_coll then //collision with poly
begin
nova(X,Y,next_dist_x/2,next_dist_y/2,20,5,2,7,14,owner_ID);
nova(X,Y,0,0,20,-3,10,4,4,owner_ID);
end else
begin //no fuel
nova(X,Y,next_dist_x/3,next_dist_y/2,20,5,2,7,14,owner_ID);
CreateBullet(X, Y, next_dist_x/2, next_dist_x/3, 10, 4, owner_ID);
end;
end;
what is commends in this scripts
Full Description: In version for admin use the /mss command to launch the missile.
what is commends in this scripts
Reading helps.Full Description: In version for admin use the /mss command to launch the missile.
I must have just skipped over it lol. The download link wont work for meMaybe because THERE ISN'T...
Hehe I made something very similar to this once.
What would be awesome would be mod-ing say, the law or something to shoot this kind of thing.
It's scriptable. :) Would require you to change LAW to something that doesn't shoot at all (or shots very slow, non-damaging bullets), so it would be "blank" weapon. Then you should add something like this (pseudocode):Hehe I made something very similar to this once.
What would be awesome would be mod-ing say, the law or something to shoot this kind of thing.
GROM (Missile launcher) anyone?
Love it!
[inside apponidle]
for i := 1 to 32 do if getplayerstat(i, 'active') then
if (getplayerstat(i, 'primary') = 14) and (getkeypress(i, 'shoot')) // i'm not sure if LAW is #14
and ((getkeypress(i, 'prone')) or (getkeypress(i, 'crouch'))) // players need to crouch to shoot, delete this line to allow shooting while standing
then [shoot the missile]
It would need some reload restrictions, like setting the timer to 10 seconds after shooting or checking for LAW's reload.if victim = shooter then
if GetPlayerStat(shooter,'Primary') = 16 then{ i think law is 16}
if GetPlayerStat(shooter,'Ammo') = 0 then { player has shot }
if (getkeypress(shooter, 'prone')) or (getkeypress(shooter, 'crouch') then begin
target:=NearestTarget(...);
if target = 0 then exit;
Missile(shooter, target, GetPlayerStat(shooter,'x'), GetPlayerStat(shooter,'y'));
// or the second possibility
ThreadFunc([shooter, target, GetPlayerStat(shooter,'x'), GetPlayerStat(shooter,'y')],'Missile');
end;
function OnCommand(ID: Byte; Text: string): boolean;
begin
if GetPiece(Text,' ',0) = '/aim' then begin
Missile(
ID,
GetPlayerStat(strtoint(GetPiece(Text,' ',1)), 'ID'),
GetPlayerStat(strtoint(GetPiece(Text,' ',1)), 'X'),
GetPlayerStat(strtoint(GetPiece(Text,' ',1)), 'Y'),
);
end;
Result := false;
end;
But I keep on getting syntax errors...
function lookForTarget(ID: byte; MinDistance, MaxDistance: integer; UsingRaycast: boolean): byte;
var
i,Team: byte; X,Y,X2,Y2,sqrdist,maxdist: single;
begin
GetPlayerXY(ID,X,Y);
maxdist:=MaxDistance*MaxDistance;
Result:=0;
Team := GetPlayerStat(ID, 'Team');
for i:=1 to 32 do
if i <> ID then
if GetPlayerStat(i, 'Active') then
if GetPlayerStat(i, 'Alive') then
if GetPlayerStat(i, 'team') <> Team then
begin
GetPlayerXY(i,X2,Y2);
if UsingRayCast then
if not RayCast(X,Y-7,X2,Y2-7,sqrdist,MaxDistance+1) then continue;
X2:=X2-X; Y2:=Y2-Y; sqrdist:=X2*X2+Y2*Y2;
if (sqrdist < maxdist) and (sqrdist >= MinDistance) then
begin
Result:=i;
maxdist:=sqrdist;
end;
end;
end;
function OnCommand(ID: Byte; Text: string): boolean;
var x, y: single; target: byte;
begin
if Text = '/aim' then begin
target := lookForTarget(ID, 0, 700, true);
if target > 0 then begin
GetPlayerXY(ID, x, y);
Missile(ID, target, x, y);
end;
end;
Result := false;
end;
How can I test this script? I mean I don't have a server.You don't need rent a server. Just download the latest dedicated server from soldat.pl , then you can test.
the script doesnt work for me too somehowDid you put an enemy bot for missile?
i have tried the command /aim but nothing happend
LOL, duds i'm new to scripts to and I still cann't use this. I put the missile folder in the script folder and went in the sever press /(as a command) then typed /aim shot my law and the missile from the law did NOTHING. Please help. :-\ BTW I'm testing it.have you enabled scripting?
:3Warned