HazardX Posted January 29, 2009 Author Share Posted January 29, 2009 (edited) There are new versions of those scripts available, i guess. Hehe.. you guess? You know I've already updated those scripts for the new scripthook. ... Setting any value to Player.Group.SeperationRange causes bodyguards to stay idle. When they spawn they just stand in one spot and don't move. ... Vehicle.isOnFire doesn't set a vehicle on fire if set to true. ... I was wondering if you could add the NoLongerNeeded sub to the model class, since there is a different NO_LONGER_NEEDED natived used for models. This way we can call Object.Model.NoLongerNeeded after we're done spawning the ped or vehicle, then call Object.NoLongerNeeded after we're completely done with the object. Yeah, i wasn't sure if all your scripts were updated for the new version already. Thanks for your infos. I'll look into it. some comments on them: Group.SeperationRange is the distance where members leave the group automatically (in yard/meters). I guess you were looking for FormationSpacing. However, even FormationSpacing is just the maximum distance. if they are too far away, they get closer until the FormationSpacing is met, but if they are too close, they won't retreat to keep distance (sadly). Did you try Vehicle.isOnFire is the new version? It should be fixed. The NoLongerNeeded functions for all ingame objects are included in the current version. Model.NoLongerNeeded is not required to be accessible, since it is automatically called. @brightemo: Yes, you are correct. Reading the position of blips that are not attached to something is not possible yet. There is no workaround yet. I hope to get at least the waypoint position in the next version of the hook. Edited January 29, 2009 by HazardX Link to comment Share on other sites More sharing options...
CoMPMStR Posted January 30, 2009 Share Posted January 30, 2009 Thanks for your infos. I'll look into it. some comments on them: Group.SeperationRange is the distance where members leave the group automatically (in yard/meters). I guess you were looking for FormationSpacing. However, even FormationSpacing is just the maximum distance. if they are too far away, they get closer until the FormationSpacing is met, but if they are too close, they won't retreat to keep distance (sadly). Did you try Vehicle.isOnFire is the new version? It should be fixed. The NoLongerNeeded functions for all ingame objects are included in the current version. Model.NoLongerNeeded is not required to be accessible, since it is automatically called. Ok, I was under the impression that Group.SeperationRange was used to set each member seperation from one another (have them spread out more). I did try Vehicle.isOnFire in the new version and nothing happens when enabled. I thought it might be due to calling NoLongerNeeded directly afterward but removing it returned the same results. -------------------------- I found a new bug, this time with another Ped function. Using Ped.CantBeDamagedByRelationshipGroup(Player.Character.RelationshipGroup, True) does NOT work, you can still kill those peds. However, using Native.Function.Call("SET_CHAR_NOT_DAMAGED_BY_RELATIONSHIP_GROUP", Ped, Player.Group) does provide the intended results. I know this because I also have to use Native.Function.Call("SET_CHAR_NEVER_LEAVES_GROUP", Ped, Player.Group) for my bodyguards. If I find anymore I'll be sure to keep you posted. Link to comment Share on other sites More sharing options...
HazardX Posted January 30, 2009 Author Share Posted January 30, 2009 (edited) I found a new bug, this time with another Ped function. Using Ped.CantBeDamagedByRelationshipGroup(Player.Character.RelationshipGroup, True) does NOT work, you can still kill those peds. However, using Native.Function.Call("SET_CHAR_NOT_DAMAGED_BY_RELATIONSHIP_GROUP", Ped, Player.Group) does provide the intended results. I know this because I also have to use Native.Function.Call("SET_CHAR_NEVER_LEAVES_GROUP", Ped, Player.Group) for my bodyguards. If I find anymore I'll be sure to keep you posted. Thanks for the infos. But those two functions are most likely not correct. SET_CHAR_NEVER_LEAVES_GROUP takes a bool as second parameter, not a group. My scripthook has this function already. It is the second (optional) parameter when you add someone to a group. Groups like Player.Group are identified by Handles, while relationship groups always got a fixed ID (Player = 0, Cops = 3, etc). SET_CHAR_NOT_DAMAGED_BY_RELATIONSHIP_GROUP was only used once in the official GTA scripts, but there it definately takes a RelationshipGroup (as the name of the function suggests) and NOT a Group. But maybe Rockstar did it wrong in their own script. I'll definately try it out. BTW: They can still be killed by headshots. Edited January 30, 2009 by HazardX Link to comment Share on other sites More sharing options...
CoMPMStR Posted January 30, 2009 Share Posted January 30, 2009 I found a new bug, this time with another Ped function. Using Ped.CantBeDamagedByRelationshipGroup(Player.Character.RelationshipGroup, True) does NOT work, you can still kill those peds. However, using Native.Function.Call("SET_CHAR_NOT_DAMAGED_BY_RELATIONSHIP_GROUP", Ped, Player.Group) does provide the intended results. I know this because I also have to use Native.Function.Call("SET_CHAR_NEVER_LEAVES_GROUP", Ped, Player.Group) for my bodyguards. If I find anymore I'll be sure to keep you posted. Thanks for the infos. But those two functions are most likely not correct. SET_CHAR_NEVER_LEAVES_GROUP takes a bool as second parameter, not a group. My scripthook has this function already. It is the second (optional) parameter when you add someone to a group. Groups like Player.Group are identified by Handles, while relationship groups always got a fixed ID (Player = 0, Cops = 3, etc). SET_CHAR_NOT_DAMAGED_BY_RELATIONSHIP_GROUP was only used once in the official GTA scripts, but there it definately takes a RelationshipGroup (as the name of the function suggests) and NOT a Group. But maybe Rockstar did it wrong in their own script. I'll definately try it out. BTW: They can still be killed by headshots. I'm just going by rappo's bodyguard mod source. He uses them like this: SetCharNotDamagedByRelationshipGroup(guards[guardCount], mygroup);SetCharNeverLeavesGroup(guards[guardCount], mygroup); And believe it or not, they work like that. He uses GetPlayerGroup(playerIndex, &mygroup); to get the player group. I have them set up in my script like this: Native.Function.Call("SET_CHAR_NEVER_LEAVES_GROUP", p, Player.Group)If defendPedFriendlyFire = False Then Native.Function.Call("SET_CHAR_NOT_DAMAGED_BY_RELATIONSHIP_GROUP", p, Player.Group) I use an optional variable to define if friendly fire is on for my defend peds, false means that I can't kill them. It works just like that too, and they don't die from headshots. I don't know why, it just does. Link to comment Share on other sites More sharing options...
HazardX Posted January 30, 2009 Author Share Posted January 30, 2009 I'm just going by rappo's bodyguard mod source. He uses them like this: SetCharNotDamagedByRelationshipGroup(guards[guardCount], mygroup);SetCharNeverLeavesGroup(guards[guardCount], mygroup); And believe it or not, they work like that. He uses GetPlayerGroup(playerIndex, &mygroup); to get the player group. I have them set up in my script like this: Native.Function.Call("SET_CHAR_NEVER_LEAVES_GROUP", p, Player.Group)If defendPedFriendlyFire = False Then Native.Function.Call("SET_CHAR_NOT_DAMAGED_BY_RELATIONSHIP_GROUP", p, Player.Group) I use an optional variable to define if friendly fire is on for my defend peds, false means that I can't kill them. It works just like that too, and they don't die from headshots. I don't know why, it just does. Sorry, but rappo definately got it wrong too. Regarding NeverLeavesGroup: Use "Native.Function.Call("SET_CHAR_NEVER_LEAVES_GROUP", p, True)" and you'll see that it will work too. Anything else wouldn't make sense, because peds can only be in one group anyway. Your version just works, because the group handle is always bigger than 0 and thus always true. I also tried your SET_CHAR_NOT_DAMAGED_BY_RELATIONSHIP_GROUP function, exactly as you wrote it here. It does not work. It does nothing at all. You can still kill them as normal. I'm pretty sure now that SET_CHAR_NOT_DAMAGED_BY_RELATIONSHIP_GROUP is just used to reset the stats of the char that tell if he was ever attacked by a member of this relationship group... nothing else. Link to comment Share on other sites More sharing options...
CoMPMStR Posted January 30, 2009 Share Posted January 30, 2009 Sorry, but rappo definately got it wrong too. Regarding NeverLeavesGroup: Use "Native.Function.Call("SET_CHAR_NEVER_LEAVES_GROUP", p, True)" and you'll see that it will work too. Anything else wouldn't make sense, because peds can only be in one group anyway. Your version just works, because the group handle is always bigger than 0 and thus always true. I also tried your SET_CHAR_NOT_DAMAGED_BY_RELATIONSHIP_GROUP function, exactly as you wrote it here. It does not work. It does nothing at all. You can still kill them as normal. I'm pretty sure now that SET_CHAR_NOT_DAMAGED_BY_RELATIONSHIP_GROUP is just used to reset the stats of the char that tell if he was ever attacked by a member of this relationship group... nothing else. Ok I can understand how never leaves group would always be true, but the way I put char not damaged by relationship group works. When I enable it, I unload clip after clip at my defenders but they don't budge, like they're invincible (which they're not, cops shoot them and they get hurt and die). When I disable it (remove/comment it out or set my ff var to true), then I kill them in less than half a clip. I call it directly after: p.RelationshipGroup = RelationshipGroup.Player : Player.Group.AddMember(p, True) All I can say is this method works for me, and p.CantBeDamagedByRelationshipGroup(Player.Character.RelationshipGroup, True) doesn't work for me. Link to comment Share on other sites More sharing options...
HazardX Posted January 30, 2009 Author Share Posted January 30, 2009 Ok I can understand how never leaves group would always be true, but the way I put char not damaged by relationship group works. When I enable it, I unload clip after clip at my defenders but they don't budge, like they're invincible (which they're not, cops shoot them and they get hurt and die). When I disable it (remove/comment it out or set my ff var to true), then I kill them in less than half a clip. I call it directly after: p.RelationshipGroup = RelationshipGroup.Player : Player.Group.AddMember(p, True) Okay, i believe that it works for you. Maybe the circumstances are different in your script, because it did not work here. I'll try to find a way to get it to work. Link to comment Share on other sites More sharing options...
CoMPMStR Posted January 30, 2009 Share Posted January 30, 2009 Okay, i believe that it works for you. Maybe the circumstances are different in your script, because it did not work here. I'll try to find a way to get it to work. I just tried using Native.Function.Call("SET_CHAR_NOT_DAMAGED_BY_RELATIONSHIP_GROUP", p, Player.Character.RelationshipGroup) instead, and it doesn't work for me either. Link to comment Share on other sites More sharing options...
NTAuthority Posted January 31, 2009 Share Posted January 31, 2009 Hi, it seems like Call() of GTA.Native.Function throws a System.AccessViolationException when passing a string parameter. 2009-01-31 09:49:14 - STARTING SCRIPTS...2009-01-31 09:49:15 - ...successfully started script 'PositionScript'!2009-01-31 09:49:23 - Error during Tick of script 'PositionScript': System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at GTA.Native.Function.BaseCall(String Name, Parameter[] Arguments) at GTA.Native.Function.Call(String Name, Parameter[] Arguments) at PositionScript.KeyDown(Keys key) at GTA.Script.DoKeyCheck() at GTA.ScriptThread.OnTick() This is with version 0.80, using GTA IV 1.0.2. Inactive in GTA/R* title modification indefinitely pursuant to a court order obtained by TTWO. Good job acting against modding! Link to comment Share on other sites More sharing options...
HazardX Posted January 31, 2009 Author Share Posted January 31, 2009 Hi, it seems like Call() of GTA.Native.Function throws a System.AccessViolationException when passing a string parameter.... This is with version 0.80, using GTA IV 1.0.2. Which native function did you call? (just to make sure that i'm able to reproduce the error) Link to comment Share on other sites More sharing options...
NTAuthority Posted January 31, 2009 Share Posted January 31, 2009 Hi, it seems like Call() of GTA.Native.Function throws a System.AccessViolationException when passing a string parameter.... This is with version 0.80, using GTA IV 1.0.2. Which native function did you call? (just to make sure that i'm able to reproduce the error) START_NEW_SCRIPT, to manually initialize a mission, but this may happen with other string parameters too. Inactive in GTA/R* title modification indefinitely pursuant to a court order obtained by TTWO. Good job acting against modding! Link to comment Share on other sites More sharing options...
bttf92 Posted January 31, 2009 Share Posted January 31, 2009 I have an error with the call of CLEAR_AREA native: Native.Function.Call("CLEAR_AREA", System.Convert.ToInt32(Car.Position.X), System.Convert.ToInt32(Car.Position.Y), System.Convert.ToInt32(Car.Position.Z), 100.0, 1) VB doesn't accept the double value "100.0" as GTA.Native.Parameter, it only accepts integer value but with "100" the script doesn't clear the area in the game. The variable Car contains the car that the char is driving. How to fix it? Link to comment Share on other sites More sharing options...
HazardX Posted January 31, 2009 Author Share Posted January 31, 2009 I have an error with the call of CLEAR_AREA native: Native.Function.Call("CLEAR_AREA", System.Convert.ToInt32(Car.Position.X), System.Convert.ToInt32(Car.Position.Y), System.Convert.ToInt32(Car.Position.Z), 100.0, 1) VB doesn't accept the double value "100.0" as GTA.Native.Parameter, it only accepts integer value but with "100" the script doesn't clear the area in the game. The variable Car contains the car that the char is driving. How to fix it? That's correct. The game uses single values, while .Net defaults to double. you have to write "100.0F" to force it as a single (float) value. You have to make sure that you always use the correct datatypes while calling natives, or it will not work. You can also shorten "System.Convert.ToInt32(value)" to "CInt(value)", BUT you don't need to convert them, because those parameters are actually single floats and no integers. This would be correct: Native.Function.Call("CLEAR_AREA", Car.Position.X, Car.Position.Y, Car.Position.Z, 100.0F, 1) I'll maybe add an extra converter for doubles, which converts them to single automatically. @NTAuthority: I'll look into it. Link to comment Share on other sites More sharing options...
bttf92 Posted January 31, 2009 Share Posted January 31, 2009 I have an error with the call of CLEAR_AREA native: Native.Function.Call("CLEAR_AREA", System.Convert.ToInt32(Car.Position.X), System.Convert.ToInt32(Car.Position.Y), System.Convert.ToInt32(Car.Position.Z), 100.0, 1) VB doesn't accept the double value "100.0" as GTA.Native.Parameter, it only accepts integer value but with "100" the script doesn't clear the area in the game. The variable Car contains the car that the char is driving. How to fix it? That's correct. The game uses single values, while .Net defaults to double. you have to write "100.0F" to force it as a single (float) value. You have to make sure that you always use the correct datatypes while calling natives, or it will not work. You can also shorten "System.Convert.ToInt32(value)" to "CInt(value)", BUT you don't need to convert them, because those parameters are actually single floats and no integers. This would be correct: Native.Function.Call("CLEAR_AREA", Car.Position.X, Car.Position.Y, Car.Position.Z, 100.0F, 1) I'll maybe add an extra converter for doubles, which converts them to single automatically. @NTAuthority: I'll look into it. Thanks!!Works! Link to comment Share on other sites More sharing options...
HazardX Posted February 1, 2009 Author Share Posted February 1, 2009 START_NEW_SCRIPT, to manually initialize a mission, but this may happen with other string parameters too. Other string parameters are okay. i tried it. i guess the START_NEW_SCRIPT function caused the error for some other reason. i can't look further into it at the moment. Link to comment Share on other sites More sharing options...
CoMPMStR Posted February 2, 2009 Share Posted February 2, 2009 I just found something out with the SET_CHAR_NOT_DAMAGED_BY_RELATIONSHIP_GROUP native. I think you have the parameters reversed, instead of it being Ped c, u32 rGroup, b8 enable, I think it should be Ped c, b8 enable, u32 rGroup. Maybe you can check this out just to make sure but it seems to work that way for me (which is why supplying Player.Group previously for the value was working for my native call). I didn't realize there were 3 parameters until I took a look at the natives again. I wasn't supplying a value for the final parameter which is also why it was making it work (no value = 0 && 0 = Player.RelationshipGroup). Link to comment Share on other sites More sharing options...
HazardX Posted February 2, 2009 Author Share Posted February 2, 2009 (edited) NEW VERSION: GTAIV .Net Script Hook v0.82 BETA Changes in Version 0.82 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 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 Screenshot of the ingame console: Constom console command example: Imports SystemImports System.Windows.FormsImports GTA' ### Type "explode" into the console and you will explode... ###Public Class ExplodeScript Inherits Script Protected Overrides Sub ConsoleCommand(ByVal Command As String, ByVal Parameter() As String) Select Case Command.ToLower Case "explode" World.AddExplosion(Player.Character.Position) End Select End SubEnd Class @CoMPMStR: YOU GOT IT! It works!!! It is included in the new version now. Edited February 2, 2009 by HazardX Link to comment Share on other sites More sharing options...
sjaak327 Posted February 2, 2009 Share Posted February 2, 2009 Oh boy ! That console command windows looks very promising, too bad we don't have something for the C++ scripthook Link to comment Share on other sites More sharing options...
CoMPMStR Posted February 2, 2009 Share Posted February 2, 2009 YAY! The update is here. Time to see what I can make it do now. Also time to update my scripts again. Link to comment Share on other sites More sharing options...
HazardX Posted February 2, 2009 Author Share Posted February 2, 2009 (edited) Also time to update my scripts again. Yeah, the watchkey change broke it this time. otherwise the old scripts (even the compiled ones) should have been able to run. I haven't fixed all of your reported problems. car.isOnFire = true still does not work. also i'm not sure how to fix the random crashes you reported in scripts that load lots of data. BTW: ReloadScripts also works for compiled scripts. Edited February 2, 2009 by HazardX Link to comment Share on other sites More sharing options...
Intosia Posted February 2, 2009 Share Posted February 2, 2009 (edited) ooow that console looks sweeet! Damn im thinking of switching to the .net hook Edit: - added PerFrameDrawing function to scripts to allow drawing of a simple GUI for scripts- added basic support for NaturalMotion messages (NmMessage class)- improved ragdoll commands- added more functions for positions, directions, offsets, etc. to several objects OK, im switching over LOL Edited February 2, 2009 by Intosia Link to comment Share on other sites More sharing options...
HazardX Posted February 2, 2009 Author Share Posted February 2, 2009 Ooooo, what does the console do? you type in commands that will then be executed (if the command if known). type "spawn banshee" and a banshee will be created right infront of you. instead of "banshee" you can use any ped, vehicle or object model name. also very handy: the teleport command. type "teleport 2354 385 5.5" and you'll teleport to the airport. just type "teleport" in the console and it will add the teleport command with your current position and heading to the log of last commands. later, just use the up arrow key to get the command and teleport exactly to this point. those are just a few examples. Link to comment Share on other sites More sharing options...
HazardX Posted February 2, 2009 Author Share Posted February 2, 2009 Great stuff, is there any tutorials for .NET scripting? No, but lots of example scripts are included. Use the free Microsoft Visual Studio Express to open the example project. It will tell you which functions are available for each object and will also tell you any scripting error directly. Link to comment Share on other sites More sharing options...
HazardX Posted February 2, 2009 Author Share Posted February 2, 2009 Hazard, IV won't start when I install YAASIL... I have Patch 2 Is a dsound.YAASIL.log file created? Please post the answer and the content of the file into THIS thread. Link to comment Share on other sites More sharing options...
boomer678 Posted February 2, 2009 Share Posted February 2, 2009 cool downloading now Link to comment Share on other sites More sharing options...
boomer678 Posted February 2, 2009 Share Posted February 2, 2009 Hazard X, how would i spawn an object on the ground with .82 version? Link to comment Share on other sites More sharing options...
HazardX Posted February 2, 2009 Author Share Posted February 2, 2009 Hazard X, how would i spawn an object on the ground with .82 version? I wrote it now in your thread. Link to comment Share on other sites More sharing options...
Krailer Posted February 2, 2009 Share Posted February 2, 2009 Awesome coding tool, I'd never guess that VB.Net could be so intuitive. One question: Does WantedByPolice works with created peds (e.g. bodyguards), at all? I've used it (set to True) but it has no effect, as my bodyguards shoot people in front of cops without taking any heat (funny as cops still make comments about the shootouts ). Now that I think of it, I've ran into the same issue with GTA:SA and SCM coding; intercepted popcycle peds would get heat from cops but created actors wouldn't, unless the player had a wanted level. I'm not sure if IV works the same way, though. Any thoughts? Link to comment Share on other sites More sharing options...
Intosia Posted February 2, 2009 Share Posted February 2, 2009 Hazard: could you give a small example of these: - added PerFrameDrawing function to scripts to allow drawing of a simple GUI for scripts - added basic support for NaturalMotion messages (NmMessage class) I looked around but coudnt find anything... Im interested in GUI rendering, i asume its DX Hooked? Link to comment Share on other sites More sharing options...
boomer678 Posted February 2, 2009 Share Posted February 2, 2009 Hey hazard. Im making a object spawner( thanks for the code to spawn an object), but im trying to make it so that you can toggle it being in front of u, or in back. I know u change 5 from -5. But i want to toggle it. I tried something similar to your bInvincible example but that didnt work. Also i have 3 objects that i want to toggle between front or back. Any idea on how to do this Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now