Quantcast

Jump to content

» «
Photo

[BETA] GTAIV .Net ScriptHook

2,938 replies to this topic
HazardX
  • HazardX

    pedestrian mangler

  • Members
  • Joined: 13 Dec 2008

#31

Posted 17 January 2009 - 09:54 PM

QUOTE (JKM @ Jan 17 2009, 21:37)
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....

Usually it does work. Are you able to open the SLN files now? If not, try to install it again. Maybe something went wrong during installation.

@CoMPMStR:
Position and Velocity should be settable. This should push the player into the air:

Player.Character.Velocity += new Vector3(0,0,20)

iriedreadlock23
  • iriedreadlock23

    Dr. Frankenstein

  • Members
  • Joined: 14 Jan 2009

#32

Posted 17 January 2009 - 10:49 PM

Im impatient for the new release. Is there any beta release? Maybe you could put what you have done so far, and we can test it, get some new ideas to the front. Im working on getting information from nearby peds, but im having problem with understanding function "GetClosestPed( Vector3, Single)... So what would be proper look of the function in use? What do i use for single? 1.0F, 6.0F? It should be like radius, so how do set proper radius in game metrics? Coz this way i get very random result, i dont know which ped gets found by this function.

Also, how can I put Peds back into a same game group? They sometimes go and kill each other. And I noticed that if you put like 10-20 guards, some of them dont follow you. I tried refreshing them, all one by one, with ' for each [I]' by SetPathFinding, but they just then go after me, start to shoot at me. Maybe it has to do that after player dies, game just remove all peds from your custom group...

HazardX
  • HazardX

    pedestrian mangler

  • Members
  • Joined: 13 Dec 2008

#33

Posted 17 January 2009 - 11:06 PM

QUOTE (iriedreadlock23 @ Jan 17 2009, 22:49)
Im impatient for the new release. Is there any beta release? Maybe you could put what you have done so far, and we can test it, get some new ideas to the front. Im working on getting information from nearby peds, but im having problem with understanding function "GetClosestPed( Vector3, Single)... So what would be proper look of the function in use? What do i use for single? 1.0F, 6.0F? It should be like radius, so how do set proper radius in game metrics? Coz this way i get very random result, i dont know which ped gets found by this function.

Also, how can I put Peds back into a same game group? They sometimes go and kill each other. And I noticed that if you put like 10-20 guards, some of them dont follow you. I tried refreshing them, all one by one, with ' for each [I]' by SetPathFinding, but they just then go after me, start to shoot at me. Maybe it has to do that after player dies, game just remove all peds from your custom group...

I hope to get the new release up in the next hours.

The GetClosestPed functions is very tricky currently... you are right, the parameter is the distance (in meters/yards... at least almost). but thats not the problem. internally there are 2 more parameters that seem to control what kind of peds will be returned by the functions. however, i found no combination yet that gives reliable results.

Groups have a maximum number of members. for the player group it seems to be 7. As soon as you add more, one of them will just "fall out" of the group. the roblem is, that the function to get the maximum number of members is still completely unknown. i've got the name (FIND_MAX_NUMBER_OF_GROUP_MEMBERS) but noone seems to know which parameters it takes. i'll try to find it out though.

iriedreadlock23
  • iriedreadlock23

    Dr. Frankenstein

  • Members
  • Joined: 14 Jan 2009

#34

Posted 17 January 2009 - 11:15 PM

Can you explain GTA.FunctionContext? Does it have to do something with calling native functions? There are lot of things when i declare new FunctionContext object. I see like 'GetArgumentFloat', 'GetArgumentInt','SetArgument'...'PushPtr'. How can i use it? If you could post some basic test code for it, it would be great.

CoMPMStR
  • CoMPMStR

    CoMPuTer MAsSteR

  • Members
  • Joined: 18 Dec 2008

#35

Posted 17 January 2009 - 11:36 PM

