@JohnFromGWN
I'm thinking to split the wiki into two sections - a "Getting Started" section where we cover the basics of writing scripts to .cs files and use e.g. VS Code or notepad++ to write 10 different features and then an Advanced Section to make the complete mod of Nuclei with VSStudio and compiled scripts (.dll).
Best posts made by KimonoBoy
-
RE: [Request for Feedback] - Guide to Developing GTA V Mods with ScriptHookVDotNet and LemonUI - Help Improve My Step-by-Step Guide!
-
RE: [Request for Feedback] - Guide to Developing GTA V Mods with ScriptHookVDotNet and LemonUI - Help Improve My Step-by-Step Guide!
Would someone mind giving me feedback on the following Wiki
Everything from the beginning of the Table of Content to the Fix Player script section is currently updated.
-
RE: [Request for Feedback] - Guide to Developing GTA V Mods with ScriptHookVDotNet and LemonUI - Help Improve My Step-by-Step Guide!
@JohnFromGWN said in [Request for Feedback] - Guide to Developing GTA V Mods with ScriptHookVDotNet and LemonUI - Help Improve My Step-by-Step Guide!:
Here is a very very useful script. It allows you to go through any obstacles or barriers, on foot or in a vehicle.
I use it every time I play, simple key press gets me out of trouble.
Also, in a vehicle this will stop a car instantly.if (e.KeyValue == 187) // Teleport Forward on = key, this is also an instant stop in a car! { if (!Game.Player.Character.IsInVehicle()) { var myPos = Game.Player.Character.Position + Game.Player.Character.ForwardVector; Vector3 myForward = new Vector3(myPos.X, myPos.Y, myPos.Z - 1f); Game.Player.Character.Position = myForward; } else { Vehicle MyCar = Game.Player.Character.CurrentVehicle; MyCar.Position += MyCar.ForwardVector * 4.5f; } }
Thanks! I think we can find a place for this code.
-
[Request for Feedback] - Guide to Developing GTA V Mods with ScriptHookVDotNet and LemonUI - Help Improve My Step-by-Step Guide!
Hello everyone,
I'm excited to share my latest project with the GTA V modding community - a comprehensive guide to developing mods using ScriptHookVDotNet and LemonUI. My goal is to provide a clear and detailed guide that will help modders of all levels create their own mods from start to finish.
I've worked hard to create a step-by-step guide that covers everything from setting up your development environment to creating a complete mod. You can find the guide on my GitHub repository, along with the associated Wiki that provides a step-by-step development guide + additional information and resources.
Now, I need your help to make this guide even better! I'm looking for feedback on the following areas:
Clarity: Is the guide easy to follow and understand?
Organization: Is the information presented in a logical and accessible way?
Comprehensiveness: Does the guide cover everything you need to know to develop a complete mod menu?
I welcome all feedback, positive or negative, and would be grateful for any suggestions you have on how I can improve this guide. Your input will help me make this guide the best it can be for the GTA V modding community.
Thank you for your time and support!
Best regards,
KimonoBoyNote
Please note that no section in the Wiki is in a finite state. Everything will be revisited and properly documented.
-
RE: Create your personal GTA 5 Trainer
@JohnFromGWN said in Create your personal GTA 5 Trainer:
@KimonoBoy no urgency, just curious as how to do this properly. Your help is very much appreciated.
By the way, have you tried looking at the source code for the NativeSliderItem? It has two overrideable methods - GoLeft() and GoRight() you can create your own NativeSliderItem that extends the NativeSliderItem and then override the behavior of GoLeft() and GoRight();
/// <summary>Reduces the value of the slider.</summary> public override void GoLeft() { int num = this._value - this.Multiplier; if (num < 0) this.Value = 0; else this.Value = num; } /// <summary>Increases the value of the slider.</summary> public override void GoRight() { int num = this._value + this.Multiplier; if (num > this.maximum) this.Value = this.maximum; else this.Value = num; }
You can then create your own implementation of these two methods that maps the types as you please - I'll show an example later, I just quickly glanced at the Source Code
-
RE: Create your personal GTA 5 Trainer
@JohnFromGWN said in Create your personal GTA 5 Trainer:
First, with respect to Menyoo, it is still maintained and still the best Trainer.
https://github.com/MAFINS/MenyooSPThanks for your help but I don't think I explained what i'm trying to do clearly. The issue is I'm using this for ped placement - so ped vector has to be taken into account.
I have 6 sliders. The first 3 are for position. The last 3 are for Rotation.
The slider is in integers and increments in steps of 1 and is positive only.- I need floats for position so I convert to float
- I need values smaller than 1 (sensitivity) so I divide by a constant
- I need to go forwards and backwards, up and down.
I can't start the slider at 0, because in that case it can only go left to right.
If I start the value at the middle, say 50 for a maximum of 100, I can go left and I can go right.
But because I want to increment by 1 integer value at a time (my step) and add it to my ped position, I can't get this to work.For example, with the formula you suggested, if I let the slider go at its default of zero:
var position = 0
mappedValue = 0 - (100 / 2) = - 50 which would bring my ped deep undergroundStarting at 49, just left of the mid point
mappedValue = 49 - 50 would give me -1 but the next click would give me -2Somewhow I need a mechanism to increment the position.x, position.y, and position.z
I initially had 12 sliders but that's kinda crazy. So now I use a 1/-1 multiplier, which is also kinda crappy.
Current code:
private void ChangeHeight(object sender, EventArgs e) { PedFloat = (float)PedHeight.Value / 100f * Multi; PedFloat = (ClosestPed.Position.Z + PedFloat); var forwardPos = ClosestPed.Position; Vector3 newForward = new Vector3(forwardPos.X, forwardPos.Y, PedFloat - 1f); ClosestPed.Position = newForward; }
I'll have a look tomorrow night - should be manageable 👍
-
RE: Create your personal GTA 5 Trainer
@JohnFromGWN said in Create your personal GTA 5 Trainer:
@KimonoBoy
I have a suggestion regarding organizing the code. It quickly becomes close to unmanageable if you don't organize it.Early on I thankfully found the partial classes/methods. This allows me to keep my LemonUI menu solutions as clean as possible. I have 2 LemonUI specific classes and then anywhere from 1 to 20 other classes in each solution. I do have separate menu solutions for peds, vehicles, and teleports etc, but they are all linked in each menu.
- A LemonUI section that has the menu items and other declarations but no code.
- A second LemonUI section dedicated to adding the menu items to the pool and what code is activated, value changed etc.
- All other non-LemonUI functions and codes in their own sheets, own class items.
For point 3, as an example, I also keep spawning entities separate from other functions such as animations or tasks.
Since I have close to 1000 vehicles installed and coded, I group them by Country or by Brand and by Sub Brand - which is consistent with how my dlc folders and subfolders are organized on the hard disk. So I have a class Ferrrari.cs, a class MuscleCars.cs etc. inside the project.I also use the # region tag to organize code.
public partial class Basics : Script
We can cover partial classes, sure - but once you see the overall picture of the Wiki, you'll see that it uses services, these services behaves as a middle-man between the UI and the Scripts - we will not call Game.Player.Character directly from our menu, but rather just send the state of our menu items to a service and then have our scripts respond to changes in the service and perform game changes. Here is a quick example (not how i'll implement it, but should give you an idea)
PlayerMenu
public class PlayerMenu : MenuBase { private readonly PlayerService _playerService = PlayerService.Instance; public PlayerMenu(string subtitle, string description) : base(subtitle, description) { AddCheckbox("Invincible", "Set the Player Invincible.", false, @checked => { _playerService.SetInvincible(@checked); }); } }
The Menu updates the state in the service by the value of the checkbox item
PlayerServicepublic class PlayerService { public static PlayerService Instance = new(); public bool IsInvincible { get; private set; } public void SetInvincible(bool isInvincible) { IsInvincible = isInvincible; } }
The PlayerScript now performs some in-game action depending on the state of the PlayerService
PlayerScriptpublic class PlayerScript : Script { private readonly PlayerService _playerService = PlayerService.Instance; public PlayerScript() { Tick += OnTick; } private void OnTick(object sender, EventArgs e) { if (_playerService.IsInvincible) Game.Player.Character.IsInvincible = true; else Game.Player.Character.IsInvincible = false; } }
But we can surely cover partial classes, to break our classes into smaller digestable pieces and the above is just an example and not the actual implementation. The services also allows us to Save and Load data and only have our services be updated, this way when we load a file both the Menu and the Scripts reflects the changes happening in the service.
Note: To keep as little logic inside our Ticks as possible, we'll implement custom events that can register a Character switch rather than checking if the invincible state of the service is true every frame - for instance the IsInvincible actually only have to be set 1 time and the ped will stay invincible until changes again, however if we enter a house or switch a character the invincible wears off - we can instead of calling 500 different states every frame, just call a few every frame that determines if the states should be updated, e.g. when switching a character -
RE: Create your personal GTA 5 Trainer
@gus-solo said in Create your personal GTA 5 Trainer:
@KimonoBoy Thank you for the Wiki, easy and clear ,very useful for me,
You're welcome, revisit the topic at a later time, and hopefully it'll help you create the mod you wish
-
RE: Create your personal GTA 5 Trainer
@JohnFromGWN said in Create your personal GTA 5 Trainer:
@KimonoBoy
Started to look at your wiki and wow, I wish I had had something like this when I started. Fantastic.
A few minor suggestions, not corrections. but rather for completeness.-
Under Reloading Scripts HotKey, you might mention that reloading a script can also be done from the console (F4). Perhaps at one point, although it might be scope creep, is have a dedicated section to the console?
-
Building directly to your scripts folder. One minor suggestion. There is another option which is to use post-build events, which over-rides the build event. It might be a little trickier because you need
COPY "$(TargetPath)"
, but might be worth mentioning for completeness.
Once more, great job. You need to get the word out there. So many people are having their games crash because of outdated or poorly written scripts. Learning how to script is incredibly empowering and the possibilities for GTA5 are limitless.
The barrier to entry for scripting has always been sparse and garbage documentation and you've addressed this. I also prefer your format, well organized and hyperlinked, to wasting time with YouTube videos.
Thanks for your feedback.
Suggestion
- Agreed, should be mentioned. Some might actually prefer it.
- Yes.
COPY "$(TargetPath)"
- I use it for my own projects, this section should and will be revisited at a later time! But I think I'll add it as a Tips & Tricks section in the end, hoping not to throw people off with too much prepping before programming, that's also the reason why we just suddenly create a script in the "Your First Script" section, to maybe encourage people to continue.
If you find more improvements or suggestions, please share them 👍 I want the wiki and the mod to be in a state that is usable while not yet complete, before creating a topic! Once again, ty for your feedback
-
-
RE: Create your personal GTA 5 Trainer
I'm working on the following:
https://github.com/KimonoBoy/SHVDN-Tutorial
with the associated Wiki
But it's not at all about to be finished. It's a work in progress, and it's a huge mess.
-
RE: Would: A Complete ScriptHookVDotNet Mod Menu Guide be something of interrest?
@JohnFromGWN said in Would: A Complete ScriptHookVDotNet Mod Menu Guide be something of interrest?:
@KimonoBoy I'll share an example with you.
One of the first things I wanted to do when I started playing GTA 5 and modding was the ability to switch between the player and another ped.
I searched everywhere. Nada, nothing.
I posted here and other forums. Nope, not even a nibble.
Finally I figured it out on my own and honestly I'm shocked nobody could help, or nobody wanted to help, with something so simple.
My code lacks elegance, once more I'm not a programmer, but it works.
if (e.KeyCode == Keys.NumPad0) //SWITCH FROM PLAYER TO PED AND BACK { if (Game.Player.Character == Player1) { Function.Call(Hash.CHANGE_PLAYER_PED, Game.Player, CurrentPed, true, true); // Player 1 is declared above PedGroup PlayerGroup = Game.Player.Character.PedGroup; //make them buddies Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Player1, PlayerGroup); } else if (Game.Player.Character == CurrentPed) { Function.Call(Hash.CHANGE_PLAYER_PED, Game.Player, Player1, true, true); PedGroup PlayerGroup = Game.Player.Character.PedGroup; //make them buddies Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, CurrentPed, PlayerGroup); } }
If it works, it works, and for this script, I don't really see how this should be written any better? Yeah, maybe a method containing it's logic to remove duplicate code, but the code is simple and readable.
-
Would: A Complete ScriptHookVDotNet Mod Menu Guide be something of interrest?
Greetings,
There's probably already a few guides out there, but would a complete guide on how to develop a mod for GTA 5 using ScriptHookVDotNet be something of interrest?
A Basic Section for those new to programming in general, and a Advanced Section for those already familiar with programming who would like to get into modding in GTA 5?
I'm thinking of everything from creating a menu using LemonUI, to working with hashes, saving and loading states, threading, additional eventhandlers on e.g. properties to keep as little logic in Ticks as possible. I'm not sure if it'll be worth it.