Quantcast

Jump to content

» «
Photo

Vehicle Guns, CLEO version

4 replies to this topic
gtaragemachine
  • gtaragemachine

    Livin on the Edge...of my chair

  • Members
  • Joined: 09 Jan 2008

#1

Posted 08 November 2009 - 04:09 PM Edited by gtaragemachine, 10 November 2009 - 09:48 PM.

A long time ago I converted PLPynton's Vehicle Guns mod to a CLEO. Well, I wanted to share this with others since it is such a great mod, but I thought I'd post it here first to see if anyone knows of any problems with it as far as saving after using it (it doesn't destroy the minigun after you get out of the vehicle, so I don't know if that could corrupt a save or not).

I set the controls as:
[Fire] + [Horn] = Installs guns on vehicle and enables mine dropping
[Secondary Fire] = Fires gun
[Conversation Yes] = Sets mine
[Camera Change] or exit vehicle = removes guns

EDIT: This code is now complete without any objections.

The code (sorry for the size, I debated whether to link a file or not):
CODE
{$CLEO .cs}

:VGUNS
thread 'VGUNS'

:VGUNS_11
wait 50
if
Player.Defined($PLAYER_CHAR)
else_jump @VGUNS_11
if
Actor.Driving($PLAYER_ACTOR)
jf @VGUNS_50
03C0: 0@ = actor $PLAYER_ACTOR car
1@ = Car.Model(0@)
07E4: get_model 1@ dimensions_cornerA_to 2@ 3@ 4@ dimensions_cornerB_to 5@ 6@ 7@
if and
00E1:   player 0 pressed_key 17
00E1:   player 0 pressed_key 18
jf @VGUNS_200
jump @VGUNS_647

:VGUNS_50
Car.RemoveReferences(0@)
0108: destroy_object 20@
0108: destroy_object 21@
jump @VGUNS_11

:VGUNS_200
if
80E1:   NOT player 0 pressed_key 13
jf @VGUNS_50
if
80E1:   not player 0 pressed_key 4
jf @VGUNS_207
if
80E1:   not player 0 pressed_key 11
jf @VGUNS_1016
jump @VGUNS_11

:VGUNS_207
if
03CA:   object 20@ exists
03CA:   object 21@ exists
jf @VGUNS_11
0087: 8@ = 5@ // (float)
8@ *= 0.61
0087: 9@ = 5@ // (float)
9@ *= -0.61
0087: 10@ = 6@ // (float)
10@ *= 0.95
0087: 11@ = 7@ // (float)
11@ *= 0.23
0208: 2@ = random_float_in_ranges -1.0 1.0
0208: 3@ = random_float_in_ranges -1.0 1.0
0208: 4@ = random_float_in_ranges -1.0 1.0
005B: 2@ += 8@ // (float)
005B: 3@ += 9@ // (float)
005B: 4@ += 11@ // (float)
0407: store_coords_to 12@ 13@ 14@ from_car 0@ with_offset 2@ 100.0 4@
0407: store_coords_to 15@ 16@ 17@ from_car 0@ with_offset 8@ 10@ 11@
06BC: create_M4_shoot_from 15@ 16@ 17@ target 12@ 13@ 14@ energy 90
0407: store_coords_to 12@ 13@ 14@ from_car 0@ with_offset 3@ 100.0 4@
0407: store_coords_to 15@ 16@ 17@ from_car 0@ with_offset 9@ 10@ 11@
06BC: create_M4_shoot_from 15@ 16@ 17@ target 12@ 13@ 14@ energy 90
09F1: play_audio_at_actor $PLAYER_ACTOR event 1157
066C: 2@ = attach_particle "GUNFLASH" to_car 0@ with_offset 8@ 10@ 11@ rotation 0.0 1.0 0.0 flag 1
066C: 3@ = attach_particle "GUNFLASH" to_car 0@ with_offset 9@ 10@ 11@ rotation 0.0 1.0 0.0 flag 1
064C: make_particle 2@ visible
064C: make_particle 3@ visible
064F: remove_references_to_particle 2@
064F: remove_references_to_particle 3@
jump @VGUNS_11