QUOTE (HazardX @ Jan 17 2009, 15:54)
@CoMPMStR:
Position and Velocity should be settable. This should push the player into the air:

Player.Character.Velocity += new Vector3(0,0,20)

Ahh I see, I was doing Player.Character.Velocity.X = newVect.X. suicidal.gif Still have to get used to how it all works.. biggrin.gif

iriedreadlock23
  • iriedreadlock23

    Dr. Frankenstein

  • Members
  • Joined: 14 Jan 2009

#36

Posted 18 January 2009 - 12:52 AM

I found out that you can use more than 7 guards by putting them into separate groups. 7+7+7... So basically you can have as many peds as you want as your bodyguards, following you and defending. Good thing is putting all used peds into an array, so you can control each one of them separately.

Maybe a good idea:

Is there possibility to control Ped movement? To script ped moves left or right on a key press or something like that. It could open up a new era of modding, and give a possibility to make your friend could use maybe a joypad2 on the system to control a bodyguard. Could you imagine GTA4 in full cooperative mod?

HazardX
  • HazardX

    pedestrian mangler

  • Members
  • Joined: 13 Dec 2008

#37

Posted 18 January 2009 - 10:38 AM Edited by HazardX, 18 January 2009 - 08:22 PM.

NEW VERSION:

GTAIV .Net Script Hook v0.73 BETA

Changes in Version 0.73 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 )
- also renamed Ped.Tasks to Ped.Task
- 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

The mentioned AnyTaxiScript allows you to enter any car as passenger and force the driver to bring you to a specific coordinate... as fast as possible.

Also very interesting are the new Tasks and TaskSequences. Use Ped.Task if you want to run a single task, or create a (reuseable) sequence of tasks with TaskSequence. Here is an example:
CODE
  Private FleeTask As New TaskSequence
  FleeTask.AddTask.SwapWeapon(Weapon.Handgun_Glock)
  FleeTask.AddTask.FightAgainst(Player, 5000) ' fight 5 sec
  FleeTask.AddTask.FleeFromChar(Player, False, 5000) ' flee 5 sec
  FleeTask.AddTask.Die() ' and then die

  ped.Task.PerformSequence(FleeTask)


Native calls are now possible too:
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)

     return Native.Function.Call(Of String)("GET_DISPLAY_NAME_FROM_VEHICLE_MODEL", ModelPointer.ToInputParameter)



@iriedreadlock23: The old FunctionContext class (which was for Lua-like native calling) has been replaced by the new and much better Native.Function.Call (see above).

iriedreadlock23
  • iriedreadlock23

    Dr. Frankenstein

  • Members
  • Joined: 14 Jan 2009

#38

Posted 18 January 2009 - 08:27 PM

Great!!

Thanks for the answers!

This is really great release, wonderful. I just love it. Now GTA4 can be modded, and extended to its full potential.

Can you tell me about 'VehicleDoor'? How can i use it? Like i want to get information into player vehicle. I get vehicle object, but i need now to access door. How do i set Hood to be opened?

HazardX
  • HazardX

    pedestrian mangler

  • Members
  • Joined: 13 Dec 2008

#39

Posted 18 January 2009 - 08:49 PM

QUOTE (iriedreadlock23 @ Jan 18 2009, 20:27)
Great!!

Thanks for the answers!

This is really great release, wonderful. I just love it. Now GTA4 can be modded, and extended to its full potential.

Can you tell me about 'VehicleDoor'? How can i use it? Like i want to get information into player vehicle. I get vehicle object, but i need now to access door. How do i set Hood to be opened?

Thanks. smile.gif

VehicleDoor is just to open, close and break doors. The Hood is also handled as a door. just use them like this:

CODE
somevehicle.Door(VehicleDoor.LeftFront).Close()
or
somevehicle.Door(VehicleDoor.Hood).Open()


To get into a car you don't need to access the door. There is a task defined to enter a car. here is the example code:

