#1 24-12-2009 07:03

VcSaJen
Registered: 25-08-2006
Posts: 217

Автоматическая туррель

Скрипт минигана, который стреляет сам по полицейским (в первую очередь) и по машинам, вертолётам, пешеходам. Поставить автоминиган - клавиша M.
Миниган разворачивается плавно.
Недостаток - подтормаживание, если прохожих нет поблизости.
На всякий случай скажу, что этот скрипт был написан мной 31 октября 2008 г., 16:11:18.

{$CLEO}

const
  MINIGUN_BASE = 2985
  ACTIVATION_KEY = 0x4D //VK_M
  DAMAGE_1BULLET = 100
  TIME_BETWEEN_SHOTS = 0
end

var
  $PLAYER_ACTOR: Actor
  $PLAYER_CHAR: Player
  0@: Object
  1@: Float
  2@: Float
  3@: Float
  4@: Float
  5@: Float
  6@: Float
  7@: Float
  8@: Float
  9@: Float
  18@: Float
  19@: Float
end
0000:
:loop

while true
  if $PLAYER_CHAR.Defined
  then
    if and 
      0AB0:  key_pressed ACTIVATION_KEY
      $PLAYER_CHAR.Controllable
      not $PLAYER_ACTOR.Driving
      $PLAYER_CHAR.Money > 499999
      $ONMISSION == 0
    then
      $PLAYER_CHAR.Money += -500000
//      $PLAYER_CHAR.WantedLevel = 6
      04C4: store_coords_to 1@ 2@ 3@ from_actor $PLAYER_ACTOR with_offset 0.0 2.0 -1.0
//      02CE: 3@ = ground_z_at 1@ 2@ 3@
      3@-=1.5
      0@ = Object.Create(MINIGUN_BASE, 1@, 2@, 3@)
      7@ = $PLAYER_ACTOR.Angle
      7@ += 90.0
      0@.Angle = 7@
      {02F6: 18@ = sine 7@ // (float) 
      02F7: 19@ = cosine 7@ // (float)
      18@+=1@
      19@+=2@}
      7@ -= 90.0        
      3@+=1.5
      066E: create_particle "gunsmoke" attached_to_object 0@ with_offset 0.95 0.0 1.089 rotation 90.0 0.0 0.0 flag 0 handle_as 11@ 
//      066E: create_particle "prt_gunshell" attached_to_object 0@ with_offset 0.141034 -0.0554999 1.1 rotation 0.0 100.0 90.0 flag 0 handle_as 12@ 
      
      Camera.SetBehindPlayer
      $PLAYER_CHAR.CanMove = false
      04EB: AS_actor $PLAYER_ACTOR crouch 1 
      while 834E:   not move_object 0@ to 1@ 2@ 3@ speed 0.0 0.0 0.05 flag 0 
        wait 0
      end
      04EB: AS_actor $PLAYER_ACTOR crouch 0
      $PLAYER_CHAR.CanMove = true
      0400: store_coords_to 1@ 2@ 3@ from_object 0@ with_offset 1.2 0.0 1.087
      18@=1@
      19@=2@     
      while true
        0400: store_coords_to 4@ 5@ 6@ from_object 0@ with_offset 100.2 0.0 1.087  
    
        0A8D: 12@ = read_memory 0x00C1C964 size 4 virtual_protect 0
        if
          12@ > 0
        then
          // ищем вертолет
          0A8D: 13@ = read_memory 0x00B74494 size 4 virtual_protect 0
          0AA8: call_function_method 0x00424160 struct 13@ num_params 1 pop 0 12@ 13@
          if 0185:   car 13@ health >= 250
          then
            Car.StorePos(13@, 4@, 5@, 6@)
            050A: 14@ = distance_between_XYZ 1@ 2@ 3@ and_XYZ 4@ 5@ 6@ 
            if and 
              14@ <= 75.0
              06BD: no_obstacles_between 1@ 2@ 3@ and 4@ 5@ 6@ solid 1 car 0 actor 0 object 0 particle 0 
            then
              jump @Shoot
            end
          end
        end
        0A8D: 12@ = read_memory 0x00C1C968 size 4 virtual_protect 0
        if
          12@ > 0
        then
          // ищем вертолет
          0A8D: 13@ = read_memory 0x00B74494 size 4 virtual_protect 0
          0AA8: call_function_method 0x00424160 struct 13@ num_params 1 pop 0 12@ 13@
          if 0185:   car 13@ health >= 250
          then
            Car.StorePos(13@, 4@, 5@, 6@)
            050A: 14@ = distance_between_XYZ 1@ 2@ 3@ and_XYZ 4@ 5@ 6@ 
            if and 
              14@ <= 75.0
              06BD: no_obstacles_between 1@ 2@ 3@ and 4@ 5@ 6@ solid 1 car 0 actor 0 object 0 particle 0
            then
              jump @Shoot
            end
          end
        end
        //08E5: get_actor_in_sphere 1@ 2@ 3@ radius 50.0 handle_as 10@
        
        
        //0AB1: call_scm_func @Func 1 0@
        
        
        if not Actor.Dead(10@)
        then
          Actor.StorePos(10@, 4@, 5@, 6@)
          050A: 14@ = distance_between_XYZ 1@ 2@ 3@ and_XYZ 4@ 5@ 6@ 
        end
        if or 
          Actor.Dead(10@)
          14@>60.0
          32@>=7000
        then
          32@=0
          0AB1: call_scm_func @FUNC_GETPOLICEACTOR 7 1@ 2@ 3@ 60.0 1@ 2@ 3@  10@
          if 10@<0
          then
            0AB1: call_scm_func @FUNC_GETBANDITACTOR 7 1@ 2@ 3@ 60.0 1@ 2@ 3@  10@
            if 10@<0
            then
              0AB1: call_scm_func @FUNC_GETACTOR 7 1@ 2@ 3@ 60.0 1@ 2@ 3@  10@
              
              if 10@<0
              then
                wait 500
              end
            end
          end
        end
  //      073F: get_actor_in_sphere 1@ 2@ 3@ radius 50.0 with_pedtype_civilian 1 gang 1 criminal/prostitute 1 handle_as 10@ 
  //      0A3E: unknown_get_actor_in_sphere 1@ 2@ 3@ radius 50.0 50.0 5.0 handle_as 10@ 
  //      0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 30@ closest_ped_to 10@
  
        if and 
          10@ > 0
          not Actor.Dead(10@)
          //86EE:   not actor 10@ in_group $PLAYER_GROUP 
        then
          Actor.StorePos(10@, 4@, 5@, 6@)
          //Actor.RemoveReferences(10@)          
          jump @Shoot
