Jump to content

Minigun and missiles help


Recommended Posts

Anurag_Anmol

I need help with a WIP CLEO Mod of mine, its an AH-6 mini-gun and rocket mod. Although, I need help with some of it.

 

 

First, the mini-gun.I did this and the rockets thing with actors, like first I made the actors, gave them weapons, set current weapon, set accuracy, invisibility, immunities, collision detection to false then put them on turret mode. Then used -

 

 

CODE DELETED

 

 

that to make them shoot. Problem is, when u turn right or left fast, they slowly turn front, but I want it to fire straight always, now how do I do that?

 

 

Second, the missiles. I again used actors, then when I shot the missiles, they looked like crap lol (No offence to Rockstar devil.gif ) I want to make missiles, like Ryosuke's Missile mods and ZAZ's Pimp my Car mod. So tell me how to do that tounge.gif

 

Thanks!

Edited by Anurag_Anmol
Link to comment
https://gtaforums.com/topic/460415-minigun-and-missiles-help/
Share on other sites

Missile

 

Thats an example

 

0172: 9@ = actor $PLAYER_ACTOR Z_angle 02F6: 7@ = sine 9@ // (float) 02F7: @ = cosine 9@ // (float) 006B: 7@ *= 50.0 // (float)006B: 8@ *= 50.0 // (float) 0013: 7@ *= -1.0 0392: make_object 1@ moveable 1 0381: throw_object 1@ velocity_in_direction7@ 18@ 3.0

 

Link to comment
https://gtaforums.com/topic/460415-minigun-and-missiles-help/#findComment-1060150599
Share on other sites

Anurag_Anmol

I don't understand sine and cosine stuff.. Whats the model of the missile of Ryosuke's and ZAZ's CLEO missiles? wow.gif Heres the code -

 

 

CODE DELETED

 

 

Sorry if I'm asking for too much sad.gif

Edited by Anurag_Anmol
Link to comment
https://gtaforums.com/topic/460415-minigun-and-missiles-help/#findComment-1060151445
Share on other sites

sorry i dont really understand it too

but just another advice:

remove the last part of the code, instead of creating a new option for shooting with both rockets and minigun:

 

:minigunwait 0if00E1:   player 0 pressed_key 17jf @rockets8@ = Car.Angle(0@)Actor.Angle(4@) = [email protected](5@) = 8@0407: store_coords_to 1@ 2@ 3@ from_car 0@ with_offset 0.0 100.0 0.00668: AS_actor 4@ rotate_and_shoot_at 1@ 2@ 3@ 100 ms0668: AS_actor 5@ rotate_and_shoot_at 1@ 2@ 3@ 100 ms:rocketswait 0if00E1:   player 0 pressed_key 4jf @minigun8@ = Car.Angle(0@)Actor.Angle(6@) = [email protected](7@) = 8@0407: store_coords_to 1@ 2@ 3@ from_car 0@ with_offset 0.0 100.0 0.00668: AS_actor 6@ rotate_and_shoot_at 1@ 2@ 3@ 100 ms0668: AS_actor 7@ rotate_and_shoot_at 1@ 2@ 3@ 100 msjump @minigun

 

 

that way

you can press them both, without that other option you added ("MinigunsAndRocketsCheck")

Link to comment
https://gtaforums.com/topic/460415-minigun-and-missiles-help/#findComment-1060151731
Share on other sites

Sine and cosine function converts angle to offset.

http://gtag.gtagaming.com/forums/index.php?showtopic=197

 

But that tuto has a mistake, cause 02F6 == sine and 02F7 == cosine.

Link to comment
https://gtaforums.com/topic/460415-minigun-and-missiles-help/#findComment-1060151789
Share on other sites

Anurag_Anmol

I still don't get sine and cosine. Although I tracked down the missile model from Pimp My Car and inspected every one in the path with MEd (lol like a detective tounge.gif) And found it! ID is 3786 smile.gif Well I'm going to finish my mod ^^ And thanks for the tips yair! But the longer the actor shoots in 0668, the worse because then the actor would like stray from the angle the player is but then go to it but slowly. But if its too short, it'll fire in bursts. If I delete MinigunsAndRocketsCheck and Firing, it wouldn't shoot at the same time. I fixed this though by putting conditions at the end of Firing of both Miniguns and Rockets and MinigunsAndRockets (Lol) which if false will go to the other checks.

Edited by Anurag_Anmol
Link to comment
https://gtaforums.com/topic/460415-minigun-and-missiles-help/#findComment-1060152085
Share on other sites