CODE
Player.Character.Task.EnterVehicle(somevehicle, VehicleSeat.RightFront)


in both examples "somevehicle" is a variable of type "Vehicle".

loczek47
  • loczek47

    They call me "Random Funny Guy".

  • BUSTED!
  • Joined: 22 May 2008

#40

Posted 19 January 2009 - 12:20 AM

This is awesome , thank you so much for .cs , it reminds me CLEO for SA , makes making script easier

juboaku
  • juboaku

    Crackhead

  • Members
  • Joined: 24 Dec 2008

#41

Posted 19 January 2009 - 08:15 AM

nice

loczek47
  • loczek47

    They call me "Random Funny Guy".

  • BUSTED!
  • Joined: 22 May 2008

#42

Posted 19 January 2009 - 12:21 PM

Hey , the reload script doesn't work. After I will load my another save , it will crash after 1 minute

HazardX
  • HazardX

    pedestrian mangler

  • Members
  • Joined: 13 Dec 2008

#43

Posted 19 January 2009 - 02:02 PM

QUOTE (loczek47 @ Jan 19 2009, 13:21)
Hey , the reload script doesn't work. After I will load my another save , it will crash after 1 minute

Does this happen all the time for you, or just sometimes?

@all: Has anyone else noticed the problem?

loczek47
  • loczek47

    They call me "Random Funny Guy".

  • BUSTED!
  • Joined: 22 May 2008

#44

Posted 19 January 2009 - 02:07 PM

QUOTE (HazardX @ Jan 19 2009, 14:02)
QUOTE (loczek47 @ Jan 19 2009, 13:21)
Hey , the reload script doesn't work. After I will load my another save , it will crash after 1 minute

Does this happen all the time for you, or just sometimes?

@all: Has anyone else noticed the problem?

Well , always. But I noticed that the time when crash appear randomly changes - one time it crashes when I get out of savehouse , another time it crashes after 5 minutes of playing. By the way - just like I said - I start my game , game automatically loads my save - it's okay - but when I load my another save , then it crashes.

iriedreadlock23
  • iriedreadlock23

    Dr. Frankenstein

  • Members
  • Joined: 14 Jan 2009

#45

Posted 19 January 2009 - 02:08 PM

If anyone is interested in helping out with new great extended bodyguard mod written in vb.net, send me private msg. I have added couple great functions so far, like multiple controllable bodyguard groups (7+ each), smart bodyguards stealing and driving any vehicle, bodyguards available at all time (even after player dies). You can set wheter they will walk to you, or they drive to certain position on the map. Also you can control Bodyguard movement via keyboard, and if someone help me out, we will make first full GTA Cooperative Mission mod, with 2+ Players support. Script works, but is still a bit buggy, so any help would be appreceated. Many more ideas in the script, waiting their time. Its still beta, so if you wish to try it out, just contact me. I will answer any question, and help with any good mod for GTA4...

loczek47
  • loczek47

    They call me "Random Funny Guy".

  • BUSTED!
  • Joined: 22 May 2008

#46

Posted 19 January 2009 - 02:10 PM

QUOTE (iriedreadlock23 @ Jan 19 2009, 14:08)
If anyone is interested in helping out with new great extended bodyguard mod written in vb.net, send me private msg. I have added couple great functions so far, like multiple controllable bodyguard groups (7+ each), smart bodyguards stealing and driving any vehicle, bodyguards available at all time (even after player dies). You can set wheter they will walk to you, or they drive to certain position on the map. Also you can control Bodyguard movement via keyboard, and if someone help me out, we will make first full GTA Cooperative Mission mod, with 2+ Players support. Script works, but is still a bit buggy, so any help would be appreceated. Many more ideas in the script, waiting their time. Its still beta, so if you wish to try it out, just contact me. I will answer any question, and help with any good mod for GTA4...

Holy sh*t , this sounds awesome. So bad I can't help you sad.gif