//          064C: make_particle 12@ visible 
        end    
        :checks 
        if or 
          0AB0:  key_pressed ACTIVATION_KEY
          not $PLAYER_CHAR.Defined
          $ONMISSION == 1
          89E7: not player $PLAYER_CHAR not_frozen 
        then
          Break
        end
        0@.StorePos(20@, 21@, 22@)
        0@.StorePos(23@, 24@, 25@)
        20@-=2.5
        21@-=2.5
        22@-=2.5
        23@+=2.5
        24@+=2.5
        25@+=2.5
        if 0356:   explosion_type -1 in_cube_cornerA 20@ 21@ 22@ cornerB 23@ 24@ 25@ 
        then
          jump @damage
        end
        wait TIME_BETWEEN_SHOTS
      end
      0@.Destroy
      0650: destroy_particle 11@
//      0650: destroy_particle 12@ 
    end
  end
  wait 0
end

{:Func
0400: store_coords_to 1@ 2@ 3@ from_object 0@ with_offset 1.2 0.5 0.587
0400: store_coords_to 4@ 5@ 6@ from_object 0@ with_offset 1.2 -0.5 1.587
03E6: remove_text_box 
if 05FC: actor $PLAYER_ACTOR in_cube_fll_corner_at 1@ 2@ 3@ fur_corner_at 4@ 5@ 6@ depth 50.0 flag 0
then
  0513: show_text_box_1number 'NUMBER' number 777
end
0AB2: ret 0}

:Shoot
  0AB1: call_scm_func @RotateObjectAtPoint 5 0@ 18@ 19@ 4@ 5@
  18@=4@
  19@=5@
  0400: store_coords_to 1@ 2@ 3@ from_object 0@ with_offset 0.95 0.0 1.087     
  7@ = Random(-0.5, 0.5)
  8@ = Random(-0.5, 0.5)
  9@ = Random(-0.5, 0.5)
  4@+=7@
  5@+=8@
  6@+=9@
  //$PLAYER_ACTOR.SetImmunities(1,0,0,0,0)      
  06BC: create_M4_shoot_from 1@ 2@ 3@ target 4@ 5@ 6@ energy DAMAGE_1BULLET
  //$PLAYER_ACTOR.SetImmunities(0,0,0,0,0)
  064C: make_particle 11@ visible
jump @checks


:damage
0@.StorePos(20@, 21@, 22@)
02CF: 26@ = create_fire_at 20@ 21@ 22@ propagation 0 size 2
0@.ToggleInMovingList = true 
wait 5000
020C: create_explosion_with_radius 12 at 20@ 21@ 22@
0@.Throw(0.0, 0.0, 10.0)
05A2: set_object 0@ rotation_velocity_about_an_axis 0.0 5.0 0.0 through_center_of_mass
wait 500
0@.StorePos(20@, 21@, 22@)
02D1: remove_fire 26@ 
020C: create_explosion_with_radius 0 at 20@ 21@ 22@ 
020C: create_explosion_with_radius 5 at 20@ 21@ 22@ 
0@.Destroy
0650: destroy_particle 11@
//0650: destroy_particle 12@ 
jump @loop

:DrawFloat
008C: 4@ = float_to_integer 0@
008C: 5@ = float_to_integer 0@
5@ *= 1000
0@ *= 1000.0
008C: 0@ = float_to_integer 0@      
0062: 0@ -= 5@
0095: abs( 0@ ) 
gosub @TextDrawText2Settings
045B: text_draw_2numbers 1@ 2@ '_NUM_F' 4@ 0@
0AB2: ret 0

:TextDrawTextSettings
0348: set_text_draw_proportional 1 
033F: set_text_draw_letter_width_to 0.3 height_to 1.0 
0349: set_text_draw_style_to 1 
081C: draw_text_outline 1 0 0 0 255
//081C: draw_text_outline 0 0 0 0 0
0340: set_text_draw_color_RGB_mask_to 0x12 0xFF 0 200
0343: set_text_draw_linewidth 640.0
return

:TextDrawText2Settings
0348: set_text_draw_proportional 1 
033F: set_text_draw_letter_width_to 0.3 height_to 1.0 
0349: set_text_draw_style_to 1 
081C: draw_text_outline 1 0 0 0 255
0340: set_text_draw_color_RGB_mask_to 0xFC 0xFF 0 200
0343: set_text_draw_linewidth 640.0 
return

:RotateObjectAtPoint{In_Object,In_XY_Float}
var
  0@:Object
  1@:Float//OldX
  2@:Float//OldY
  3@:Float//NewX
  4@:Float//NewY
  5@:Float
  6@:Float
  7@:Float
  8@:Float
  9@:Float
  10@:Float
  11@:Float
  12@:Float
  
  13@:Float
  14@:Float
end
Object.StorePos(0@, 13@, 14@, 15@)
1@-=13@
2@-=14@
3@-=13@
4@-=14@
0509: 5@ = distance_between_XY 0.0 0.0 and_XY 1@ 2@
1@/=5@
2@/=5@
0509: 5@ = distance_between_XY 0.0 0.0 and_XY 3@ 4@
3@/=5@
4@/=5@

6@=3@
7@=4@
6@-=1@
7@-=2@
0509: 5@ = distance_between_XY 0.0 0.0 and_XY 6@ 7@
6@/=5@
7@/=5@
6@*=0.05
7@*=0.05
while true
  1@+=6@
  2@+=7@
  8@=1@
  9@=2@
  8@-=3@
  9@-=4@
  0097: make 8@ absolute_float
  0097: make 9@ absolute_float 
  if and
    8@<=0.06
    9@<=0.06
  then
    Break
  end
  0604: Arctan2( 1@ , 2@ ) store_to 30@
  30@+=90.0
  Object.Angle(0@) = 30@
  wait 0