Sine and cosine helps to get offset from angle, so for example when you need to put object X in car Y at angle 60 relating to that car, then instead of doing 4589678594304 calculations of right offset, you have to just get sine from 60 for x offset and cosine from 60 to y offset. It is simple to imagine smile.gif

Link to comment
https://gtaforums.com/topic/460415-minigun-and-missiles-help/#findComment-1060152088
Share on other sites

 

I don't understand sine and cosine stuff.. Whats the model of the missile of Ryosuke's and ZAZ's CLEO missiles? wow.gif Heres the code -

 

 

:MinigunsCheck_15wait 0if and00E1:   player 0 pressed_key 1780E1:   not player 0 pressed_key 4jf @RocketsCheck_258@ = Car.Angle(0@)Actor.Angle(4@) = [email protected](5@) = 8@0407: store_coords_to 1@ 2@ 3@ from_car 0@ with_offset 0.0 100.0 0.00668: AS_actor 4@ rotate_and_shoot_at 1@ 2@ 3@ 100 ms0668: AS_actor 5@ rotate_and_shoot_at 1@ 2@ 3@ 100 msjump @MinigunsCheck_15:RocketsCheck_25 wait 0if and00E1:   player 0 pressed_key 480E1:   not player 0 pressed_key 17jf @MinigunsAndRocketsCheck_358@ = Car.Angle(0@)Actor.Angle(6@) = [email protected](7@) = 8@0407: store_coords_to 1@ 2@ 3@ from_car 0@ with_offset 0.0 100.0 0.00668: AS_actor 6@ rotate_and_shoot_at 1@ 2@ 3@ 100 ms0668: AS_actor 7@ rotate_and_shoot_at 1@ 2@ 3@ 100 msjump @RocketsCheck_25:MinigunsAndRocketsCheck_35wait 0if and00E1:   player 0 pressed_key 400E1:   player 0 pressed_key 17jf @NotDrivingCheck_108@ = Car.Angle(0@)Actor.Angle(4@) = [email protected](5@) = [email protected](6@) = [email protected](7@) = 8@0407: store_coords_to 1@ 2@ 3@ from_car 0@ with_offset 0.0 100.0 0.00668: AS_actor 4@ rotate_and_shoot_at 1@ 2@ 3@ 100 ms0668: AS_actor 5@ rotate_and_shoot_at 1@ 2@ 3@ 100 ms0668: AS_actor 6@ rotate_and_shoot_at 1@ 2@ 3@ 100 ms0668: AS_actor 7@ rotate_and_shoot_at 1@ 2@ 3@ 100 msjump @MinigunsAndRocketsCheck_35

 

 

Sorry if I'm asking for too much sad.gif

try this

 

0668: AS_actor 4@ rotate_and_shoot_at 1@ 2@ 3@ 500 mswait 500

 

 

I use the 3054 bball_col to throw and check collision

the pimpmycar missile gets it's target from mousemove-cameraview, that's a difficult calculation

 

BnB posted the kernel script to throw an object

the throw opcode needs to insert offsets, i mean coords relative to the source, in general in relation to player center

you can calculate these with sin-cosin function

sin and cosin of same z-angle calculates a point on a circle of 1.0 unit as radius

imagine the clock circle have 1.0 as radius:

set actor z_angle to 90.0 and you get the x/y point at 3'clock on the clock circle

in coordssystem is it then at x= 0.0, y= 1.0

multiplicate the result of sin/cosin with 5.0 to increase the diameter

in coordssystem is it then at x= 0.0, y= 5.0

as last assigne the unit circle to player as the circles center

then you get throw-coords infront of player no matter which z-angle he has

 

Link to comment
https://gtaforums.com/topic/460415-minigun-and-missiles-help/#findComment-1060152104
Share on other sites

Anurag_Anmol

Umm uhhhh... Heres my code so far, and I don't think I'll be using sine and cosine.

 

 

CODE DELETED

 

 

Just added the missile, hopefully it will work. Will edit with results, unless if I blow up tounge.gif

 

EDIT : Well the game crashed.. and I don't really see the need for sine and cosine for a missile. Dammit this is hard! facedesk.gif

EDIT 2 : Apparently I did some things wrong, fixed, now trying.