loczek47
  • loczek47

    They call me "Random Funny Guy".

  • BUSTED!
  • Joined: 22 May 2008

#47

Posted 19 January 2009 - 02:32 PM

QUOTE (iriedreadlock23 @ Jan 19 2009, 14:08)
If anyone is interested in helping out with new great extended bodyguard mod written in vb.net, send me private msg. I have added couple great functions so far, like multiple controllable bodyguard groups (7+ each), smart bodyguards stealing and driving any vehicle, bodyguards available at all time (even after player dies). You can set wheter they will walk to you, or they drive to certain position on the map. Also you can control Bodyguard movement via keyboard, and if someone help me out, we will make first full GTA Cooperative Mission mod, with 2+ Players support. Script works, but is still a bit buggy, so any help would be appreceated. Many more ideas in the script, waiting their time. Its still beta, so if you wish to try it out, just contact me. I will answer any question, and help with any good mod for GTA4...

Sorry for double post , but I would like to try it out realy much.

HazardX
  • HazardX

    pedestrian mangler

  • Members
  • Joined: 13 Dec 2008

#48

Posted 19 January 2009 - 02:57 PM

QUOTE (iriedreadlock23 @ Jan 19 2009, 15:08)
If anyone is interested in helping out with new great extended bodyguard mod written in vb.net, send me private msg. I have added couple great functions so far, like multiple controllable bodyguard groups (7+ each), smart bodyguards stealing and driving any vehicle, bodyguards available at all time (even after player dies). You can set wheter they will walk to you, or they drive to certain position on the map. Also you can control Bodyguard movement via keyboard, and if someone help me out, we will make first full GTA Cooperative Mission mod, with 2+ Players support. Script works, but is still a bit buggy, so any help would be appreceated. Many more ideas in the script, waiting their time. Its still beta, so if you wish to try it out, just contact me. I will answer any question, and help with any good mod for GTA4...

Wow, this sounds really amazing! wow.gif Can't wait to see it in action. If you've got any questions, or feature request or whatever, just ask.

iriedreadlock23
  • iriedreadlock23

    Dr. Frankenstein

  • Members
  • Joined: 14 Jan 2009

#49

Posted 19 January 2009 - 03:00 PM

Anything we make is thanks to HazardX!

After this Extended Bodyguard Mod is done, source code will be posted for users to analyze it, and reuse it in threir own scripts. However, I am now intrested into new native functions of GTA. But i just cant understand how it works. How do i read data from Native function? Can I use strings or something to store data from function?

HazardX: Did you manage to crack TASK_SIT_DOWN native function? There seems to be lot of functions that control actor moves and all. It would be great to add all those in future release. So we can script hand shakes, sitting, hands up, and all those nice little character moves.

AnttiAnA
  • AnttiAnA

    Player Hater

  • Members
  • Joined: 12 Dec 2008

#50

Posted 19 January 2009 - 03:08 PM

I crash instantly if i go to multiplayer confused.gif

HazardX
  • HazardX

    pedestrian mangler

  • Members
  • Joined: 13 Dec 2008

#51

Posted 19 January 2009 - 03:32 PM Edited by HazardX, 19 January 2009 - 03:36 PM.

QUOTE (iriedreadlock23 @ Jan 19 2009, 16:00)
Anything we make is thanks to HazardX!

After this Extended Bodyguard Mod is done, source code will be posted for users to analyze it, and reuse it in threir own scripts. However, I am now intrested into new native functions of GTA. But i just cant understand how it works. How do i read data from Native function? Can I use strings or something to store data from function?

HazardX: Did you manage to crack TASK_SIT_DOWN native function? There seems to be lot of functions that control actor moves and all. It would be great to add all those in future release. So we can script hand shakes, sitting, hands up, and all those nice little character moves.

Native functions return data in two ways:

- by result value:
CODE
Dim resultvalue As Ped = Native.Function.Call(Of Ped)("NAME_OF_NATIVE_FUNCTION", a, b, c)