end
0604: Arctan2( 3@ , 4@ ) store_to 30@
30@+=90.0
Object.Angle(0@) = 30@
0AB2: ret 0




:debug
03F0: enable_text_draw 1
0AB1: @DrawFloat 3 pars fnumber 10@ coords 69.0 200.0
0AB1: @DrawFloat 3 pars fnumber 11@ coords 69.0 210.0
return

{
    The Interceptor 1.1
       
    by PLPynton and Seemann    

    Parameters:
    0@ - input coord X
    1@ - input coord Y
    2@ - input coord Z
    3@ - search radius

    variables 4@..16@ in use
    
    9@ = Result (returns -1 if not found)
           
}
jump @Interceptor_end

:FUNC_GETACTOR
0087: 17@ = 4@ // (float)
0087: 18@ = 5@ // (float)
0087: 19@ = 6@ // (float)
gosub @AIC_GETACTOR
0AB2: ret 1 9@

:FUNC_GETPOLICEACTOR
0087: 17@ = 4@ // (float)
0087: 18@ = 5@ // (float)
0087: 19@ = 6@ // (float)
gosub @AIC_GETPOLICEACTOR
0AB2: ret 1 9@

:FUNC_GETBANDITACTOR
0087: 17@ = 4@ // (float)
0087: 18@ = 5@ // (float)
0087: 19@ = 6@ // (float)
gosub @AIC_GETBANDITACTOR
0AB2: ret 1 9@

:FUNC_GETVEHICLE
gosub @AIC_GETVEHICLE
0AB2: ret 1 9@

:FUNC_GETOBJECT
gosub @AIC_GETOBJECT
0AB2: ret 1 9@

:AIC_GETPOLICEACTOR
0006: 16@ = 305868
0006: 5@ = @AIC_TESTPOLICEACTORHANDLE
0006: 6@ = 1988
0002: jump @AIC_STARTSEARCH

:AIC_GETBANDITACTOR
0006: 16@ = 305868
0006: 5@ = @AIC_TESTBANDITACTORHANDLE
0006: 6@ = 1988
0002: jump @AIC_STARTSEARCH 

:AIC_GETACTOR
0006: 16@ = 305868
0006: 5@ = @AIC_TESTACTORHANDLE
0006: 6@ = 1988
0002: jump @AIC_STARTSEARCH 

:AIC_GETVEHICLE
0006: 16@ = 305869
0006: 5@ = @AIC_TESTVEHICLEHANDLE
0006: 6@ = 2584
0006: 8@ = -1
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @AIC_STARTSEARCH 
00DF:   actor $PLAYER_ACTOR driving
004D: jump_if_false @AIC_STARTSEARCH
03C0: 8@ = actor $PLAYER_ACTOR car
0002: jump @AIC_STARTSEARCH

:AIC_GETOBJECT
0006: 16@ = 305871
0006: 5@ = @AIC_TESTOBJECTHANDLE
0006: 6@ = 412

:AIC_STARTSEARCH
008B: 16@ = &0(16@,1i) // CPool*
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 16@ + 8 )^ = 7@  // CPool.Size
0A8D: 11@ = read_memory 16@ size 4 virtual_protect 0        // CPool.pUnits
0006: 9@ = -1 
0006: 10@ = 0

:AIC_SEARCHLOOPMAIN
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 11@ + 20 )^ = 4@  // xyz*
8039:   not  4@ == 0 
004D: jump_if_false @AIC_SEARCHLOOPNEXT 
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 4@ + 48 )^ = 12@  // x
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 4@ + 52 )^ = 13@  // y
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 4@ + 56 )^ = 14@  // z
050A: 15@ = distance_between_XYZ 0@ 1@ 2@ and_XYZ 12@ 13@ 14@ 
0025:   3@ > 15@ // (float) 
004D: jump_if_false @AIC_SEARCHLOOPNEXT 
0085: 9@ = 10@ // (int) // counter
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 16@ + 4 )^ = 4@ // CPool.flags
005A: 4@ += 9@ // (int) 
0A8D: 4@ = read_memory 4@ size 1 virtual_protect 0 
0012: 9@ *= 256 
005A: 9@ += 4@ // (int)
0002: jump 5@

:AIC_TESTVEHICLEHANDLE
056E:   is 9@ valid_vehicle_handle
004D: jump_if_false @AIC_NOHANDLE
00D6: if or
003B:   8@ == 9@ // (int) 
0119:   car 9@ wrecked 
004D: jump_if_false @AIC_NEWSEARCHRADIUS
0002: jump @AIC_NOHANDLE

:AIC_TESTACTORHANDLE
056D:   is 9@ valid_actor_handle
004D: jump_if_false @AIC_NOHANDLE 
00A0: store_actor 9@ position_to 22@ 23@ 24@
06BD:   no_obstacles_between 17@ 18@ 19@ and 22@ 23@ 24@ solid 1 car 0 actor 0 object 0 particle 0 
004D: jump_if_false @AIC_NOHANDLE
00D6: if or
02F2:   actor 9@ model == #FAM1
02F2:   actor 9@ model == #FAM2
02F2:   actor 9@ model == #FAM3
06EE:   actor 9@ in_group $PLAYER_GROUP 
      then
0002:   jump @AIC_NOHANDLE
      end
00D6: if or
003C:   $PLAYER_ACTOR == 9@ // (int) 
0118:   actor 9@ dead
004D: jump_if_false @AIC_NEWSEARCHRADIUS
0002: jump @AIC_NOHANDLE