EDIT 3 : Game Crash again facedesk.gif Heres the code, still has problems with it (which I can't find) -

 

 

CODE DELETED

 

Edited by Anurag_Anmol
Link to comment
https://gtaforums.com/topic/460415-minigun-and-missiles-help/#findComment-1060152124
Share on other sites

{$CLEO .cs}:Objectthrow_003A4: name_thread 'OTHROW':Objectthrow_10001: wait  0 msif0256: player $PLAYER_CHAR defined004D: jump_if_false @Objectthrow_1if0AB0:   key_pressed 8//-----------------------------press backspace  004D: jump_if_false @Objectthrow_10247: request_model 3054:Objectthrow_30001: wait  0 msif0248:   model 3054     available004D: jump_if_false @Objectthrow_304C4: create_coordinate 11@ 12@ 13@ from_actor $PLAYER_ACTOR offset  0.0 5.0  0.00107: 1@ = create_object 3054     at  11@ 12@ 13@04D9: object 1@ set_scripted_collision_check  10382: set_object 1@ collision_detection  1wait  20000392: object 1@ toggle_in_moving_list  10381: throw_object 1@ distance 0.0  5.0  15.0wait  5000Object.Destroy(1@)0249: release_model 30540002: jump @Objectthrow_1

 

Link to comment
https://gtaforums.com/topic/460415-minigun-and-missiles-help/#findComment-1060153062
Share on other sites

Anurag_Anmol

YES! It workz! Thank you ZAZ! Except CJ got destroyed (RIP CJ)

Just need to scale the rocket down a bit, make smoke trail, make missile go in right direction, etc. Heres the script.

 

 

CODE DELETED

 

Edited by Anurag_Anmol
Link to comment
https://gtaforums.com/topic/460415-minigun-and-missiles-help/#findComment-1060153259
Share on other sites

YES! It workz! Thank you ZAZ! Except CJ got destroyed (RIP CJ)

Just need to scale the rocket down a bit, make smoke trail, make missile go in right direction, etc. Heres the script.

 

 

:RocketsCheck_25if and00E1:   player 0 pressed_key 480E1:   not player 0 pressed_key 17jf @MinigunsAndRocketsCheck_35:RocketsFiring_30wait 00407: store_coords_to 1@ 2@ 3@ from_car 0@ with_offset 1.4 1.0 -1.49@ = Object.Create(3786, 1@, 2@, 3@)10@ = Car.Angle(0@)Object.Angle(9@) = 10@0392: make_object 9@ moveable 104D9: object 9@ set_scripted_collision_check  1Object.CollisionDetection(9@) = True06A2: get_car 0@ velocity_in_direction_XYZ 1@ 2@ 3@2@ += 50.00381: throw_object 0@ velocity_in_direction 0.0 2@ 10.00392: object 9@ toggle_in_moving_list  1:CollisionDetection_32wait 0if04DA:   has_object 9@ collidedjf @CollisionDetection_3201BB: store_object 9@ position_to 1@ 2@ 3@ 0948: create_explosion_at 1@ 2@ 3@ type 11 camera_shake 5.0 Object.Destroy(9@)if or80E1:   not player 0 pressed_key 400E1:   player 0 pressed_key 17jf @RocketsFiring_30

 

yeah go ahead smile.gif

 

 

08D2: object 347@(39@,10i) scale_model 0.3 066D: 100@ = attach_particle "SMOKE_FLARE" to_object 94@ with_offset 0.0 0.0 0.1 flag 1 

 

 

 

and you know the coord opcodes wink.gif

Link to comment
https://gtaforums.com/topic/460415-minigun-and-missiles-help/#findComment-1060153263
Share on other sites

 

 

EDIT : Something is wrong here -

 

 

yes, 3786, missile_05_SFXR isn't good for throwing and checking collision

the missile needs the same settings in object.dat like bball_col

open object.dat, go to the line of bball_col and add a line for missile_05_SFXR

 

bball_col        10.0,        10.0        1.00,        0.3,        50.0,        0.0,     0.1,    0,    2,    1,     0,    0,    0.0, 0.0, 0.0,        nonemissile_05_SFXR        10.0,        10.0        1.00,        0.3,        50.0,        0.0,     0.1,    0,    2,    1,     0,    0,    0.0, 0.0, 0.0,        none

 

Edited by ZAZ
Link to comment
https://gtaforums.com/topic/460415-minigun-and-missiles-help/#findComment-1060154208
Share on other sites

Anurag_Anmol

@Deji and ZAZ - The problem is that the missile goes the wrong way. Oh yeah and it loses speed fast, so it goes like a few meters then stops in air. And smoke also doesn't work.

@The_Siggi - It isn't the full script, its just the part where the problem is.

 

EDIT : Put the line for the missile in the objects file, does't stop in mid air now smile.gif

 

Here is the full script -

 

 

CODE DELETED

 

Edited by Anurag_Anmol
Link to comment
https://gtaforums.com/topic/460415-minigun-and-missiles-help/#findComment-1060154418
Share on other sites

Sorry, I never got a chance to finish my post with the mini-tutorial on sine/cosine. Meh...

 

Goes the wrong way? Is that perhaps cause you altered the angle by 270?

 

 

8@ = Car.Angle(0@)8@ += 270.0Object.Angle(9@) = 8@069A: attach_object 9@ to_object 10@ with_offset 0.0 0.0 0.0 rotation 0.0 0.0 0.002F6: 16@ = sine 8@ // (float)02F7: 17@ = cosine 8@ // (float)16@ *= 10.017@ *= 10.0

 

 

Or is that the way you wanted it to go? I shouldn't be posting and especially coding at this time of the morning... But try this:

 

 

8@ = Car.Angle(0@)8@ += 270.0Object.Angle(9@) = 8@069A: attach_object 9@ to_object 10@ with_offset 0.0 0.0 0.0 rotation 0.0 0.0 0.08@ = Car.Angle(0@) // this line is in case your problem is that the missile flies sideways02F6: 16@ = sine 8@ // (float)02F7: 17@ = cosine 8@ // (float)// bigger value == greater distance && greater speed16@ *= 40.017@ *= 40.0

 

Link to comment
https://gtaforums.com/topic/460415-minigun-and-missiles-help/#findComment-1060154821
Share on other sites

Anurag_Anmol

Thanks Deji! I forgot that 270.0 addition, it was to make the missile face the front. smile.gif

Thanks, trying smile.gif Will edit the post with the results!

 

Results The missile doesn't move, the smoke doesn't work either. Tried to use 095C, but didn't work either.

 

 

CODE DELETED

 

Edited by Anurag_Anmol
Link to comment
https://gtaforums.com/topic/460415-minigun-and-missiles-help/#findComment-1060154914
Share on other sites

Umm sorry for double posting... I mean uhh triple posting but I pretty much done my script and umm have only 3 problems.

 

1 - Muzzle flashes not working, Do I need to load their model or something? Heres the muzzle flash part -

 

 

CODE DELETED

 

 

2 - I need to make the missiles go down and up. Well I dunno how to do that either so umm help meeeeee

 

3 - Missile goes in opposite direction (wtf) like when heli's Z angle is 45.0, missile goes 315, or like if Z angle is 90.0, then missile goes 270.0 and etc. Heres the missile's code -

 

 

CODE DELETED

 

Edited by Anurag_Anmol
Link to comment
https://gtaforums.com/topic/460415-minigun-and-missiles-help/#findComment-1060162685
Share on other sites

 

Umm sorry for double posting... I mean uhh triple posting but I pretty much done my script and umm have only 3 problems.

 

 

1. read cleo script tut-theme: Particle Effects

2. throw it again with new offsets

3. add 180.0 to the angle

Link to comment
https://gtaforums.com/topic/460415-minigun-and-missiles-help/#findComment-1060162694
Share on other sites

3. If your are using this code then remove 0013: 7@ *= -1.0

 

 

0172: 9@ = actor $PLAYER_ACTOR Z_angle 02F6: 7@ = sine 9@ // (float) 02F7: @ = cosine 9@ // (float) 006B: 7@ *= 50.0 // (float)006B: 8@ *= 50.0 // (float) 0013: 7@ *= -1.0 0392: make_object 1@ moveable 1 0381: throw_object 1@ velocity_in_direction7@ 18@ 3.0

 

Link to comment
https://gtaforums.com/topic/460415-minigun-and-missiles-help/#findComment-1060162771
Share on other sites

1 - OK thanks, I thought particles automatically becomes visible after its made but I was wrong, and I didn't know you could open effects.fxp with notepad.

 

2 - Thats the problem, I don't know how to make it go downwards/upwards. Just getting the x/y angle and using that for the throw directly won't really work. And what offsets do I use for the second throw? (more importantly, how do I get them?)

 

3 - I tried that, but the angle is (strangely) opposite of the actual angle. And there's no 7@ *= -1.0.

Link to comment
https://gtaforums.com/topic/460415-minigun-and-missiles-help/#findComment-1060162848
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
  • 0 User Currently Viewing
    0 members, 0 Anonymous, 0 Guests

×
×
  • Create New...

Important Information

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