Jump to content

[GTAIV|REL] VehicleWeaponsMod


Recommended Posts

 

Version 0.0.2.0 released.

Numerous changes & bugfixes.

Vehicle weapons must now be bought from shops, which you will see on your radar when you are nearby. There is a shop near each of the safehouses.

Full source code is now available!

 

 

GTA IV VehicleWeaponsMod 0.0.2.0

GhostGum - 2009

 

Installation: Put 'VehicleWeaponsMod.Net.dll' in GTA\Scripts\ directory.

Requires GTAScript.Net 0.0.3.0 - http://www.gtaforums.com/index.php?showtopic=435532

 

Usage: Vehicle Weapons Shops will be spawned at specific places on the map (mostly near safehouses), you will see a blip on your map when you are near.

Just enter the VehicleWeapons Shop blip & you will be taken to the shop menu.

 

 

 

 

Download:

bin - http://gtascript.codeplex.com/Release/Proj...ReleaseId=40240

src - http://gtascript.codeplex.com/SourceControl/list/changesets

 

Edited by GhostGum
Link to comment
https://gtaforums.com/topic/435633-gtaivrel-vehicleweaponsmod/
Share on other sites

Bugger, i just realised that i compiled this under dev version of GTAScript.Net, the released version 0.0.1.0 will not be able to run this script (missing functions were used). Give me a few mins & ill update this script to use GTAScript 0.0.1.0 so you can run it.

 

edit - okay i fixed it, download link in op updated. im going to bed & no time to test it, so if that doesnt work then ill fix it in 8 hours.

Edited by GhostGum

 

Ohhh i tried this in the .NET Hook but didnt know how to exacly. Nicely done smile.gif

I don't know how he realized this, but I did the same a few months ago and just spawned invisble peds and attatched them to the car. And if a key was pressed I simple let them shoot their weapons infront of the car.

 

But it's good work, yeah.

Yes, thats thinking outside the box! But theres a little more than just sticking 2 peds to the car. eg, how do you "simple let them shoot their weapons infront of the car."? Shooting their weapons requires a target xyz, and vector maths is not my forte! Simple solution to that too though.

Yes its 2 peds, invis, invincible, anims blocked, thinking blocked,no clip, attached to front of car, slightly lower so that gunfire comes from car bumper height. To get thier weapons to shoot infront of the car, an invis object is attached to front of car 100 meters infront, this gives them a target to shoot at. Also to stop them reloading, the ammo in thier clip is set to 99 each shot.

 

Course having peds does give us the advantage of being able to use ped commands on the weapons, such as SET_CHAR_SHOOT_RATE, SET_CHAR_WEAPON_SKILL, SET_CHAR_ACCURACY, etc.

 

Also there are commands to Get front bumper location, ill play with them next so weapon attach location can be dynamic depending on size of vehicle.

Also would be nice to spawn some models for the weapons on the car, ill have a go at that too.

Well I did it with rotatable weapons. It's very funny with a rocket launcher on top of your car and you can rotate it in any directory and shoot :-D To fire exactly infront of the ped I used:

 

 

Vector3 infront = temp_ped.GetOffsetPosition(new Vector3(0, 80, 0));GTA.Native.Function.Call("FIRE_PED_WEAPON", weapon_ped, infront.X, infront.Y, infront.Z);

 

 

I had models, too, but only for rocketlauncher ("CJ_PROP_RPG") and attached it to the ped. Of course there is a little bit space and it doesn't fit perfectly but it works and looks good enough to have fun.

 

Ohhh i tried this in the .NET Hook but didnt know how to exacly. Nicely done smile.gif

I don't know how he realized this, but I did the same a few months ago and just spawned invisble peds and attatched them to the car. And if a key was pressed I simple let them shoot their weapons infront of the car.

 

But it's good work, yeah.

Omg yeah thats briliant! Never thought of it _O_