:AIC_TESTBANDITACTORHANDLE
056D:   is 9@ valid_actor_handle
004D: jump_if_false @AIC_NOHANDLE
803C:   not $PLAYER_ACTOR == 9@ // (int)
004D: jump_if_false @AIC_NOHANDLE
8118:   not actor 9@ dead
004D: jump_if_false @AIC_NOHANDLE
00A0: store_actor 9@ position_to 22@ 23@ 24@
06BD:   no_obstacles_between 17@ 18@ 19@ and 22@ 23@ 24@ solid 1 car 0 actor 0 object 0 particle 0 
004D: jump_if_false @AIC_NOHANDLE
02F2:   actor 9@ model == #BALLAS1
004D: jump_if_false @001
0002: jump @AIC_NEWSEARCHRADIUS
:001
02F2:   actor 9@ model == #BALLAS2
004D: jump_if_false @002
0002: jump @AIC_NEWSEARCHRADIUS
:002
02F2:   actor 9@ model == #BALLAS3
004D: jump_if_false @003
0002: jump @AIC_NEWSEARCHRADIUS
:003
02F2:   actor 9@ model == #LSV1
004D: jump_if_false @004
0002: jump @AIC_NEWSEARCHRADIUS
:004
02F2:   actor 9@ model == #LSV2
004D: jump_if_false @005
0002: jump @AIC_NEWSEARCHRADIUS
:005
02F2:   actor 9@ model == #LSV3
004D: jump_if_false @006
0002: jump @AIC_NEWSEARCHRADIUS
:006
02F2:   actor 9@ model == #VLA1
004D: jump_if_false @007
0002: jump @AIC_NEWSEARCHRADIUS
:007
02F2:   actor 9@ model == #VLA2
004D: jump_if_false @008
0002: jump @AIC_NEWSEARCHRADIUS
:008
02F2:   actor 9@ model == #VLA3
004D: jump_if_false @AIC_NOHANDLE
0002: jump @AIC_NEWSEARCHRADIUS

:AIC_TESTPOLICEACTORHANDLE
056D:   is 9@ valid_actor_handle
004D: jump_if_false @AIC_NOHANDLE
803C:   not $PLAYER_ACTOR == 9@ // (int)
004D: jump_if_false @AIC_NOHANDLE
8118:   not actor 9@ dead
004D: jump_if_false @AIC_NOHANDLE
00A0: store_actor 9@ position_to 22@ 23@ 24@
06BD:   no_obstacles_between 17@ 18@ 19@ and 22@ 23@ 24@ solid 1 car 0 actor 0 object 0 particle 0 
004D: jump_if_false @AIC_NOHANDLE
02F2:   actor 9@ model == #LAPD1
004D: jump_if_false @01
0002: jump @AIC_NEWSEARCHRADIUS
:01
02F2:   actor 9@ model == #SFPD1
004D: jump_if_false @02
0002: jump @AIC_NEWSEARCHRADIUS
:02
02F2:   actor 9@ model == #LVPD1
004D: jump_if_false @03
0002: jump @AIC_NEWSEARCHRADIUS
:03
02F2:   actor 9@ model == #CSHER
004D: jump_if_false @04
0002: jump @AIC_NEWSEARCHRADIUS
:04
02F2:   actor 9@ model == #DSHER
004D: jump_if_false @05
0002: jump @AIC_NEWSEARCHRADIUS
:05
02F2:   actor 9@ model == #LAPDM1
004D: jump_if_false @06
0002: jump @AIC_NEWSEARCHRADIUS
:06
02F2:   actor 9@ model == #SWAT
004D: jump_if_false @07
0002: jump @AIC_NEWSEARCHRADIUS
:07
02F2:   actor 9@ model == #FBI
004D: jump_if_false @08
0002: jump @AIC_NEWSEARCHRADIUS
:08
02F2:   actor 9@ model == #ARMY
004D: jump_if_false @AIC_NOHANDLE
0002: jump @AIC_NEWSEARCHRADIUS

:AIC_TESTOBJECTHANDLE
83CA:   not object 9@ exists 
004D: jump_if_false @AIC_NEWSEARCHRADIUS

:AIC_NOHANDLE
0006: 9@ = -1 
0002: jump @AIC_SEARCHLOOPNEXT 

:AIC_NEWSEARCHRADIUS
{  
   use 0051: return to break the loop
   immediately when found at least one actor/car/object, 
   does not matter if he's nearest one. 
}

// v EXTRA SEARCH CRITERIA GOES HERE v

{
  21@ contains the handle of an actor/car/object 
  that should be excluded from the search result 
  (for example a handle found previously). 
}
//803B:   21@ <> 9@
//004D: jump_if_false @AIC_NOHANDLE 

0051: return     
0085: 3@ = 15@


:AIC_SEARCHLOOPNEXT 
005A: 11@ += 6@ // (int) 
000A: 10@ += 1 
002D:   10@ >= 7@ // (int)
004D: jump_if_false @AIC_SEARCHLOOPMAIN
0051: return 

:AIC_READMEMOFFSET
0A8E: 0@ = 0@ + 1@ // int
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
0AB2: ret 1 0@

:Interceptor_end

[small][/small]

Offline

#2 24-12-2009 18:56

Alien
Registered: 12-10-2008
Posts: 564

Re: Автоматическая туррель

интересный скрипт. Понравилось решение с арктангенсом:^

Offline

#3 03-01-2010 06:08

VcSaJen
Registered: 25-08-2006
Posts: 217

Re: Автоматическая туррель

Мобильная версия пушки: прицепляется к Patriot'у.

{$CLEO}

const
  MINIGUN_BASE = 2985
  ACTIVATION_KEY = 0x4D //VK_M
  DAMAGE_1BULLET = 100
  TIME_BETWEEN_SHOTS = 0
  Y_OFFSET = -2.0
end

var
  $PLAYER_ACTOR: Actor
  $PLAYER_CHAR: Player
  0@: Object
  1@: Float
  2@: Float
  3@: Float
  4@: Float
  5@: Float
  6@: Float
  7@: Float
  8@: Float
  9@: Float
  17@: Car
  18@: Float
  19@: Float
end
0000:
:loop

