Jump to content

Bomber Mod


Bob Ghengis Khan

Recommended Posts

Bob Ghengis Khan

This mod adds two bombs to every flying vehicle, dropped with the fire button. The offsets were designed to look right on a Rustler

 

(edited with last version, but still not moving forward when I drop them)

 

:BOMBER

03A4: name_thread 'BOMBER'

 

:BOMBERLOOP

0001: wait 250 ms

00D6: if 0

0256: player $PLAYER_CHAR defined

004D: jump_if_false ££BOMBERLOOP

00D6: if 0

04C8: actor $PLAYER_ACTOR driving_flying_vehicle

004D: jump if false ££BOMBERLOOP

03C0: @0 = actor $PLAYER_ACTOR car

0247: request_model #RCBOMB

038B: load_requested_models

 

:BOMBERLOOP2

0001: wait 0 ms

00D6: if 0

0248: model #RCBOMB available

004D: jump_if_false ££BOMBERLOOP2

 

0107: @1 = create_object #RCBOMB at 2488.741 -1667.08 0

08D2: object @1 scale_model 1.99

0382: set_object @1 collision_detection 1

0392: object @1 toggle_in_moving_list 1

 

0107: @2 = create_object #RCBOMB at 2488.741 -1667.08 3

08D2: object @2 scale_model 1.99

0382: set_object @2 collision_detection 1

0392: object @2 toggle_in_moving_list 1

 

0249: release_model #RCBOMB

0681: attach_object @1 to_car @0 at_offset 1.45 .75 0 rotation 0.0 0.0 0.0

0681: attach_object @2 to_car @0 at_offset -1.45 .75 0 rotation 0.0 0.0 0.0

 

 

:BOMBERDROP

0001: wait 20 ms

00D6: if 0

0256: player $PLAYER_CHAR defined

004D: jump_if_false ££BOMBEREND

00D6: if 0

04C8: actor $PLAYER_ACTOR driving_flying_vehicle

004D: jump if false ££BOMBEREND

00D6: if 0

00E1: key_pressed 0 17

004D: jump_if_false ££BOMBERDROP

 

0682: @1 0 0 0 0

0682: @2 0 0 0 0

0006: @32 = 0 ;; timer

 

:BOMBSARM

0001: wait 20 ms

00D6: if 0

0019: @32 > 1000 ;; bombs arm after .2 seconds, so they dont hit your own wings collision model

004D: jump_if_false ££BOMBSARM

04D9: object @1 set_scripted_collision_check 1

04D9: object @2 set_scripted_collision_check 1

 

:BOMBSEXPLODE

0001: wait 20 ms

00D6: if 24

04DA: has_object @1 collided

04E7: object @1 in_water

04DA: has_object @2 collided

04E7: object @2 in_water

0019: @32 > 10000 ;; explode after 10 seconds

004D: jump_if_false ££BOMBSEXPLODE

 

01BB: store_object @1 position_to @11 @12 @13

04D9: object @1 set_scripted_collision_check 0

020C: create_explosion_with_radius 10 at @11 @12 @13

01BB: store_object @2 position_to @11 @12 @13

04D9: object @2 set_scripted_collision_check 0

020C: create_explosion_with_radius 10 at @11 @12 @13

 

:BOMBEREND

01C3: remove_references_to_car @0

01C4: remove_references_to_object @1 ;; This object will now disappear when the player looks away

0108: destroy_object @1

01C4: remove_references_to_object @2 ;; This object will now disappear when the player looks away

0108: destroy_object @2

0002: jump ££BOMBERLOOP

 

A few notes about what I've learned making this, in case theyre useful for anyone else. Opcode 0682 doesnt have a description in my scm.ini, but I've found it unattaches an object from a car. I'm not 100% sure what the parameters do, setting them less than 1 doesnt seem to have any effect, and setting them greater than 1 seems to destroy the object

 

 

Opcode 038C is used for pushing away an object that was just attached, but collision detection must be on. The first 2 parameters set the initial speed of the object in the X and Y directions of the map, but unfortunately I cannot find how to get a vehicles X and Y velocities in order to impart this to the bomb, so that they can be dropped with the plane's momentum. In addition, the 3rd parameter doesnt seem to work to speed up the objects Z velocity (going down). I think it just adds to the Y velocity, but I'm not 100% sure.

 

I've found that 10 is the maximum usable explosion radius. Setting to 11 or 12 will still show an explosion, but pedestrians around it will be unharmed. Setting to 15 wont even show the fiery blast, just a black mark on the ground with no one harmed

 