I just wanted to mention that this mod rocks... I mean, this is truly one of my favorites... however, just a note for your next version... You should set everyone, police included to ignore the invisible men with weapons, because the police get after them/me, and peds shoot at and even chase them... this is an awesome mod though

Ill see if i can add an aiming option in next version.

About the police & peds shooting at the invis peds, i did try to stop them from doing that, but doesnt seem to have worked. Ill have another play around with it & see if i can stop that.

Havnt made any progress, bit of a break to do the whole christmas scene.

I can indeed add 2 more guns at front if you wish. Could even add a rocket laucher to roof which is aimable, plus the non aimable guns at front, plus ped at back to drop grenades, for the ultimate killing machine!

A weapons shop would be cool, as Ganbada said, so that you can purchase all the weapons upgrades to your vehicle, & mix n match as desired.

The trick with aiming will be figuring out where the player is actualy aiming, or could instead just make it rotatable like LMS said. I'm hoping ill be able to attach an obj to players machine gun hand, so that when they are aiming out the window, the aiming roof weapon can aim with them, that may run into troubles though.

Cheers for the rocket launcher model LMS, ill have a go at adding that too!

Sounds good! I've a snippet for aiming your weapons with mouse, I used this before discovering ATTACH but it worked great for me and so if you have problems with attach an object you can use this:

 

 

GTA.Native.Function.Call("SET_CHAR_ROTATION", your_ped, Game.CurrentCamera.Rotation.X, Game.CurrentCamera.Rotation.Y, Game.CurrentCamera.Rotation.Z);

 

 

That's how it works in .net scripthook by hazard but should be easy to translate to your scripthook (if you don't have the same namespaces, functions and properties).

 

Happy developing!

Brilliant! Great way to have mouse aiming. Although the aim direction wont need be perfect cos of camera offset from ped, this way you wont to be aiming with a machine gun. Ill have a go at adding this in when i get time. Cheers!

Edited by GhostGum

Awesome. 2 more guns/peds on the front of the vehicle would be sweet... as would a top mounted rocket launcher and grenades being dropped out the rear as well... I cant wait to see what you come up with...

 

Thanks for working on this smile.gif

 

Now we just need a Knight Rider Model. lol.

As far as I know, it's impossible to change the speed of a rocket via scripting, because you have no handle and therefore you have no control. The only idea I have to do this, is spawning a rocket object, create particle effects (ptfx) and move the object very fast and check for collision, if so spawn explosion and remove rocket. Maybe this can help you:

 

 

HAS_OBJECT_COLLIDED_WITH_ANYTHING

 

 

I can't try out this myself, so it's your part GhostGum, sorry about that. confused.gif

 

Edit: I've another idea, I'm not sure but in fact the rocket of a rocketlauncher can be a normal object. If so you should be able to catch it.

 

World.GetAllObjects(Model)

 

This is how it works in .net scripthook, dunno how it work's in your scripthook but you got the point, didn't you? Call this immediately after shooting and check for range so you don't get other rockets.

 

Edit2: I tried the above and it is a normal object as I supposed. Model hash in dec: 1516578222. So just get all objects in area and check for hash. The rocket has all properties of a normal object but you can't change explosiontime and even if you freeze the position it will explode after a while. It looks like a relative velocity is used, because you can change the heading without any problems and then it turns around and flyies back to you. Hope this helps you a bit with speeding up rockets. Happy new year btw wink.gif

Edited by LMS

Sry i have been quite recently, have been too busy celebrating & have not had time to work on this (or anything much).

 

Cheers for the info LMS, that is handy that rocket is a normal object, as you say, should be able to get it then apply force to it to speed it up after its fired. I dont know how HazardX gets all objects, but with GTAScript.Net i am scanning on a timer, so sadly i wont be able to get rocket object strait after firing the rocket (not without a small (20ms-ish) feeze anyway), so not sure what ill do there. Happy new year!

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.