while true
  if $PLAYER_CHAR.Defined
  then
    if and
      0AB0: key_pressed ACTIVATION_KEY
      not $PLAYER_ACTOR.Driving
    then
      fade 0 500
      while fading
        wait 0
      end
      0AA5: call 0x0043A0B6 num_params 1 pop 1 #PATRIOT
      fade 1 500
      while fading
        wait 0
      end   
    end
  
    if and 
      0AB0: key_pressed ACTIVATION_KEY
      $PLAYER_ACTOR.Driving
      00DD: actor $PLAYER_ACTOR driving_car_with_model #PATRIOT
      $PLAYER_CHAR.Money > 499999
      $ONMISSION == 0
    then
      03C0: 17@ = actor $PLAYER_ACTOR car 
      $PLAYER_CHAR.Money += -500000
//      $PLAYER_CHAR.WantedLevel = 6
      04C4: store_coords_to 1@ 2@ 3@ from_actor $PLAYER_ACTOR with_offset 0.0 2.0 -1.0
//      02CE: 3@ = ground_z_at 1@ 2@ 3@
      3@-=1.5
      0@ = Object.Create(MINIGUN_BASE, 1@, 2@, 3@)
      0@.CollisionDetection=false
      7@ = $PLAYER_ACTOR.Angle
      7@ += 90.0
      0@.Angle = 7@
      0681: attach_object 0@ to_car 17@ with_offset 0.0 Y_OFFSET 0.2 rotation 0.0 0.0 -90.0
      {02F6: 18@ = sine 7@ // (float) 
      02F7: 19@ = cosine 7@ // (float)
      18@+=1@
      19@+=2@}
      7@ -= 90.0        
      3@+=1.5
      066E: create_particle "gunsmoke" attached_to_object 0@ with_offset 0.95 0.0 1.089 rotation 90.0 0.0 0.0 flag 0 handle_as 11@ 
//      066E: create_particle "prt_gunshell" attached_to_object 0@ with_offset 0.141034 -0.0554999 1.1 rotation 0.0 100.0 90.0 flag 0 handle_as 12@ 
      0400: store_coords_to 1@ 2@ 3@ from_object 0@ with_offset 1.2 0.0 1.087
      18@=1@
      19@=2@
      wait 200     
      while $PLAYER_ACTOR.InCar(17@)
        0400: store_coords_to 1@ 2@ 3@ from_object 0@ with_offset 0.95 0.0 1.087
        0400: store_coords_to 4@ 5@ 6@ from_object 0@ with_offset 100.2 0.0 1.087  
    
        0A8D: 12@ = read_memory 0x00C1C964 size 4 virtual_protect 0
        if
          12@ > 0
        then
          // ищем вертолет
          0A8D: 13@ = read_memory 0x00B74494 size 4 virtual_protect 0
          0AA8: call_function_method 0x00424160 struct 13@ num_params 1 pop 0 12@ 13@
          if 0185:   car 13@ health >= 250
          then
            Car.StorePos(13@, 4@, 5@, 6@)
            050A: 14@ = distance_between_XYZ 1@ 2@ 3@ and_XYZ 4@ 5@ 6@ 
            if and 
              14@ <= 75.0
              06BD: no_obstacles_between 1@ 2@ 3@ and 4@ 5@ 6@ solid 1 car 0 actor 0 object 0 particle 0 
            then
              jump @Shoot
            end
          end
        end
        0A8D: 12@ = read_memory 0x00C1C968 size 4 virtual_protect 0
        if
          12@ > 0
        then
          // ищем вертолет
          0A8D: 13@ = read_memory 0x00B74494 size 4 virtual_protect 0
          0AA8: call_function_method 0x00424160 struct 13@ num_params 1 pop 0 12@ 13@
          if 0185:   car 13@ health >= 250
          then
            Car.StorePos(13@, 4@, 5@, 6@)
            050A: 14@ = distance_between_XYZ 1@ 2@ 3@ and_XYZ 4@ 5@ 6@ 
            if and 
              14@ <= 75.0
              06BD: no_obstacles_between 1@ 2@ 3@ and 4@ 5@ 6@ solid 1 car 0 actor 0 object 0 particle 0
            then
              jump @Shoot
            end
          end
        end
        //08E5: get_actor_in_sphere 1@ 2@ 3@ radius 50.0 handle_as 10@
        
        
        //0AB1: call_scm_func @Func 1 0@
        
        
        if not Actor.Dead(10@)
        then
          Actor.StorePos(10@, 4@, 5@, 6@)
          050A: 14@ = distance_between_XYZ 1@ 2@ 3@ and_XYZ 4@ 5@ 6@ 
        end
        if or 
          Actor.Dead(10@)
          14@>60.0
          32@>=7000
        then
          32@=0
          0AB1: call_scm_func @FUNC_GETPOLICEACTOR 7 1@ 2@ 3@ 60.0 1@ 2@ 3@  10@
          if 10@<0
          then
            0AB1: call_scm_func @FUNC_GETBANDITACTOR 7 1@ 2@ 3@ 60.0 1@ 2@ 3@  10@
            if 10@<0
            then
              0AB1: call_scm_func @FUNC_GETACTOR 7 1@ 2@ 3@ 60.0 1@ 2@ 3@  10@
              
              if 10@<0
              then
                wait 500
              end
            end
          end
        end
  //      073F: get_actor_in_sphere 1@ 2@ 3@ radius 50.0 with_pedtype_civilian 1 gang 1 criminal/prostitute 1 handle_as 10@ 
  //      0A3E: unknown_get_actor_in_sphere 1@ 2@ 3@ radius 50.0 50.0 5.0 handle_as 10@ 
  //      0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 30@ closest_ped_to 10@
  
        if and 
          10@ > 0
          not Actor.Dead(10@)
          //86EE:   not actor 10@ in_group $PLAYER_GROUP 
        then
          Actor.StorePos(10@, 4@, 5@, 6@)
          //Actor.RemoveReferences(10@)          
          jump @Shoot