Opcode 04D9 doesnt work on a stripped scm, but I dont ever really use those anyway so I cant figure out which external script to run on them to make it work. It's needed for opcode 04DA to function properly.

 

The scale for objects seems to be limited to < 2

 

 

I was planning initially to restrict this to airplanes, and make seperate attach offsets for each type, as well as make another set of bombs that have seperate collision checks to explode, but since I cant figure out how to impart momentum to the bombs at the moment, the code is more of a novelty than being useful. I've spent hours trying to figure out how to do it, but for now I give up. So this code will just attach to any aircraft to screw around with. I havent tested it with anything as large as an at400, the offsets would have to be changed for that

Edited by Bob Ghengis Khan
Link to comment
Share on other sites

Remember what was said earlier about using a backwards approach and/or bothering with models prior to needing them? Remember how you disregarded it then? sly.gif The beginning of your code should look more like

:BOMBER03A4: name_thread 'BOMBER':BOMBERLOOP0001: wait 250 ms00D6: if 00256: player $PLAYER_CHAR defined004D: jump_if_false ��BOMBERLOOP00D6: if 004C8: actor $PLAYER_ACTOR driving_flying_vehicle004D: jump if false ��BOMBERLOOP03C0: @0 = actor $PLAYER_ACTOR car0247: request_model #RCBOMB038B: load_requested_models:BOMBERLOOP20001: wait 0 ms00D6: if 00248: model #RCBOMB available004D: jump_if_false ��BOMBERLOOP2

Also, after creating them, you need to release the model. Likewise, BOMBEREND is missing a pair of 01C4's. For that matter, you can ditch the destroy commands and just move those to the END anyways since it runs immediately afterwards.

 

Cool idea for a mod colgate.gif

 

 

A few notes about what I've learned making this, in case theyre useful for anyone else. Opcode 0682 doesnt have a description in my scm.ini, but I've found it unattaches an object from a car. I'm not 100% sure what the parameters do, setting them less than 1 doesnt seem to have any effect, and setting them greater than 1 seems to destroy the object
Good work. You should check the opcodes thread to see if it's been posted already. If not, tinker with it a little and see if you can identify what the parameters do and then post it there.

 

 

Opcode 038C is used for pushing away an object that was just attached, but collision detection must be on. The first 2 parameters set the initial speed of the object in the X and Y directions of the map, but unfortunately I cannot find how to get a vehicles X and Y velocities in order to impart this to the bomb, so that they can be dropped with the plane's momentum. In addition, the 3rd parameter doesnt seem to work to speed up the objects Z velocity (going down). I think it just adds to the Y velocity, but I'm not 100% sure.
Good work on the find. The 3rd wouldn't add to the Y's velocity or else there would also be one for X. Finding the current X and Y speed will require you to use currect speed, current Z angle, and some trig. GTA supports that. It's just a matter of studying up what approach to use.
Link to comment
Share on other sites

Bob Ghengis Khan

I didnt mean to disregard it, I just misunderstood. I thought moving the player defined check around in the loop before the bomb would do it. Thanks dude

 

Edit- just started trying to figure this out again, but how would you get the 3 parts of velocity from just speed and the angle between the ground and the car? made a sh*tty little picture in paint to show what im thinking of:

 

pic link thingie

 

V being the vector, and A and B two angles in different planes:

 

For the Z coordinate of vector V, its VsinA

For Y, VcosAsinB

For X, VcosAcosB

 

Wouldnt the Z angle in game just be angle A?

 

And then I'd need to find a way to convert from the vehicles' frame of reference to the world set of axis, oh well more searching opcodes

 

Only thing I can really think is to just use the average velocity over .01 seconds using 2 position functions, and delay the bomb drop til that velocity is stored, but I'm not sure how precise the timers or wait commands are

 

edit2- went to test them before bed, for 0682 im pretty confident now that the first 2 parameters are the angles A an B in that picture, where x is the axis along the path I want the object to move with my planes velocity assuming I was going straight, and y is off to my side. The next two are the speeds to rotate at those angles

 

For scatter, I think i was premature posting before, thought I had em figured out partially, but I was wrong. Still cant get em to do what I want, or get the throw opcode working. I originally added it because my bombs were getting stuck on my sparrow, it seemed to fix the problem for me. But now I've removed it entirely from my code and the bombs are still dropping fine

