Author Topic: Auto Aiming Missile 1.6  (Read 15328 times)

0 Members and 1 Guest are viewing this topic.

Offline tk

  • Soldier
  • **
  • Posts: 235
Auto Aiming Missile 1.6
« on: November 10, 2008, 04:17:33 pm »
Script Name: Auto Aiming Missile
Script Description: Creates a missile which chases a target.
Original Author(s): tk
Core Version: 2.6.3
Full Description:
Creates a flame missile which chases a given target. Missile is able to dodge near polys.
NOTE: Missile() must be threaded while calling it by AppOnIdle(), uses Sleep() function.

procedure Missile(owner_ID, target_ID: Byte; X, Y: Single);
Parameters: Owner's ID, target's ID, Position of start;








Quote
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;


« Last Edit: July 22, 2009, 07:26:35 am by tk »

Offline BombSki

  • Flagrunner
  • ****
  • Posts: 927
    • Climbing-soldiers.net
Re: Auto Aiming Missile 1.0
« Reply #1 on: November 10, 2008, 04:22:05 pm »
this is very cool, especially ingame.. its also really hard to dodge :)
its a pity that it uses the sleep function due to instability, but i hope it will be used in some scripts

Offline iDante

  • Veteran
  • *****
  • Posts: 1966
Re: Auto Aiming Missile 1.0
« Reply #2 on: November 10, 2008, 04:34:19 pm »
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.

Offline Retro349

  • Major(1)
  • Posts: 10
Re: Auto Aiming Missile 1.0
« Reply #3 on: November 10, 2008, 05:28:46 pm »
This looks really cool!

Know any servers that use this, so I can try it out?

Offline Rampage_Terranius

  • Major
  • *
  • Posts: 69
  • The Strategist
    • Soldat Noob Servers
Re: Auto Aiming Missile 1.0
« Reply #4 on: November 11, 2008, 12:18:55 am »
i had an idea to make something like this as a "special" weapon in a script im making atm it worked a little like this but was really unstable

any way gj and nice script

Offline Mr

  • Inactive Soldat Developer
  • Soldier
  • ******
  • Posts: 166
Re: Auto Aiming Missile 1.0
« Reply #5 on: November 11, 2008, 01:40:06 am »
Awesome... looks really cool. Let's imagine... "CHEATER!111" xD

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Auto Aiming Missile 1.0
« Reply #6 on: November 11, 2008, 04:15:42 am »
This is awesome [retard]
I'm going to use it in my script.

[edit]
But i need to make it shorter.
« Last Edit: November 11, 2008, 04:23:30 am by Gizd »

Offline xmRipper

  • Soldat Beta Team
  • Flagrunner
  • ******
  • Posts: 742
    • Macellan
Re: Auto Aiming Missile 1.0
« Reply #7 on: November 11, 2008, 08:38:54 am »
omg really good job.
CoFounder / CTO @ Macellan
Founder Turkish Soldat Community

Offline Norbo

  • Camper
  • ***
  • Posts: 338
Re: Auto Aiming Missile 1.0
« Reply #8 on: November 11, 2008, 10:49:25 am »
this rocks
finally you got around releasing it tk, after months of hard work and problems (i know because I was brain storming with tk a bit)

Offline dragus

  • Major(1)
  • Posts: 23
Re: Auto Aiming Missile 1.0
« Reply #9 on: November 15, 2008, 06:56:18 am »
what is commends in this scripts

Offline Toumaz

  • Veteran
  • *****
  • Posts: 1906
Re: Auto Aiming Missile 1.0
« Reply #10 on: November 15, 2008, 07:19:40 am »
what is commends in this scripts

Reading helps.

Full Description: In version for admin use the /mss command to launch the missile.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Auto Aiming Missile 1.0
« Reply #11 on: November 15, 2008, 11:52:31 am »
minor tip: "includes.txt" should be "Includes.txt" or it will not work on case-sensitive OSs.
and nice job; probably very difficult to perfect / improve such type things so, i do contratz you.. made me come up with a concept of how to make a path finder for Soldat :P

Offline shantec

  • Soldier
  • **
  • Posts: 140
  • Get ANGREH!!
Re: Auto Aiming Missile 1.0
« Reply #12 on: November 16, 2008, 05:21:06 am »
Damn i love this! Its really hard to dodge..
But only bad thing in this is the "poly dodgin"... with little bit of knowledge and time, it could be improved!
But overall very good!


Edit.
A turret that shoots these, once in 5 (?) seconds :D
« Last Edit: November 17, 2008, 12:35:20 pm by shantec »
Also Known As REIMA


Lol Happles (happy apples)

Offline rayanaga

  • Soldier
  • **
  • Posts: 143
  • ~Fur flying~
    • Kryonex
Re: Auto Aiming Missile 1.0
« Reply #13 on: November 22, 2008, 02:52:37 am »
Wow Dude.
This script is totally insane!!
Great job man!
Love it!
[kY] Kryonex - Your local zombie fanatics.
http://www.kryonex.com/

Offline LORD KILLA

  • Camper
  • ***
  • Posts: 254
  • Happie
Re: Auto Aiming Missile 1.0
« Reply #14 on: December 06, 2008, 03:39:56 am »
WOW!
Can u please make me a ready script of this ?
I tried to add Misslie.pas and the include line to scripts/default foldet but it dont work [if its possible, put it into core.pas]
If i made it wrong putting in default folder, please say me

Offline tk

  • Soldier
  • **
  • Posts: 235
Re: Auto Aiming Missile 1.0
« Reply #15 on: December 06, 2008, 04:10:48 am »
Don't put it into default. You have to put 'missile' folder attached in a zip into your 'scripts' folder.
« Last Edit: December 06, 2008, 04:13:32 am by tk »

Offline LORD KILLA

  • Camper
  • ***
  • Posts: 254
  • Happie
Re: Auto Aiming Missile 1.0
« Reply #16 on: December 06, 2008, 04:16:04 am »
where put Includes ?
And why as zip ?

Offline LORD KILLA

  • Camper
  • ***
  • Posts: 254
  • Happie
Re: Auto Aiming Missile 1.0
« Reply #17 on: December 06, 2008, 04:26:35 am »
 
  • ScriptCore v2.2 loaded! Found 1 scripts...
  • Compiling default -> Core.pas...
  • Compiling default -> NetworkCore.pas...
  • Compiling default -> AdminCore.pas...
  • Compilation Complete. [/tt]

    ->Thats what Console write

Offline LORD KILLA

  • Camper
  • ***
  • Posts: 254
  • Happie
Re: Auto Aiming Missile 1.0
« Reply #18 on: December 06, 2008, 04:31:14 am »
Hey i didnt see u are polish :)
anyway, can u integre it into a weapon, too [Barret- following bullet lol]

Offline tk

  • Soldier
  • **
  • Posts: 235
Re: Auto Aiming Missile 1.0
« Reply #19 on: December 06, 2008, 04:40:40 am »
http://forums.soldat.pl/index.php?topic=21468.0

Drag and drop "missile" folder from archive into your "scripts" folder located in soldatserver directory. You dont have to care about includes.txt. Just put WHOLE missile folder in your scripts folder.

I've made auto aiming law, maybe I'll post it when I fix some things.