Thanks man! I'm "done" with the basic NucleiLite edition sometime tomorrow I think.
Edit: There's a new tomorrow tomorrow. Soo...... yeah.
Edit edit: Sometimes life happens, and yeah...
Thanks man! I'm "done" with the basic NucleiLite edition sometime tomorrow I think.
Edit: There's a new tomorrow tomorrow. Soo...... yeah.
Edit edit: Sometimes life happens, and yeah...
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.
@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.
Been really busy the last couple of days. Hoping to get some work done this weekend.
@JohnFromGWN said in [Request for Feedback] - Guide to Developing GTA V Mods with ScriptHookVDotNet and LemonUI - Help Improve My Step-by-Step Guide!:
@KimonoBoy perfect. I wrote the most useful one line script if you want it.
Sure! Everything is welcome. I actually think I'll divide it into two different mods and Wiki:
Nuclei-Lite - Beginners Guide to writing .NET scripts for GTA V. I'm thinking of the following:
Player
Vehicle
Weapon
And then a teleportscript on key press.
Note: I won't divide the guide into the sections above, i'll write scripts and then cover the subjects as we go and share resources. Maybe we'll create a Notification script first and explain Data Types.
Nuclei - Complete Mod, as of now every section of the current wiki also needs to be more thorough, with detailed explanation and thought process. With this in mind, the beginners guide should be finished first as it's the quickest to complete and the "advanced" full mod will be put on pause for now.
@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).
@JohnFromGWN said in [Request for Feedback] - Guide to Developing GTA V Mods with ScriptHookVDotNet and LemonUI - Help Improve My Step-by-Step Guide!:
@KimonoBoy This is by far the best documentation for LemonUI available and I would also say the most organized documentation for GTA 5 scripting I've personally seen. Highly recommended.
I haven't had time to go through the wiki, but 2 things came to mind that could challenge a beginner:
- In some sections, the comment lines drown out the actual lines of code. This makes the code look much more daunting than it is although I fully understand the rationale. Not sure how you can or if you can address this. Hyperlinking would be an unpractical option. Hovering, although I doubt Github supports it, would be ideal.
The comment lines you are referring to are documentation - this is used to display information to the IDE when calling the method. It's intentional - but maybe you are right, maybe it should just be in the source code and not part of the guide.
- Visual Studio, for non-programmers, can be overwhelming. Particularly for those who have trouble installing ScripthookV, let alone a full IDE. While it definitely is the route to follow, absolute beginners might be encouraged to start - and to continue their journey - by creating uncompiled scripts - perhaps using vcode as an editor to help with the syntax. For example, having rainbow braces.
Thinking of something like a simple script with e.g. 5 features? Some keybinding and ticks to do a few different things? I didn't experience the IDE issues you're referring to when I learned software development, but I guess some people might - I can add this as it's own section in the wiki og maybe create a new repository with a mod and a small wiki? What do you suggest?
Edit: I sounded kind of condescending - was not my intention!
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,
KimonoBoy
Please note that no section in the Wiki is in a finite state. Everything will be revisited and properly documented.
@JohnFromGWN said in Create your personal GTA 5 Trainer:
Not urgent at all. Thanks. Going to start working on a FiveM resource selector now that I've finished the SP version. DLC Selection and Map (asset) previewer.
I've never tried FIVEM - so not entirely sure what I'm looking at 😅
@JohnFromGWN
If it's not urgent, I'll get back to you at another time, maybe when I cover slider items in the wiki and mod, we can chat together, I guess the implementation of mapping values to a negative would be an appropriate fit for the guide. I've updated quite a lot of stuff today, and I'll have to re-organize the wiki once I've completed the current section. Tedious, tiresome process but necessary 😅
@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
@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 👍
When the Wiki is in a "release" state all of the topics currently shown in the Table of Contents section will be covered. Then I'll progressively update the Wiki and with time, we've covered all NativeItems - including Sliders, Panels, Color Pickers and more.
You can represent negative values in a NativeSliderItem. You can do this by changing the way the position of the slider is mapped to the corresponding value.
For example, if you have a Max Value of 5, you could map the position 0 to -5, position 1 to -4, position 2 to -3, and so on. To achieve this, you can use a simple mathematical formula that takes the position of the slider, subtracts half of the Max Value, and then negates the result.
int mappedValue;
var sliderItem = new NativeSliderItem("Slider Item", "mappedValue goes from -50 to 50", 100, 0);
sliderItem.ValueChanged += (sender, args) =>
{
var position = sliderItem.Value;
mappedValue = position - (sliderItem.Maximum / 2);
Notification.Show(mappedValue.ToString());
};
Add(sliderItem);
Edit: About Menyoo and persistency, isn't Menyoo unsupported now?
Edit edit: If the above code is not what you were asking, could you rephrase the question? Or maybe come up with an example on the matter?
@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
PlayerService
public 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
PlayerScript
public 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
@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
@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
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
Thanks man! I just started writing the tutorial, been really busy. But I will let you know, once the mod and the Wiki is in a more complete state Then we can improve it!
Edit: My biggest issue right now is Git ^^
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.
@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.
Here is a quick script, I just called it Gravity-Gun, for grabbing entities and move their position back and forth using the ForwardVector - aim at an entity, press J, use Numpad 8 and Numpad 2 to move entity further away or closer to you, use the mouse to drag entity around:
private static bool _isHoldingEntity;
private static Entity _targetEntity;
private static float _gravityGunDistanceToTarget = 15.0f;
private static bool InfiniteAmmo { get; set; }
public WeaponService()
{
Tick += OnTick;
KeyDown += OnKeyDown;
}
private void OnKeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.J)
{
_targetEntity = Game.Player.TargetedEntity;
_isHoldingEntity = !_isHoldingEntity;
if (_targetEntity is Ped ped)
if (ped.IsInVehicle())
_targetEntity = ped.CurrentVehicle;
}
if (_isHoldingEntity && e.KeyCode == Keys.NumPad8)
_gravityGunDistanceToTarget += 1.0f;
if (_isHoldingEntity && e.KeyCode == Keys.NumPad2)
if (_gravityGunDistanceToTarget > 5.0f)
_gravityGunDistanceToTarget -= 1.0f;
}
private void OnTick(object sender, EventArgs e)
{
GravityGun(_gravityGunDistanceToTarget);
}
private void GravityGun(float distance)
{
if (!_isHoldingEntity || _targetEntity == null) return;
var camPos = GameplayCamera.Position + GameplayCamera.ForwardVector * distance;
camPos.Z += (float)Math.Sin(Game.Player.Character.RotationVelocity.Z - 2.0f);
_targetEntity.Position = camPos;
}
Edit: You can move the key presses to the Tick for a more fluid experience.
I'm having a hard time understanding what you are trying to accomplish, but i'll answer as best as I can.
To move back and left, you need to multiply by a negative value:
For instance: car.RightVector * -multiplier++
and for back
car.ForwardVector * -multiplier++
@JohnFromGWN said in Would: A Complete ScriptHookVDotNet Mod Menu Guide be something of interrest?:
@KimonoBoy
A couple points.
First, that's an excellent curriculum but I'm going to suggest an additional step and one change.The additional step. To whet the appetites of novices, give them something simple and very useful to start. Just a text file (.3.cs format) to remove VS complexity at the start. Could be a simple script to spawn a ped fully customized (drawables/textures) or a vehicle with a color variation.
Something along those lines. My thinking is that it will get people sitting on the fence to go "wow this is cool and easy", let's follow the rest of the course.The change. I wouldn't go the Native Trainer route because they all have Menyoo, Simple Trainer, ENT, or all 3 .....or even more.
Instead, I'm going to suggest you demo a very simple LemonUI trainer and the advantages it has over all the others - i.e. the ability to organize your mods and spawn entities fully customized to your specifications. Menyoo has the limited ability to save teleports for example, but you end up with one huge ass list of teleports. LemonUI allows you to create submenus for the sake of being organized.
Similarly, many users here have 500 cars or more installed. The addon spawner mod is ok, but can't compete with personal categories. For example, I have my huge collection of Ferraris the way I want them (by 8, 12 cylinders, classics, exotics, etc) and the flexibility to categorize them any way I want.
The novice part is a great idea, but then I think the guide should be split in to two different topics?
For the LemonUI part you mentioned (that was actually the idea) and just similar functionalities from NativeTrainer - like all the actions are the same, but using LemonUI to represent it. I'm not sure if in the best practices section, I should talk about abstract classes, interfaces, services and repositories. I myself prefer to have an abstract generic class that represents the UI-Layer, to keep each menu and submenu consistent and easier to maintain. But maybe this should also be a complete topic of its own.
I was also thinking about just re-creating the script that ScriptHookV ships with, but in ScriptHookVDotNet - so basically just a guide on how to do the entire NativeTrainer, from start to finish.
I'd be happy to get some help, I'll let you know when But first, I think we can discuss here, how the overall form should be presented?