Edited by Bob Ghengis Khan
Link to comment
Share on other sites

Bob Ghengis Khan

Been testing the move_object command, when I move a gate it can just hover in the air, and doesnt fall with gravity. When I attempt to move a bomb, it goes about 1 foot in the direction I want it to move, then falls straight down.

 

I've found the max speed usable in move_object is < 1

 

Can anyone think of any other way to get the bombs to move for me when I drop them?

Link to comment
Share on other sites

Bob Ghengis Khan

edit- got throw working without crashing me

 

There's no way that I can tell to set speed for the throw opcode, either, but I guess it's better than nothing

Edited by Bob Ghengis Khan
Link to comment
Share on other sites

Bob Ghengis Khan

edit- bomb throwing was crashing me when I tried to do it in 2 directions at distances greater than 10 with an object sitting still. I still dont understand why.

 

When dropped from a helicopter then thrown, I dont crash, but if my helicopter is moving at all the bomb that is thrown falls behind the one thats dropped.

 

I had it set to throw north, while sitting still it would do so for a bit fine. But if I flew north and threw it, it would fall south of where the freefall bomb would fall. I dont get it.

Edited by Bob Ghengis Khan
Link to comment
Share on other sites

Been testing the move_object command, when I move a gate it can just hover in the air, and doesnt fall with gravity. When I attempt to move a bomb, it goes about 1 foot in the direction I want it to move, then falls straight down.

When I was writing Neo for GTA3 and got to the stage where I wanted to provide a platform to prevent the flailing side effect, I tried using the tires that surround the crusher's target area. Fido fell through. When I tried a palette, it held him fine. I concluded (inconclusively) that the game somehow understood masses. Maybe this is what you're encountering.

 

 

edit- bomb throwing was crashing me when I tried to do it in 2 directions
Why? Doesn't the command use angles at all?

 

At any rate, I hope you'll stick with this. I'd hate to see somebody working so hard at something just give up because it was challenging.

Link to comment
Share on other sites

Bob Ghengis Khan

Damn, good idea Demarest, but I just tried

 

071F: set_object @1 mass 0.0 (as well as just mass 0)

 

And the objects still fell with gravity (in this case, through a truck I was testing with for another mod)

Link to comment
Share on other sites

ok. there is one for vice city were it lets you drop bombs from the skimmer snd shoot missiles which is this

:Marker

02A8: $MakePlane = create marker 27 at 24.74 -837.80 10.46

0001: wait 0 ms

0002: jump ££Label008FC7

 

:Label008FC7

0001: wait 250 ms

00D6: if 0

8339: NOT objects_in_cube 25.03 -835.27 10.46 30.03 -840.27 10.46 0 1 1 0 0

004D: jump_if_false ££Label00900C

0001: wait 0 ms

0002: jump ££Label008FC7

 

:Label00900C

00D6: if 0

00DD: actor $PLAYER_ACTOR driving vehicle type #SKIMMER

004D: jump_if_false ££RequestStuff

0001: wait 0 ms

0002: jump ££Label00900C

 

:RequestStuff

0164: disable marker $ThePlane

00A6: destroy_car $Skimmer

0247: request_model #SKIMMER

00D6: if 0

8248: NOT model #SKIMMER available

004D: jump_if_false ££Label00902C

0001: wait 0 ms

0002: jump ££Label00900C

 

:Label00902C

0167: $Nachos = create marker at 24.64 -839.14 10.46 3 1

00A5: $Skimmer = create_car #SKIMMER at -3.87 -856.28 10.46

0186: $ThePlane = create marker above car $Skimmer

02AC: set_car $Skimmer immunities 1 1 1 1 1

0249: release_model #SKIMMER

0001: wait 8000 ms

0002: jump ££Label008FC7

 

:Label009063

00D6: if 0

80DE: NOT player $PLAYER_CHAR driving_vehicle_type #SKIMMER

004D: jump_if_false ££Label009081

0001: wait 0 ms

0002: jump ££Label009063

 

:Label009081

0001: wait 0 ms

04C4: create_coordinate 6@ 7@ 8@ from_actor $PLAYER_ACTOR offset 0.0 50.0 0.0

04C4: create_coordinate 9@ 10@ 11@ from_actor $PLAYER_ACTOR offset 0.0 5.0 0.0

0001: wait 0 ms

0002: jump ££Label0090C6

 

:Label0090C6

00D6: if 0

80E1: NOT key_pressed 0 17