- by pointer:
CODE
Dim pointer As New Native.Pointer(GetType(Ped))
Native.Function.Call("NAME_OF_NATIVE_FUNCTION", a, b, c, pointer)
Dim resultvalue As Ped = pointer


in both cases i've chosen "Ped" as return type and a, b and c as any type of parameter. which parameters a function takes, and which it returnes is defined in the game and we can only guess, which makes it hard to find the right values. Thats why i haven't included more Tasks yet, i just don't know which parameters they need. I used OpenIV alot to browse through scripts of the game to find clues and it helped alot already, but you can't find out everything that way.

@AnttiAnA: Could you post the content of your ScriptHookDotNet.log file directly after such a crash?

AnttiAnA
  • AnttiAnA

    Player Hater

  • Members
  • Joined: 12 Dec 2008

#52

Posted 19 January 2009 - 07:19 PM

2009-01-18 22:07:11 - Initializing ScriptHookDotNet v0.72 BETA

2009-01-18 22:07:11 - SEARCHING FOR SCRIPTS...
2009-01-18 22:07:11 - Loading Assembly 'C:\Program Files\Rockstar Games\Grand Theft Auto IV\scripts\TestScriptVB.net.dll' ...
2009-01-18 22:07:11 - ...found script 'TestScriptVB.BodyguardScript'!
2009-01-18 22:07:11 - DONE! 1 valid scripts found!

2009-01-18 22:08:54 - STARTING SCRIPTS...
2009-01-18 22:08:54 - ...successfully started script 'TestScriptVB.BodyguardScript'!
2009-01-18 22:15:08 - SCRIPTS TERMINATED!

2009-01-18 22:15:10 - STARTING SCRIPTS...
2009-01-18 22:15:10 - ...successfully started script 'TestScriptVB.BodyguardScript'!


sad.gif

diryboy
  • diryboy

    Grand Thread Auto

  • Members
  • Joined: 20 Jan 2009

#53

Posted 20 January 2009 - 02:25 PM Edited by diryboy, 21 January 2009 - 09:18 AM.

big thanks for the great work & info u provide! icon14.gif icon14.gif

y not make it open source on google code or something?

iriedreadlock23
  • iriedreadlock23

    Dr. Frankenstein

  • Members
  • Joined: 14 Jan 2009

#54

Posted 21 January 2009 - 06:56 PM

You could put next functions to next release:

CREATE_OBJECT (ObjectHash, X, Y, Z, returned ObjectPointer, 1)

ATTACH_OBJECT_TO_CAR( ObjectPointer, CarPointer, 0, X ,Y, Z, X Roto Offset, Y Roto Offset, Z Roto Offset);

SET_OBJECT_HEADING( ObjectPointer, Angle);

ATTACH_OBJECT_TO_PED ( Object pointer, Char Pointer , 1219, X, Y, Z, Roto Offset X, Roto Offset Y, Roto Offset Z);

SET_OBJECT_VISIBLE ( ObjectPointer, 1); // TRUE FALSE

DELETE_OBJECT (ObjectPointer);

IS_OBJECT_ATTACHED (ObjectPointer)

DETACH_OBJECT(ObjectPointer, 1);

REQUEST_MODEL(ObjectHash);

HAS_MODEL_LOADED(ObjectHash))

LOCK_CAR_DOORS( VehiclePointer, DoorIndex);

also, you could extend GetClosestPed function so it actually match ingame function, which has 7 parameters. I have checked many of these functions within game scripts, and retrieved parameter information. It may have certain mistakes, but i carefully checked every param in different scripts. You can PM me and i will give you all of functions parameters i have translated.

Also, it would be great to put an option so Animations can be used. Like Character animations. I have these:

HAVE_ANIMS_LOADED( "AnimationName" )

IS_CHAR_PLAYING_ANIM ( PED, "AnimationName", "AnimationExec")

