Quantcast

Jump to content

» «
Photo

[BETA] GTAIV .Net ScriptHook

2,937 replies to this topic
HazardX
  • HazardX

    pedestrian mangler

  • Members
  • Joined: 13 Dec 2008

#1

Posted 14 January 2009 - 10:24 PM Edited by HazardX, 10 July 2013 - 05:28 AM.

GTAIV .Net Script Hook v1.7.1.7 BETA

by Hazard ([email protected])
based on the GTAIV C++ Script Hook from Aru
Classes Vector2, Vector3, Vector4, Quaternion and Matrix based on sourcecode from SlimDX


- DOWNLOAD the GTAIV .Net Script Hook HERE !

Some may also be interested in the full C++/CLI sourcecode of the GTAIV .Net Script Hook.


Max. supported game versions:
GTA IV 1.0.7.0
EFLC 1.1.2.0




Description

This ASI plugin allows you to run ingame GTAIV scripts written in any .Net language. Those languages are easy to learn and use, while they are still extremely powerful.
One noteable aspect of this hook is, that the scripting functions are organized in a .Net-typical class structure, which makes finding functions intuitive and easy.
And since you are able to develop scripts with Visual Studio, you'll get all benefits like code highlighting and IntelliSense.

You need an AsiLoader to use this plugin in GTAIV. See the Requirements section below for more info.

Special thanks to Aru for his help and for his C++ Script Hook. This plugin wouldn't be possible without it.


Disclaimer

This software is provided 'as-is', without any explicit or implied warranty. The author(s) cannot be held accountable for any damage that might be caused by this software or any of it's components.


Requirements

Required to run this plugin are:

- A valid installation of GTA IV or EFLC patched to any of the following versions:
GTA IV: version 1.0.1.0 up to version 1.0.7.0
EFLC: version 1.1.1.0 up to version 1.1.2.0

- Microsoft .Net Framework 4 and the Microsoft Visual C++ 2010 Redistributable Package (x86) installed on your machine
- Any AsiLoader installed for GTA IV


I included download links below. If the application crashes or behaves in an unwanted manner then download and install those updates/tools.

- Microsoft .Net Framework 4 - DOWNLOAD
- Microsoft Visual C++ 2010 Redistributable Package (x86) - DOWNLOAD (Make sure to install the linked x86 version, even on x64 systems!)

- Alexander's AsiLoader - FORUM LINK
- listener's XLiveLess, including an AsiLoader - FORUM LINK
- YAASIL - Yet Another ASI Loader - FORUM LINK


Troubleshooting

If you get a "MSVCR100.dll not found" error:
Try installing the Microsoft Visual C++ 2010 Redistributable Package! Make sure to install the linked x86 version, even on x64 systems!

If you get crashes and are using GTA IV version 1.0.4.0 or older, try to install this older version of the C++ ScriptHook, which works fine with the current .Net ScriptHook.


Installation

- EASY:

Extract the complete archive into your GTAIV installation folder.


- DETAILED:

Extract the complete archive into your GTAIV installation folder.