004D: jump_if_false ££Label0090E2

0001: wait 0 ms

0002: jump ££Label0090C6

 

:Label0090E2

020C: create_explosion 8 at 6@ 7@ 8@

020C: create_explosion 8 at 6@ 7@ 8@

020C: create_explosion 8 at 6@ 7@ 8@

020C: create_explosion 8 at 6@ 7@ 8@

0503: create_gas_smoke 9@ 10@ 11@

0503: create_gas_smoke 6@ 7@ 8@

0001: wait 200 ms

0002: jump ££Label009063

004E: end_thread

 

:IfDrivingSkimmer

0001: wait 0 ms

00D6: if 0

0256: player $PLAYER_CHAR defined

004D: jump_if_false ££IfDrivingSkimmer

00D6: if 0

00DE: player $PLAYER_CHAR driving vehicle type #SKIMMER

004D: jump_if_false ££IfDrivingSkimmer

 

:GetBomb

03C1: $Skimmer = player $PLAYER_CHAR car

 

:KeyPressedInFlight

0001: wait 0 ms

00D6: if 0

00E1: key pressed 0 6

004D: jump_if_false ££KeyPressedInFlight

 

:PlaceBomb

029B: $Bomb = init_object -184 (RCBOMB) at -1109.615 1330.097 20.372

035C: place_object $Bomb relative_to_car $Skimmer offset 0.0 0.0 -1.5

 

:Impact

0001: wait 0 ms

0382: unknown_set_object $Bomb collision_detection 1

0392: object $Bomb toggle_in_moving_list 1

01BB: store_object $Bomb position_to $Xcoord2 $Ycoord2 $Zcoord2

02CE: $Ground = ground_z $Xcoord2 $Ycoord2 $Zcoord2

0086: $Limit = $Zcoord2;; floating-point values only

0061: $Limit -= $Ground;; floating-point values

00D6: if 0

8020: NOT $Limit > .5;; floating-point values

004D: jump_if_false ££Impact

01C4: remove_references_to_object $Bomb ;; This object will now disappear when the player looks away

 

:CreateFires

020C: create_explosion_with_radius 7 at $Xcoord2 $Ycoord2 $Zcoord2

020C: create_explosion_with_radius 7 at $Xcoord2 $Ycoord2 $Zcoord2

0565: create_temporary_explosion_fire $Xcoord2 $Ycoord2 $Zcoord2 2

0565: create_temporary_explosion_fire $Xcoord2 $Ycoord2 $Zcoord2 1

0565: create_temporary_explosion_fire $Xcoord2 $Ycoord2 $Zcoord2 1

020C: create_explosion_with_radius 7 at $Xcoord2 $Ycoord2 $Zcoord2

020C: create_explosion_with_radius 7 at $Xcoord2 $Ycoord2 $Zcoord2

0565: create_temporary_explosion_fire $Xcoord2 $Ycoord2 $Zcoord2 2

0565: create_temporary_explosion_fire $Xcoord2 $Ycoord2 $Zcoord2 1

0565: create_temporary_explosion_fire $Xcoord2 $Ycoord2 $Zcoord2 1

0503: create_gas_smoke $Xcoord2 $Ycoord2 $Zcoord2

0503: create_gas_smoke $Xcoord2 $Ycoord2 $Zcoord2

0503: create_gas_smoke $Xcoord2 $Ycoord2 $Zcoord2

0108: destroy_object $Bomb

0002: jump ££IfDrivingSkimmer

 

:RemoveThePlane

00D6: if 0

80DC: NOT player $PLAYER_CHAR driving $Skimmer

004D: jump_if_false ££RemoveMark

0001: wait 0 ms

0002: jump ££RemoveThePlane

 

:RemoveMark

0164: disable_marker $ThePlane

0001: wait 500 ms

0002: jump ££RemoveThePlane

004E: end_thread

Link to comment
Share on other sites

Bob Ghengis Khan

I prefer mine, I'll update it with what I have now. The problem I'm having isnt dropping bombs and getting them to kill people, its getting to impart an initial velocity when I release them, instead of going staight down.

 

Who made that?

Edited by Bob Ghengis Khan
Link to comment
Share on other sites

  • 3 weeks later...

hi! i have a problem....I have an stripped SCM and the code doesn't work...

 

Can anyone say what is the external script thing????

 

damn i love the mod so much...

 

EDIT: solved the problem by replacing the script.img modified, by the original

Edited by careca
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.