//          064C: make_particle 12@ visible 
        end    
        :checks 
        if or 
          0AB0:  key_pressed ACTIVATION_KEY
          not $PLAYER_CHAR.Defined
          $ONMISSION == 1
          89E7: not player $PLAYER_CHAR not_frozen 
        then
          Break
        end
        0@.StorePos(20@, 21@, 22@)
        0@.StorePos(23@, 24@, 25@)
        20@-=2.5
        21@-=2.5
        22@-=2.5
        23@+=2.5
        24@+=2.5
        25@+=2.5
        if 0356:   explosion_type -1 in_cube_cornerA 20@ 21@ 22@ cornerB 23@ 24@ 25@ 
        then
          jump @damage
        end
        wait TIME_BETWEEN_SHOTS
      end
      0@.Destroy
      0650: destroy_particle 11@
//      0650: destroy_particle 12@ 
    end
  end
  wait 0
end

{:Func
0400: store_coords_to 1@ 2@ 3@ from_object 0@ with_offset 1.2 0.5 0.587
0400: store_coords_to 4@ 5@ 6@ from_object 0@ with_offset 1.2 -0.5 1.587
03E6: remove_text_box 
if 05FC: actor $PLAYER_ACTOR in_cube_fll_corner_at 1@ 2@ 3@ fur_corner_at 4@ 5@ 6@ depth 50.0 flag 0
then
  0513: show_text_box_1number 'NUMBER' number 777
end
0AB2: ret 0}

:Shoot
  0AB1: call_scm_func @RotateObjectAtPoint 6 0@ 18@ 19@ 4@ 5@ 17@
  18@=4@
  19@=5@
  0400: store_coords_to 1@ 2@ 3@ from_object 0@ with_offset 0.95 0.0 1.087     
  7@ = Random(-0.5, 0.5)
  8@ = Random(-0.5, 0.5)
  9@ = Random(-0.5, 0.5)
  4@+=7@
  5@+=8@
  6@+=9@
  17@.SetImmunities(1,0,0,0,0)      
  06BC: create_M4_shoot_from 1@ 2@ 3@ target 4@ 5@ 6@ energy DAMAGE_1BULLET
  17@.SetImmunities(0,0,0,0,0)
  064C: make_particle 11@ visible
jump @checks


:damage
0@.StorePos(20@, 21@, 22@)
02CF: 26@ = create_fire_at 20@ 21@ 22@ propagation 0 size 2

0@.ToggleInMovingList = true
0@.CollisionDetection=true 
32@=0
while 32@<5000
  02D1: remove_fire 26@
  0@.StorePos(20@, 21@, 22@)
  02CF: 26@ = create_fire_at 20@ 21@ 22@ propagation 0 size 2
  wait 0
end
020C: create_explosion_with_radius 12 at 20@ 21@ 22@
0682: detach_object 0@ 0.0 0.0 0.0 collision_detection 1
06A2: get_car 17@ velocity_in_direction_XYZ 20@ 21@ 22@
22@+=15.0
0@.Throw(20@, 21@, 22@)
05A2: set_object 0@ rotation_velocity_about_an_axis 0.0 5.0 0.0 through_center_of_mass
wait 500
0@.StorePos(20@, 21@, 22@)
02D1: remove_fire 26@ 
020C: create_explosion_with_radius 0 at 20@ 21@ 22@ 
020C: create_explosion_with_radius 5 at 20@ 21@ 22@ 
0@.Destroy
0650: destroy_particle 11@
//0650: destroy_particle 12@ 
jump @loop

:DrawFloat
008C: 4@ = float_to_integer 0@
008C: 5@ = float_to_integer 0@
5@ *= 1000
0@ *= 1000.0
008C: 0@ = float_to_integer 0@      
0062: 0@ -= 5@
0095: abs( 0@ ) 
gosub @TextDrawText2Settings
045B: text_draw_2numbers 1@ 2@ '_NUM_F' 4@ 0@
0AB2: ret 0

:TextDrawTextSettings
0348: set_text_draw_proportional 1 
033F: set_text_draw_letter_width_to 0.3 height_to 1.0 
0349: set_text_draw_style_to 1 
081C: draw_text_outline 1 0 0 0 255
//081C: draw_text_outline 0 0 0 0 0
0340: set_text_draw_color_RGB_mask_to 0x12 0xFF 0 200
0343: set_text_draw_linewidth 640.0
return

:TextDrawText2Settings
0348: set_text_draw_proportional 1 
033F: set_text_draw_letter_width_to 0.3 height_to 1.0 
0349: set_text_draw_style_to 1 
081C: draw_text_outline 1 0 0 0 255
0340: set_text_draw_color_RGB_mask_to 0xFC 0xFF 0 200
0343: set_text_draw_linewidth 640.0 
return

:RotateObjectAtPoint{In_Object,In_XY_Float}
var
  0@:Object
  1@:Float//OldX
  2@:Float//OldY
  3@:Float//NewX
  4@:Float//NewY
  5@:Car//CarHandle
  17@:Float
  16@:Float
  6@:Float
  7@:Float
  8@:Float
  9@:Float
  10@:Float
  11@:Float
  12@:Float
  
  13@:Float
  14@:Float
  30@: Float
end
17@=5@.Angle
Object.StorePos(0@, 13@, 14@, 15@)
1@-=13@
2@-=14@
3@-=13@
4@-=14@
{0509: 16@ = distance_between_XY 0.0 0.0 and_XY 1@ 2@
1@/=16@
2@/=16@
0509: 16@ = distance_between_XY 0.0 0.0 and_XY 3@ 4@
3@/=16@
4@/=16@

6@=3@
7@=4@
6@-=1@
7@-=2@
0509: 16@ = distance_between_XY 0.0 0.0 and_XY 6@ 7@
6@/=16@
7@/=16@
6@*=0.05
7@*=0.05
while true
  1@+=6@
  2@+=7@
  8@=1@
  9@=2@
  8@-=3@
  9@-=4@
  0097: make 8@ absolute_float
  0097: make 9@ absolute_float 
  if and
    8@<=0.06
    9@<=0.06
  then
    Break
  end
  0604: Arctan2( 1@ , 2@ ) store_to 30@
  30@+=90.0
  30@-=17@
  if 0685: object 0@ attached
  then 
    0682: detach_object 0@ 0.0 0.0 0.0 collision_detection 0 
  end
  0681: attach_object 0@ to_car 5@ with_offset 0.0 Y_OFFSET 0.0 rotation 0.0 0.0 30@
  wait 0
end}
0604: Arctan2( 3@ , 4@ ) store_to 30@
30@+=90.0
30@-=17@
if 0685: object 0@ attached
then 
  0682: detach_object 0@ 0.0 0.0 0.0 collision_detection 0 