Make sure that the ScriptHookDotNet.asi file is in your main GTAIV folder, or any other folder that is supported by your AsiLoader.
The ScriptHook.dll (which is aru's C++ ScriptHook) should always be located in your main GTAIV folder, otherwise the .Net ScriptHook will be unable to find it! (thanks to Zach for pointing this out)
There may already be a ScriptHook.dll present. This is fine, because many mods use this file. In this case, check which one of the two files is newer and keep that.

Only the ScriptHookDotNet.asi and ScriptHook.dll files are required to run scripts.

All files in the "scripts\for Developers" subfolder are only required if you want to write own scripts. Look at the "Writing new scripts" section for more infos on this.


Script Installation

Scripts for the DotNet Script Hook have to be copied to the "scripts" subfolder of your GTAIV installation directory. You may have to create the folder if it is not there.

DotNet scripts may have one of the following file formats:
*.vb - for plain VisualBasic.Net scripts
*.cs - for plain C# scripts
*.net - for compiled scripts in any .Net language
*.net.dll - for compiled scripts in any .Net language


Writing new scripts

You should extract the "for Coders" folder from this archive to any folder you want. It contains example projects for you to start with. You could just edit the vb or cs script files with Notepad and copy the resulting script to the "scripts" subfolder of your GTAIV directory.

You can use the Class Reference Documentation to find out which classes or methods are available.

However, coding will be MUCH more comfortable and easy if you use Visual Studio 2010 to edit your scripts. Look below for a free download. Open the SLN Project files with Visual Studio to get ready-to-compile script examples. Use those examples as a base for your own scripts.
If you want to create a completely new VS project, make sure that you add a reference to the included ScriptHookDotNet.dll.
This file is ONLY required for coding. On runtime, your scripts will automatically use the ScriptHookDotNet.asi that is located in your GTAIV directory. Thus you don't need to bundle your script with one of those files when you want to release it. If you don't want to release the plain vb or cs script files, you can use the compiled DLL. You just have to make sure that the file ends to ".net.dll" or just ".net"!

If a script does not run, take a look at the logfile ScriptHookDotNet.log . It will write down all errors that occur during compiling or runtime.

Do NOT include ScriptHookDotNet.asi or ScriptHookDotNet.dll or ScriptHook.dll in the release of your script! Link to this thread instead!

- Free Visual Studio Express 2010 downloads (registration is free too)


Deinstallation

Just delete the ScriptHookDotNet.asi from your GTAIV folder.

Scripts contained in the "scripts" subfolder can remain there if you wish to keep them. They wont run or interfere with the game when ScriptHookDotNet.asi is deleted.


Changelog

Version 1.7.1.7 BETA:
- Fixed Blip.Delete always causing an exception.
- Added Vehicle.LightsOn property to determine whether the front lights are turned on. (by LMS)
- Changed Vehicle.FixTire to also restore the correct tire model. (by LMS)
- Some more NonExistingObjectException checks.

Version 1.7.1.6 BETA:
- Stability improvements and additional NonExistingObjectException checks. (IMPORTANT)
- Added "Flip" command to the console to bring a flipped car on its wheels again.

Version 1.7.1.5 BETA:
- Accessing a member function of an object that doesn't exist in-game anymore will now throw a NonExistingObjectException that can easily be caught in a Try-Block.
- Added InteriorLightOn, CanTiresBurst, IsTireBurst, BurstTire, FixTire methods to the Vehicle class.

Version 1.7.1.4 BETA:
- Added support for GTA IV version 1.0.7.0 and EFLC version 1.1.2.0
- Added Game.CurrentEpisode property
- Added TLAD and TBOGT weapon names to the Weapon enumeration.

Version 1.6.1.3 BETA:
- Fixed a bug where the RelationshipGroup of Peds returned the wrong value.
- Fixed many potential crash issues.
- Added better way of handling metadata via the cool new dynamic objects introduced in .Net 4 .
old usage: object.SetMetadata(Of Integer)("MyValueName", False, newvalue)
new usage: object.Metadata.MyValueName = newvalue
- The changes are non-breaking! The old way of handling metadata still works, but is marked as "deprecated".

Version 1.6.1.2 BETA:
- Fixed a problem that prevented uncompiled .cs scripts from being loaded.
- Includes the "for Developers\bin" folder again, containing the ScriptHookDotNet.dll
- Reference the above DLL in VS2010 script projects to get IntelliSense comments.

Version 1.6.1.1 BETA:
- MANY THANKS to LMS ([email protected]), who helped me to solve the crashing problems i was unable to fix on my own!
- Added support for GTA IV version 1.0.6.0 and EFLC version 1.1.1.0
- Using .Net Framework 4 now ( make sure to install it and also recompile your scripts for .Net 4, too! )
- Changed versioning. Format: 1.(max supported game patch).(major release).(revision)
- Changed the handling of Components in Ped.Skin/Player.Skin
- Blip.Display is an enumeration now
- Native.Function.Call accepts Camera objects as parameter now
- Warning: Phone dial events still do not work on Windows 7!

Version 0.893 BETA:
- Fixed the Vehicle.Rotation property
- Fixed mixed-up parameter names in some SettingsFile.SetValue overloads
- Fixed some potential SettingsFile problems in other windows language versions (hopefully).
- The graphcis scaling will be resetted to Pixel now before a Form gets drawn
- Errors will always be logged in english now.
- Added some descriptions to methods and properties that aren't self-explanatory
- Added boolean overloads for SettingsFile.GetValue and Setvalue
- Renamed the Vehicle.Color properties to Color, SpecularColor, FeatureColor1 and FeatureColor2 for convenience
- AccessViolationExceptions correctly terminate the causing script now.
- Scripts with a filename in format "myscript.net.dll" also use the default settings file "myscript.ini" now.
- Fixed a problem where Exists() still returned true for invalid vehicles

Version 0.892 BETA:
- Added Texture class and Graphics.DrawSprite methods
- Added TextureDrawingExample which draws a simple RPM gauge next to the radar while driving
- Added GTA.Forms.Imagebox control
- Improved drawing performance of windows generated with GTA.Forms
- Integrated Vector2, Vector3, Vector4, Quaternion and Matrix classes from SlimDX for advanced vector operations
- Fixed ApplyForce to take world vectors and added ApplyRelativeForce for object vectors
- Added Model.GetDimensions functions to retrieve the size of a model
- The player keeps weapons, armor, health and wanted level on a model change now
- Revamped the Timer class to be more convenient
- Several Font properties can now only be assigned on Font creation. This prevents a potential memory leak.
- A bunch of new functions in several classes (thanks CoMPMStR and Intosia)
- Yet again some breaking changes. Check your scripts!

Version 0.891 BETA:
- Fixed a problem that resulted in keystrokes not being catched by other mods
- Fixed a bug that drew some text messages at the wrong position when using ScreenUnits scaling.

Version 0.890 BETA:
- Using the same DirectX version as GTA4 now. No need to update it anymore. (thanks to bean_xp for the hint)
- Fixed a problem with errors complaining about the missing method WaitHandle.WaitOne(Int32)
- Fixed a major bug that resulted in a new object being generated every time you retrieve a ped, vehicle or object, even when you retrieved the same thing earlier. This broke MANY things in v0.88!

Version 0.880 BETA:
- Added support for game versions 1.0.3.0 and 1.0.4.0
- All drawing is done via Direct3D now (thanks to aru for the integrated Direct3D hook)
- due to the switch to Direct3D many of the Graphics methods have changed a little bit
- GTA.Timer has an Interval and a Tick event now. Tick will fire at each Interval when Interval is > 0.
- Abandoned Blips and Cameras will be disabled and deleted on "ReloadScripts" now.
- Fixed a problem that prevented local metadata from being accessed inside PerFrameDrawing
- Fixed a problem that prevented to get the position of a blip (including the waypoint)
- Added "Teleport WP" console command, which teleports you directly to your current waypoint.
- Added new GTA.Forms namespace for window and control drawing along with mouse input.
- Added Button, Checkbox, ColorDialog, Keybox, Label, Listbox, Scrollbar and Textbox controls.
- Added Light and Checkpoint classes to make them easier to use (DrawLight and DrawCheckpoint methods have been removed)
- Added ability to save setting files (and renamed them from GTA.value.ScriptSettings to GTA.SettingsFile)
- Added DriveTo tasks that do not require a specific car (will use the current car or steal one)
- Added most Pickup functionality
- Added Garage functionality
- Added methods to retrieve ALL peds, vehicles and objects currently loaded in game memory. (be aware: this includes player and mission peds/vehicles too!)
- Added method to get the Ped you currently aim at.
- Added methods to iterate through all active objects with a specific model
- Added SkinTemplate class and Ped.Skin allows you to edit components and props now.
- Added a WindowExample script to show off some of the new GTA.Forms functionality

Version 0.860 BETA:
- removed Startup from scripts. You can now use all functions and also Wait() inside the constructor.
- Replaced all events that required a method override with actual events, conformant with the .Net standard.
- Updated the examples accordingly. Look at them to see how to apply the changes to your scripts.
- The PhoneNumberDialed event is now also available in game version 1.0.1.0
- some other minor changes

Version 0.850 BETA:
- fixed serveral bugs in the new threading architecture
- fixed all reported AccessViolations
- fixed custom cameras. they work now as intended.
- added ScriptCommands to allow communication between scripts (see the included ScriptCommunication example)
- added easy settings (ini) file support (just access "Settings" in your scripts)
- added methods to store Metadata for Objects. Metadata can be stored/read as long as the object exists.
- added ability to catch dialed phone numbers in scripts (PhoneNumberDialed & BindPhoneNumber)
- added "ScriptHelp" console command, which displays general info and bound console commands of scripts.
- added more functions to the Graphics class.
- you can scroll in the console now using the PageUp/Down keys (hold Shift to get to start/end immediately)
- use Shift + NumpadPlus/Minus to grow/shrink the console
- more stuff, as usual

Version 0.840 BETA:
- Complete rewrite of the internal scripting and thread structure. Crashes on Game & Script reloading should be gone now!
- added easy to use Euphoria (NaturalMotion) helpers to the Ped class
- added BindKey and BindConsoleCommand to Scripts - thanks to diryboy for the idea!
- added ApplyForce function to Peds, Vehicles and Objects
- the Font width is now determined based on the screen resulution. Use Font.EnforcedWidth to set a custom width.
- added "Scaling" to the Font class, which allows you to scale fonts by Pixels, FontSize or ScreenUnits.
- added Euphoria example (demonstrating Zombie-like movement)
- added BindKey, BindConsoleCommand and PerFrameDrawing examples
- even more stuff

Version 0.820 BETA:
- added an ingame console (tilde key) and some commands for it. type "help" for infos.
- added ConsoleCommand function to scripts, to allow custom console commands
- added console command to reload all scripts during the game and another one to minimize the game window.
- added PerFrameDrawing function to scripts to allow drawing of a simple GUI for scripts
- added Font class to allow custom font styles in PerFrameDrawing
- added basic support for NaturalMotion messages (NmMessage class)
- added simple custom console command example
- key events will trigger now for ALL keys in ALL scripts now. Don't forget to add key checks to your KeyDown events!!!
- WatchKey is no longer needed and was removed
- improved ragdoll commands
- added more functions for positions, directions, offsets, etc. to several objects
- lots of other new functions and bugfixes, as always

Version 0.800 BETA:
- added support for game version 1.0.2.0 (thanks to aru)
- fixed several crashing problems in the constructor of scripts
- Improved performance alot (especially when accessing many objects)
- You can now call Wait() inside Startup() of your script
- It will now reject to load scripts in ranked Multiplayer. thanks to C06alt for the great idea!
- Added basic Object and Animation support
- Added a script example that uses an external configuration file. thanks to CoMPMStR for the idea!
- Added a script example that'll make you smoke a spliff. wink.gif thanks to iriedreadlock23 for the infos!
- Added a script example that syncs ingame time with realtime
- Improved existing examples
- some minor renames again
- Added more functions, tasks and a bit of everything

Version 0.730 BETA:
- renamed Ped.Tasks to Ped.Task ( sorry, i HAD to do it... it was ugly ^^)

Version 0.720 BETA:
- Scripts reload now if the game reloads
- Fixed wrong color values
- Renamed many functions to make more sense (don't complain, i warned you wink.gif )
- more examples (including the more complex AnyTaxiScript)
- new Classes/Functionality:
-> Many Tasks and TaskSequences for Peds
-> Native Function support (Native.Function.Call)
-> Minimal Camera support
-> Minimal Blip support
-> MANY more small things... smile.gif

Version 0.700 BETA:
- First public beta release


Known Issues

Not all script functions have been tested. Some of them may not work as desired or may even lead to crashes.


Infos for Webmasters

Feel free to add this plugin as a download to your site as long as you give proper credit. However, as long as it is technically possible, please DON'T upload it to other webservers. Best way would be to link to this thread or at least direct-link my download from your page to assure that people always get the latest version!

Example code

A full bodyguard script (in VB and C#) is included in the download.

Carspawn and skinchange script written in VB.Net:
user posted image

Invincibility script written in C#:
user posted image

Screenshot of the ingame console:
user posted image
  • HippieCommunist, AngryAmoeba and Michael De Santa ™ like this

Graphix14
  • Graphix14

    New York

  • Members
  • Joined: 04 Apr 2007

#2

Posted 14 January 2009 - 10:34 PM

Excellent Job! Very useful.

Lyall
  • Lyall

    Clocker

  • Members
  • Joined: 25 Dec 2008

#3

Posted 14 January 2009 - 10:48 PM

This is brilliant. Good job! biggrin.gif . Many people use VB.NET so this should prove popular.

boomer678
  • boomer678

    Mark Chump

  • Members
  • Joined: 02 Jan 2009

#4

Posted 14 January 2009 - 10:56 PM Edited by boomer678, 14 January 2009 - 11:06 PM.

DUDE!! thank you. i know VB so good. i just cant wait to try this out
**EDIT
Gotta download VB again. ( formated my computer ) *SADFACE*

blazer30uk
  • blazer30uk

    Player Hater

  • Members
  • Joined: 05 Dec 2008

#5

Posted 14 January 2009 - 11:34 PM

nice work mate biggrin.gif
i like it,
icon14.gif

boomer678
  • boomer678

    Mark Chump

  • Members
  • Joined: 02 Jan 2009

#6

Posted 15 January 2009 - 01:47 AM

I posted a Test VB script go look at it

Intosia
  • Intosia

    I'm random! ^^

  • Members
  • Joined: 11 Dec 2008

#7

Posted 15 January 2009 - 09:44 AM

Damn you! Now the noobs can make mods to!

J/k, good job man biggrin.gif

aru
  • aru

    *poof*

  • Members
  • Joined: 20 Jun 2005

#8

Posted 15 January 2009 - 10:07 AM

Good work HazardX! Liking the wrapped interfaces... smile.gif
  • HippieCommunist likes this

xmen
  • xmen

    Foot Soldier

  • Members
  • Joined: 02 Jun 2005

#9

Posted 15 January 2009 - 11:37 AM

extremely good job icon14.gif

tf2
  • tf2

    Player Hater

  • Members
  • Joined: 15 Jan 2009

#10

Posted 15 January 2009 - 11:39 AM

Will this work online after i have joined single player or is that something to do with the c++ stuff?

@anti mutiplayer modding morons:

My intentions are ONLY for freeroam usage with friends.

HazardX
  • HazardX

    pedestrian mangler

  • Members
  • Joined: 13 Dec 2008

#11

Posted 15 January 2009 - 12:13 PM Edited by HazardX, 15 January 2009 - 02:53 PM.

@all: Thanks for the positive feedback so far. I'm glad you like it. smile.gif Feel free to comment if you don't like anything or got an idea on how to improve it.

QUOTE (tf2 @ Jan 15 2009, 11:39)
Will this work online after i have joined single player or is that something to do with the c++ stuff?

@anti mutiplayer modding morons:

My intentions are ONLY for freeroam usage with friends.

It has the same problems as the C++ hook currently, but i'm trying to fix it.

[EDIT] I found a way to reload the scripts after game reloading. happy.gif i'll include it in the next version of the hook.
  • HippieCommunist likes this

basketballjones
  • basketballjones

    Player Hater

  • Members
  • Joined: 26 Jun 2005

#12

Posted 15 January 2009 - 12:59 PM

is the list of objects/variables going to be extended to all of the same things that the c++ hook covers?
even those in the scriptingdirty.h (eventually)

HazardX
  • HazardX

    pedestrian mangler

  • Members
  • Joined: 13 Dec 2008

#13

Posted 15 January 2009 - 01:20 PM

QUOTE (basketballjones @ Jan 15 2009, 12:59)
is the list of objects/variables going to be extended to all of the same things that the c++ hook covers?
even those in the scriptingdirty.h (eventually)

Well yes, the target is to get full GTA4 scripting functionality with this. At the moment the amount of classes and contained functions is still limited. It takes alot of time to implement those functions into a easy-to-use class structure. however, the main problem is that a lot of stuff is still unknown/undocumented, whcih makes it very hard to implement those.

basketballjones
  • basketballjones

    Player Hater

  • Members
  • Joined: 26 Jun 2005

#14

Posted 15 January 2009 - 01:43 PM

k kewl. i just see that there is a SetCamShake function in scriptingdirty.h that might be of some use to those people who hate the how the camera acts. (ie me)
there's a way to reuse the dash cam but it jumps all over the place, but maybe that is a way to switch it off.

btw.. great job.. i was looking for a .net hook smile.gif

HazardX
  • HazardX

    pedestrian mangler

  • Members
  • Joined: 13 Dec 2008

#15

Posted 15 January 2009 - 02:09 PM

i'll try to get more camera functionality ready for the next release. i hope to be able to include a GTA2-camera mod as an example. smile.gif

AnttiAnA
  • AnttiAnA

    Player Hater

  • Members
  • Joined: 12 Dec 2008

#16

Posted 15 January 2009 - 04:34 PM

I hope you can solve the multiplayer problem biggrin.gif

tf2
  • tf2

    Player Hater

  • Members
  • Joined: 15 Jan 2009

#17

Posted 15 January 2009 - 04:55 PM

QUOTE (HazardX @ Jan 15 2009, 12:13)
@all: Thanks for the positive feedback so far. I'm glad you like it. smile.gif Feel free to comment if you don't like anything or got an idea on how to improve it.

QUOTE (tf2 @ Jan 15 2009, 11:39)
Will this work online after i have joined single player or is that something to do with the c++ stuff?

@anti mutiplayer modding morons:

My intentions are ONLY for freeroam usage with friends.

It has the same problems as the C++ hook currently, but i'm trying to fix it.

[EDIT] I found a way to reload the scripts after game reloading. happy.gif i'll include it in the next version of the hook.

Thank you so much for taking the time to fix it, this rocks smile.gif

HazardX
  • HazardX

    pedestrian mangler

  • Members
  • Joined: 13 Dec 2008

#18

Posted 16 January 2009 - 02:08 PM Edited by HazardX, 18 January 2009 - 11:31 AM.

I'm currently working on Tasks and TaskSequences. It's pretty cool stuff. smile.gif The following code will spawn a new char and make him attack you for 5 sec, then flee for 5 sec and then die.

CODE
     ' build TaskSequence
     Dim FleeTask As New TaskSequence
     FleeTask.AddTask.SwapWeapon(Weapon.Handgun_Glock)
     FleeTask.AddTask.FightAgainst(Player, 5000)
     FleeTask.AddTask.FleeFromChar(Player, False, 5000)
     FleeTask.AddTask.Die()

     ' Create char and exec TaskSequence
     Dim p As Ped = World.CreatePed(Player.Character.Position.Around(3.0F))
     p.CurrentRoom = Player.Character.CurrentRoom
     p.Weapon(Weapon.Handgun_Glock).Ammo = 1000
     p.Task.PerformSequence(FleeTask)


I hope to get a bunch of tasks ready for the next release. smile.gif

iriedreadlock23
  • iriedreadlock23

    Dr. Frankenstein

  • Members
  • Joined: 14 Jan 2009

#19

Posted 16 January 2009 - 07:22 PM

How do you get complete list of functions and variables you could use in scripts? I mean, script has something like this "...Dim weap As Weapon = Player.Character.Weapon
p.Weapon(weap).Ammo "... so how can i know what are all of object commands?

KewlAzMe
  • KewlAzMe

    Player Hater

  • Members
  • Joined: 01 Jul 2005

#20

Posted 16 January 2009 - 07:43 PM Edited by KewlAzMe, 16 January 2009 - 09:18 PM.

Excellent Job! This is going to bring great power to GTAIV now!!

Is it possible to change the ammo for each gun? I'd like a shotgun that shoots molotovs at highspeed

like:

Dim weap As Weapon = Weapon.Shotgun
weap.SetAmmoType(MolotovProjectile)

KewlAzMe
  • KewlAzMe

    Player Hater

  • Members
  • Joined: 01 Jul 2005

#21

Posted 16 January 2009 - 07:45 PM

QUOTE (iriedreadlock23 @ Jan 16 2009, 19:22)
How do you get complete list of functions and variables you could use in scripts? I mean, script has something like this "...Dim weap As Weapon = Player.Character.Weapon
p.Weapon(weap).Ammo "... so how can i know what are all of object commands?

Try using the sln code example, it already has the references setup for intellisense to work.

HazardX
  • HazardX

    pedestrian mangler

  • Members
  • Joined: 13 Dec 2008

#22

Posted 16 January 2009 - 08:00 PM Edited by HazardX, 16 January 2009 - 08:04 PM.

QUOTE (basketballjones @ Jan 15 2009, 12:59)
is the list of objects/variables going to be extended to all of the same things that the c++ hook covers?
even those in the scriptingdirty.h (eventually)

To make a little clearer what KewlAzMe meant: You should use VisualStudio to edit the scripts (open the SLN files to get a functional VS project). It will tell you which classes and functions are available when they are required (for example pops a list up when you type a dot). this functionality is called "intellisense".

@KewlAzMe: No, it is not possible to change the AmmoType per script. You have to edit the WeaponInfo.xml to do this.

KewlAzMe
  • KewlAzMe

    Player Hater

  • Members
  • Joined: 01 Jul 2005

#23

Posted 16 January 2009 - 09:18 PM Edited by KewlAzMe, 16 January 2009 - 09:20 PM.

QUOTE (HazardX @ Jan 16 2009, 20:00)
QUOTE (basketballjones @ Jan 15 2009, 12:59)
is the list of objects/variables going to be extended to all of the same things that the c++ hook covers?
even those in the scriptingdirty.h (eventually)

To make a little clearer what KewlAzMe meant: You should use VisualStudio to edit the scripts (open the SLN files to get a functional VS project). It will tell you which classes and functions are available when they are required (for example pops a list up when you type a dot). this functionality is called "intellisense".

@KewlAzMe: No, it is not possible to change the AmmoType per script. You have to edit the WeaponInfo.xml to do this.

How about controlling player/vehicle relationships?
Like:

if p.Vehicle(v).HonkingHorn then
p.Vehicle(v).velocity = 400000
end if
etc.


Also, there is a "LeaveVehicle" but no "EnterVehicle" event. Can that be added?

iriedreadlock23
  • iriedreadlock23

    Dr. Frankenstein

  • Members
  • Joined: 14 Jan 2009

#24

Posted 17 January 2009 - 08:03 PM

Thank you very much.

I realized in the meanwhile. Installed VS2008, and problem solved. Im impressed with the way script works, excellent job. But im intrerested now in possibility to use other native functions. Is there any experimental wrap throughout your library, so i can call functions like SET_TAXI_LIGHTS... and such? It would be awesome, so it could extend functionality of scripts. I was working on a thing so when i press certain key, i get my bodyguards find closest vehicle, and get into it. But i need more native functions, to make them actually run in convoy and get them to drive any car behind the player. Also, to search transportation if passenger limit in players car is full.

KewlAzMe
  • KewlAzMe

    Player Hater

  • Members
  • Joined: 01 Jul 2005

#25

Posted 17 January 2009 - 08:07 PM Edited by KewlAzMe, 17 January 2009 - 08:09 PM.

Is there a way to control people not in your group? Like World.Ped (doesn't work) but I'd like to create a script that sets all peds to be A) on fire and B) armed and attacking.

I've tried things like:

CODE
For Each iped As Ped In World
   iped.IsOnFire = true
Next


But "World" isn't right. Nor is Game, or Room, or anything else i've tried

Intosia
  • Intosia

    I'm random! ^^

  • Members
  • Joined: 11 Dec 2008

#26

Posted 17 January 2009 - 08:12 PM

QUOTE (KewlAzMe @ Jan 17 2009, 20:07)
Is there a way to control people not in your group? Like World.Ped (doesn't work) but I'd like to create a script that sets all peds to be A) on fire and B) armed and attacking.

I've tried things like:

CODE
For Each iped As Ped In World
   iped.IsOnFire = true
Next


But "World" isn't right. Nor is Game, or Room, or anything else i've tried

I would like have access to "all" the cars/peds on screen aswell in the C++ Hook, but i think thats not possible without direct memory accessing. You CAN do GetClosestPed (if im correct).

HazardX
  • HazardX

    pedestrian mangler

  • Members
  • Joined: 13 Dec 2008

#27

Posted 17 January 2009 - 08:16 PM Edited by HazardX, 17 January 2009 - 08:20 PM.

QUOTE (iriedreadlock23 @ Jan 17 2009, 20:03)
Thank you very much.

I realized in the meanwhile. Installed VS2008, and problem solved. Im impressed with the way script works, excellent job. But im intrerested now in possibility to use other native functions. Is there any experimental wrap throughout your library, so i can call functions like SET_TAXI_LIGHTS... and such? It would be awesome, so it could extend functionality of scripts. I was working on a thing so when i press certain key, i get my bodyguards find closest vehicle, and get into it. But i need more native functions, to make them actually run in convoy and get them to drive any car behind the player. Also, to search transportation if passenger limit in players car is full.

I hope to get the new release ready tonight. it includes a way to call native functions directly. here is an example:

CODE
     Dim CarPointer As New Native.Pointer(GetType(Vehicle))
     Native.Function.Call("GET_CAR_CHAR_IS_USING", Player.Character, CarPointer)

     Dim ModelPointer As New Native.Pointer(GetType(Model))
     Native.Function.Call("GET_CAR_MODEL", CarPointer.ToInputParameter, ModelPointer)

     Dim name As String = Native.Function.Call(Of String)("GET_DISPLAY_NAME_FROM_VEHICLE_MODEL", ModelPointer.ToInputParameter)


Also included are Tasks and TaskSequences. The included example shows how to enter every car as passenger, and force the driver to bring you to your currently selected waypoint. lol.gif But your idea is great. maybe i'll modify the included bodyguard example to make them use cars, if i've got enough time now, otherwise later.


@KewlAzMe: No, there is no way to do this right now. We haven't found a native function to achieve this, til now. As Intosia said, there are the World.GetClosestPed (which doesn't work very good at the moment) and World.GetClosestVehicle functions.

CoMPMStR
  • CoMPMStR

    CoMPuTer MAsSteR

  • Members
  • Joined: 18 Dec 2008

#28

Posted 17 January 2009 - 09:05 PM

Is there a way to write char position and velocity in the current release? I found Player.Character.Position and Player.Character.Velocity both get but neither allow setting.

Thanks for this greatness. Now it's as if GTA has it's own modding SDK VS plugin! This makes scripting and modding much easier with the intellisense. Can't wait for the next release! biggrin.gif happy.gif

JKM
  • JKM

    [BM] Projectleader

  • Members
  • Joined: 16 Jul 2005

#29

Posted 17 January 2009 - 09:37 PM

One little question:
Is Visual Basic 2008 working on Vista Home Premium 64bit?
Cause I downloaded and installed Visual Basic but there was no application i could start... only a debugger which didnt work....

olddawid
  • olddawid

    Crackhead

  • Members
  • Joined: 03 Jan 2009

#30

Posted 17 January 2009 - 09:52 PM Edited by olddawid, 17 January 2009 - 11:05 PM.

delete




3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users