TASK_PLAY_ANIM_WITH_FLAGS( PED, "CreateSpliff", "amb@smoking_spliff", 8.00, -1, 3328);

GET_CHAR_ANIM_CURRENT_TIME( PED, "CreateSpliff", "amb@smoking_spliff", &Var4);


--

Remos
  • Remos

    Player Hater

  • Members
  • Joined: 22 Jan 2009

#55

Posted 23 January 2009 - 02:44 AM Edited by Remos, 23 January 2009 - 11:37 AM.

Hey, I'm working on a script, and I'm not sure if 'GET_PED_BONE_POSITION' returns an Array, a Vector or something else. And I'm not exactly sure what I'm meant to do here:
CODE
Dim Bonepointer As New Native.Pointer(GetType(Vector3))
Native.Function.Call("GET_PED_BONE_POSITION", 1232, Convert.ToDecimal(0.0), Convert.ToDecimal(0.0), Convert.ToDecimal(0.0), Bonepointer)

I need to access the X, Y and Z coords individually. But I don't think that Native.Pointers support Arrays or Vectors. mercie_blink.gif

diryboy
  • diryboy

    Grand Thread Auto

  • Members
  • Joined: 20 Jan 2009

#56

Posted 23 January 2009 - 11:11 AM

QUOTE (HazardX @ Jan 19 2009, 15:32)
I used OpenIV alot to browse through scripts of the game to find clues and it helped alot already, but you can't find out everything that way.

I downloaded OpenIV 0.8.163 but don't know where the scripts locates, i opened data/script but no files it can open.. can u tell me how did u browse through scripts of the game?

and my game also crash when save reload..

btw,

Vehicle.Speed += 200f;
Vehicle.Explode();

this is super! i love it!! thank u HazardX!

Remos
  • Remos

    Player Hater

  • Members
  • Joined: 22 Jan 2009

#57

Posted 23 January 2009 - 11:35 AM

Are you opening OpenIV then browsing to data/scripts and opening a .img while in OpenIV.
Or are you opening .img's with OpenIV from windows explorer?

Because you should be doing the first one.

diryboy
  • diryboy

    Grand Thread Auto

  • Members
  • Joined: 20 Jan 2009

#58

Posted 23 January 2009 - 02:59 PM

QUOTE (Remos @ Jan 23 2009, 11:35)
Are you opening OpenIV then browsing to data/scripts and opening a .img while in OpenIV.
Or are you opening .img's with OpenIV from windows explorer?

Because you should be doing the first one.

no, data/script folder is empty.. but i found another data/cdimages/script.img, seems this would be it.

Remos
  • Remos

    Player Hater

  • Members
  • Joined: 22 Jan 2009

#59

Posted 23 January 2009 - 03:01 PM

Oh yeah, sorry.
Wasn't really thinking that much... >.>

HazardX
  • HazardX

    pedestrian mangler

  • Members
  • Joined: 13 Dec 2008

#60

Posted 23 January 2009 - 03:30 PM

QUOTE (Remos @ Jan 23 2009, 03:44)
Hey, I'm working on a script, and I'm not sure if 'GET_PED_BONE_POSITION' returns an Array, a Vector or something else. And I'm not exactly sure what I'm meant to do here:
CODE
Dim Bonepointer As New Native.Pointer(GetType(Vector3))
Native.Function.Call("GET_PED_BONE_POSITION", 1232, Convert.ToDecimal(0.0), Convert.ToDecimal(0.0), Convert.ToDecimal(0.0), Bonepointer)

I need to access the X, Y and Z coords individually. But I don't think that Native.Pointers support Arrays or Vectors. mercie_blink.gif

yes, you are right. Native.Fucntion.Call does not support arrays or Vector3. i included Vector3 support now, but there seems to be another problem with functions that take a vector3 pointer. the results are complete nonsense. i guess the game handles them in a different way. still trying to figure it out.

@diryboy: yes, data/cdimages/script.img is correct.




2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users