end
0681: attach_object 0@ to_car 5@ with_offset 0.0 Y_OFFSET 0.2 rotation 0.0 0.0 30@
0AB2: ret 0

:debug
03F0: enable_text_draw 1
0AB1: @DrawFloat 3 pars fnumber 10@ coords 69.0 200.0
0AB1: @DrawFloat 3 pars fnumber 11@ coords 69.0 210.0
return

{
    The Interceptor 1.1
       
    by PLPynton and Seemann    

    Parameters:
    0@ - input coord X
    1@ - input coord Y
    2@ - input coord Z
    3@ - search radius

    variables 4@..16@ in use
    
    9@ = Result (returns -1 if not found)
           
}
jump @Interceptor_end

:FUNC_GETACTOR
0087: 17@ = 4@ // (float)
0087: 18@ = 5@ // (float)
0087: 19@ = 6@ // (float)
gosub @AIC_GETACTOR
0AB2: ret 1 9@

:FUNC_GETPOLICEACTOR
0087: 17@ = 4@ // (float)
0087: 18@ = 5@ // (float)
0087: 19@ = 6@ // (float)
gosub @AIC_GETPOLICEACTOR
0AB2: ret 1 9@

:FUNC_GETBANDITACTOR
0087: 17@ = 4@ // (float)
0087: 18@ = 5@ // (float)
0087: 19@ = 6@ // (float)
gosub @AIC_GETBANDITACTOR
0AB2: ret 1 9@

:FUNC_GETVEHICLE
gosub @AIC_GETVEHICLE
0AB2: ret 1 9@

:FUNC_GETOBJECT
gosub @AIC_GETOBJECT
0AB2: ret 1 9@

:AIC_GETPOLICEACTOR
0006: 16@ = 305868
0006: 5@ = @AIC_TESTPOLICEACTORHANDLE
0006: 6@ = 1988
0002: jump @AIC_STARTSEARCH

:AIC_GETBANDITACTOR
0006: 16@ = 305868
0006: 5@ = @AIC_TESTBANDITACTORHANDLE
0006: 6@ = 1988
0002: jump @AIC_STARTSEARCH 

:AIC_GETACTOR
0006: 16@ = 305868
0006: 5@ = @AIC_TESTACTORHANDLE
0006: 6@ = 1988
0002: jump @AIC_STARTSEARCH 

:AIC_GETVEHICLE
0006: 16@ = 305869
0006: 5@ = @AIC_TESTVEHICLEHANDLE
0006: 6@ = 2584
0006: 8@ = -1
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @AIC_STARTSEARCH 
00DF:   actor $PLAYER_ACTOR driving
004D: jump_if_false @AIC_STARTSEARCH
03C0: 8@ = actor $PLAYER_ACTOR car
0002: jump @AIC_STARTSEARCH

:AIC_GETOBJECT
0006: 16@ = 305871
0006: 5@ = @AIC_TESTOBJECTHANDLE
0006: 6@ = 412

:AIC_STARTSEARCH
008B: 16@ = &0(16@,1i) // CPool*
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 16@ + 8 )^ = 7@  // CPool.Size
0A8D: 11@ = read_memory 16@ size 4 virtual_protect 0        // CPool.pUnits
0006: 9@ = -1 
0006: 10@ = 0

:AIC_SEARCHLOOPMAIN
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 11@ + 20 )^ = 4@  // xyz*
8039:   not  4@ == 0 
004D: jump_if_false @AIC_SEARCHLOOPNEXT 
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 4@ + 48 )^ = 12@  // x
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 4@ + 52 )^ = 13@  // y
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 4@ + 56 )^ = 14@  // z
050A: 15@ = distance_between_XYZ 0@ 1@ 2@ and_XYZ 12@ 13@ 14@ 
0025:   3@ > 15@ // (float) 
004D: jump_if_false @AIC_SEARCHLOOPNEXT 
0085: 9@ = 10@ // (int) // counter
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 16@ + 4 )^ = 4@ // CPool.flags
005A: 4@ += 9@ // (int) 
0A8D: 4@ = read_memory 4@ size 1 virtual_protect 0 
0012: 9@ *= 256 
005A: 9@ += 4@ // (int)
0002: jump 5@

:AIC_TESTVEHICLEHANDLE
056E:   is 9@ valid_vehicle_handle
004D: jump_if_false @AIC_NOHANDLE
00D6: if or
003B:   8@ == 9@ // (int) 
0119:   car 9@ wrecked 
004D: jump_if_false @AIC_NEWSEARCHRADIUS
0002: jump @AIC_NOHANDLE

:AIC_TESTACTORHANDLE
056D:   is 9@ valid_actor_handle
004D: jump_if_false @AIC_NOHANDLE 
00A0: store_actor 9@ position_to 22@ 23@ 24@
06BD:   no_obstacles_between 17@ 18@ 19@ and 22@ 23@ 24@ solid 1 car 0 actor 0 object 0 particle 0 
004D: jump_if_false @AIC_NOHANDLE
00D6: if or
02F2:   actor 9@ model == #FAM1
02F2:   actor 9@ model == #FAM2
02F2:   actor 9@ model == #FAM3
06EE:   actor 9@ in_group $PLAYER_GROUP 
      then
0002:   jump @AIC_NOHANDLE
      end
00D6: if or
003C:   $PLAYER_ACTOR == 9@ // (int) 
0118:   actor 9@ dead
004D: jump_if_false @AIC_NEWSEARCHRADIUS
0002: jump @AIC_NOHANDLE