:VGUNS_647
Model.Load(#MINIGUN)

:VGUNS_677
wait 0
if
Model.Available(#MINIGUN)
jf @VGUNS_677
0087: 8@ = 5@ // (float)
8@ *= 0.63
0087: 9@ = 5@ // (float)
9@ *= -0.63
0087: 10@ = 6@ // (float)
10@ *= 1.0
10@ -= 1.4
0087: 11@ = 7@ // (float)
11@ *= 0.23
11@ += 0.23
20@ = Object.Create(#MINIGUN, 0.0, 0.0, 0.0)
21@ = Object.Create(#MINIGUN, 0.0, 0.0, 0.0)
0681: attach_object 20@ to_car 0@ with_offset 8@ 10@ 11@ rotation 0.0 29.0 92.4
0681: attach_object 21@ to_car 0@ with_offset 9@ 10@ 11@ rotation 0.0 29.0 92.4
wait 500
jump @VGUNS_11

:VGUNS_1016
wait 0
if and
03CA:   object 20@ exists
03CA:   object 21@ exists
jf @VGUNS_11
if
18@ == 10
jf @VGUNS_1052
18@ = 0
jump @VGUNS_11

:VGUNS_1052
if
03CA:   object 19@(18@,10i) exists
jf @VGUNS_1207
if
0366:   object 19@(18@,10i) damaged
jf @VGUNS_1108
Object.Destroy(19@(18@,10i))
jump @VGUNS_1193

:VGUNS_1108
Object.StorePos(19@(18@,10i), 8@, 9@, 10@)
Actor.StorePos($PLAYER_ACTOR, 5@, 6@, 7@)
050A: 11@ = distance_between_XYZ 8@ 9@ 10@ and_XYZ 5@ 6@ 7@
if
11@ > 50.0
jf @VGUNS_1193
Object.Destroy(19@(18@,10i))

:VGUNS_1193
18@ += 1
jump @VGUNS_1016

:VGUNS_1207
Model.Load(1225)

:VGUNS_1230
wait 0
if
Model.Available(1225)
jf @VGUNS_1230
if
Player.Defined($PLAYER_CHAR)
jf @VGUNS_11
3@ += -0.6
0407: store_coords_to 2@ 3@ 4@ from_car 0@ with_offset 0.0 3@ 0.0
02CE: 4@ = ground_z_at 2@ 3@ 4@
4@ += -0.45
19@(18@,10i) = Object.Init(1225, 2@, 3@, 4@)
Model.Destroy(1225)
wait 400
jump @VGUNS_11
0A93: end_custom_thread

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci Racing
  • Joined: 24 Dec 2007
  • None

#2

Posted 08 November 2009 - 11:12 PM

My Ultimate CLEO Trainer had this feature. It too had the problem that the miniguns stayed on the car after CJ left. It's something easily fixable. But apart from memory problems (if the objects/car are always referenced, the game will be slower) there should be no issues with this. When you save a game, only the important information is installed. This is the Global variables, settings ect. but not local variables, so objects and cars stored in local variables will not be loaded when you load the game next time around. So no long term damage will be encountered, just the issue of game memory usage if a large amount of cars are referenced and a large amount of miniguns are created. But it's no biggie.

gtaragemachine
  • gtaragemachine

    Livin on the Edge...of my chair

  • Members
  • Joined: 09 Jan 2008

#3

Posted 09 November 2009 - 02:00 PM Edited by gtaragemachine, 09 November 2009 - 07:31 PM.

Thanks for that info Deji. I never knew what exactly got saved, so you definitely helped clear that up for me. I also didn't know about your Ultimate CLEO Trainer. I'll have to check that out. cookie.gif

One more question for anyone in a helping mood. When I commented out the counters and counter display it messed it up to where if you get in a second car it still fires the miniguns even though they visibly aren't there. Is there an easy check I can place somewhere to fix that? I'm assuming it's fairly simple to you coders, but for me I've been wrestling with this for two days and getting nowhere. suicidal.gif

EDIT: I fixed it so the guns disappear when you keypress [camera change] or if you exit the vehicle. I also fixed it so the double keypress works correctly to install guns. I also fixed it so the gunfire only happens after you install the miniguns. Lastly, I made it so you can only drop the mines if the guns are loaded.

This code is good to go now as far as I know. Any final comments or critiques are welcome. Also, should I post this in PLPynton's initial thread or what?

jack159
  • jack159

    Player Hater

  • Members
  • Joined: 02 Aug 2011

#4

Posted 02 August 2011 - 04:37 AM

Has this mod been uploaded? If not can I credit you in the readme and post it?

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci Racing
  • Joined: 24 Dec 2007
  • None

#5

Posted 02 August 2011 - 09:33 AM

Yes the mod has been uploaded but I don't support it. And I see know sense in me being "credited" in the readme of a mod I created entirely... It would be best to just leave the original readme.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users