:AIC_TESTBANDITACTORHANDLE
056D:   is 9@ valid_actor_handle
004D: jump_if_false @AIC_NOHANDLE
803C:   not $PLAYER_ACTOR == 9@ // (int)
004D: jump_if_false @AIC_NOHANDLE
8118:   not actor 9@ dead
004D: jump_if_false @AIC_NOHANDLE
00A0: store_actor 9@ position_to 22@ 23@ 24@
06BD:   no_obstacles_between 17@ 18@ 19@ and 22@ 23@ 24@ solid 1 car 0 actor 0 object 0 particle 0 
004D: jump_if_false @AIC_NOHANDLE
02F2:   actor 9@ model == #BALLAS1
004D: jump_if_false @001
0002: jump @AIC_NEWSEARCHRADIUS
:001
02F2:   actor 9@ model == #BALLAS2
004D: jump_if_false @002
0002: jump @AIC_NEWSEARCHRADIUS
:002
02F2:   actor 9@ model == #BALLAS3
004D: jump_if_false @003
0002: jump @AIC_NEWSEARCHRADIUS
:003
02F2:   actor 9@ model == #LSV1
004D: jump_if_false @004
0002: jump @AIC_NEWSEARCHRADIUS
:004
02F2:   actor 9@ model == #LSV2
004D: jump_if_false @005
0002: jump @AIC_NEWSEARCHRADIUS
:005
02F2:   actor 9@ model == #LSV3
004D: jump_if_false @006
0002: jump @AIC_NEWSEARCHRADIUS
:006
02F2:   actor 9@ model == #VLA1
004D: jump_if_false @007
0002: jump @AIC_NEWSEARCHRADIUS
:007
02F2:   actor 9@ model == #VLA2
004D: jump_if_false @008
0002: jump @AIC_NEWSEARCHRADIUS
:008
02F2:   actor 9@ model == #VLA3
004D: jump_if_false @AIC_NOHANDLE
0002: jump @AIC_NEWSEARCHRADIUS

:AIC_TESTPOLICEACTORHANDLE
056D:   is 9@ valid_actor_handle
004D: jump_if_false @AIC_NOHANDLE
803C:   not $PLAYER_ACTOR == 9@ // (int)
004D: jump_if_false @AIC_NOHANDLE
8118:   not actor 9@ dead
004D: jump_if_false @AIC_NOHANDLE
00A0: store_actor 9@ position_to 22@ 23@ 24@
06BD:   no_obstacles_between 17@ 18@ 19@ and 22@ 23@ 24@ solid 1 car 0 actor 0 object 0 particle 0 
004D: jump_if_false @AIC_NOHANDLE
02F2:   actor 9@ model == #LAPD1
004D: jump_if_false @01
0002: jump @AIC_NEWSEARCHRADIUS
:01
02F2:   actor 9@ model == #SFPD1
004D: jump_if_false @02
0002: jump @AIC_NEWSEARCHRADIUS
:02
02F2:   actor 9@ model == #LVPD1
004D: jump_if_false @03
0002: jump @AIC_NEWSEARCHRADIUS
:03
02F2:   actor 9@ model == #CSHER
004D: jump_if_false @04
0002: jump @AIC_NEWSEARCHRADIUS
:04
02F2:   actor 9@ model == #DSHER
004D: jump_if_false @05
0002: jump @AIC_NEWSEARCHRADIUS
:05
02F2:   actor 9@ model == #LAPDM1
004D: jump_if_false @06
0002: jump @AIC_NEWSEARCHRADIUS
:06
02F2:   actor 9@ model == #SWAT
004D: jump_if_false @07
0002: jump @AIC_NEWSEARCHRADIUS
:07
02F2:   actor 9@ model == #FBI
004D: jump_if_false @08
0002: jump @AIC_NEWSEARCHRADIUS
:08
02F2:   actor 9@ model == #ARMY
004D: jump_if_false @AIC_NOHANDLE
0002: jump @AIC_NEWSEARCHRADIUS

:AIC_TESTOBJECTHANDLE
83CA:   not object 9@ exists 
004D: jump_if_false @AIC_NEWSEARCHRADIUS

:AIC_NOHANDLE
0006: 9@ = -1 
0002: jump @AIC_SEARCHLOOPNEXT 

:AIC_NEWSEARCHRADIUS
{  
   use 0051: return to break the loop
   immediately when found at least one actor/car/object, 
   does not matter if he's nearest one. 
}

// v EXTRA SEARCH CRITERIA GOES HERE v

{
  21@ contains the handle of an actor/car/object 
  that should be excluded from the search result 
  (for example a handle found previously). 
}
//803B:   21@ <> 9@
//004D: jump_if_false @AIC_NOHANDLE 

0051: return     
0085: 3@ = 15@


:AIC_SEARCHLOOPNEXT 
005A: 11@ += 6@ // (int) 
000A: 10@ += 1 
002D:   10@ >= 7@ // (int)
004D: jump_if_false @AIC_SEARCHLOOPMAIN
0051: return 

:AIC_READMEMOFFSET
0A8E: 0@ = 0@ + 1@ // int
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
0AB2: ret 1 0@

:Interceptor_end

[small][/small]

Offline

#4 12-03-2010 18:52

~AquaZ~
Registered: 01-03-2010
Posts: 726

Re: Автоматическая туррель

Интересно... А что за параметр propagation у create_fire_at?

Last edited by ~AquaZ~ (12-03-2010 19:12)

Offline

#5 13-03-2010 15:22

Sw[ee]t
From: Нижний Новгород
Registered: 16-02-2009
Posts: 686
Website

Re: Автоматическая туррель

~AquaZ~ wrote:

Интересно... А что за параметр propagation у create_fire_at?

propagation - распространение (вроде радиус на который будет распростроняться дым)
Элементарно же!

Offline

#6 13-07-2010 14:14

Daeman
From: }{абаровск
Registered: 08-05-2009
Posts: 70

Re: Автоматическая туррель

    if and 
      0AB0: key_pressed ACTIVATION_KEY
      $PLAYER_ACTOR.Driving
      00DD: actor $PLAYER_ACTOR driving_car_with_model #PATRIOT
      $PLAYER_CHAR.Money > 499999
      $ONMISSION == 0
    then
      03C0: 17@ = actor $PLAYER_ACTOR car 
      $PLAYER_CHAR.Money += -500000

А это для некоего баланса сил? smile

Offline

Board footer

Powered by FluxBB