Git Product home page Git Product logo

scripthookrdr2dotnet's Introduction

THIS PROJECT IS NO LONGER IN DEVELOPMENT AND LIKELY DOES NOT WORK.

THERE IS AN IMPROVED, UPDATED FORK OF THIS PROJECT AT https://github.com/Halen84/ScriptHookRDR2DotNet-V2 - A HUGE THANK YOU TO THEM!

Community Script Hook RDR2 .NET | Downloads

STILL IN ALPHA STATE, USE HOW YOU WANT TO! EXPECT ERRORS, CRASHES, ETC

This is an ASI plugin for Red Dead Redemption 2, ported from ScriptHookVDotNet, based on the C++ ScriptHook by Alexander Blade, which allows running scripts written in any .NET language in-game.

The issues page should be primarily used for bug reports and enhancement ideas. Questions related to RDR2 scripting in general are better off in forums dedicated to this purpose, like NexusMods or gtaforums.com.

Join the official Red Dead Redemption 2 Modding Discord for the latest information about Red Dead Redemption 2 PC mods

Requirements

Downloads

Pre-built binaries can be found on the releases page.

issues

Contributing

You'll need Visual Studio 2017 or higher to open the project file and the Script Hook RDR2 SDK extracted into "/sdk".

Any contributions to the project are welcomed, it's recommended to use GitHub pull requests.

License

All the source code except for the Vector, Matrix and Quaternion classes, which are licensed separately, is licensed under the conditions of the zlib license.

Credits

  • Crosire (ScriptHookVDotNet)

  • Jedijosh920 - lots of help, natives for methods

  • Mooshe - help with API

scripthookrdr2dotnet's People

Contributors

mooshetv avatar notaimless avatar saltymods avatar saltyq avatar shtivi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

scripthookrdr2dotnet's Issues

Can't build the project

Hi,
When I try to compile the project I get the following error:
"The name RDR2DN does not exist in the current context", in several places such Native.cs, World.cs, Global.cs...
Am I missing something?

Controlling toggle of first / third-person cameras?

Is there a routine in this library that can toggle the first-person camera?

Not only just setting up a custom camera and setting it to render, but activating the full transition between first/third-person (including the character control changes for first person).

I've tried to use
Function.Call( Hash._RENDER_FIRST_PERSON_CAM, true/false, 0, 3 ); according to https://www.dev-c.com/nativedb/ns/CAM

I've also tried a few other variations. I can tell that something is definitely clicking, because when I set it to true, and I'm in third-person mode, I can see the camera snap to an odd rotation, but I'll still be in first-person.

Accessing Pools

Hey so about the pools.. did the GTAV version search the memory for a pattern on where the handles are locates in memory?  The game crashed whenever the external function was called for pulling the data from memory such as GetAllPeds() figured it might be memory pointer issue, but cant do anything since it's using Blades Dll (right?)

TextElement only drawn after opening NativeTrainer

  • ScriptHookRDR2: v1.0.1207.73
  • ScriptHookRDRDotNet: release 1.0.4.1

When trying to show a text in game, it doesn't appear until I open NativeTrainer's menu.
I guess some pre-requisites natives to show text might not be called by ScriptHookRDR2DotNet but having NativeTrainer to call them on opening the menu does the trick.

    public class Main : Script
    {
        TextElement _debug_text = new TextElement("Dummy", new PointF(500f, 100f), 0.5f, Color.Cyan, Alignment.Center, true, true);

        public Main()
        {
            Tick += OnTick;
            Interval = 1;
        }

        private void OnTick(object sender, EventArgs e)
        {
            _debug_text.Draw();
        }
    }

give weapon dosnt work

ped1.GiveWeapon(RDR2.WeaponHash.MeleeCleaver, 0, true);
but ped equip weapon on left hand always.....

Reading Ped position

  • ScriptHookRDR2: v1.0.1207.73
  • ScriptHookRDRDotNet: release 1.0.4.1

I just can't find a correct way to read a ped's position.

Here is what I got so far:

// ScriptHookRDR2DotNet API
// => Returns (0 ,0, 0)
Vector3 pos = Game.Player.Character.Position;

// Same as source code:
// https://github.com/Saltyq/ScriptHookRDR2DotNet/blob/master/source/scripting_v3/RDR2/Entities/Entity.cs#L118
// => Returns (0 ,0, 0)
Vector3 pos = Function.Call<Vector3>(Hash.GET_ENTITY_COORDS, Handle, 0);

// Using InputArguments:
// => Returns (0 ,0, 0)
InputArgument in_Handle = new InputArgument(Game.Player.Character.Handle);
InputArgument in_Alive = new InputArgument(false);
Vector3 pos = Function.Call<Vector3>(Hash.GET_ENTITY_COORDS, in_Handle, in_Alive).ToString();


// Using InputArguments + OutputArgument:
// => Returns random values that keep on changing each tick.
// All 3 coordinates to the same value (ie: 2.802597E-45)
InputArgument in_Handle = new InputArgument(Game.Player.Character.Handle);
InputArgument in_Alive = new InputArgument(false);
OutputArgument out_Pos = new OutputArgument();
Function.Call(Hash.GET_ENTITY_COORDS, in_Handle, in_Alive, out_Pos);
Vector3 pos = out_Pos.GetResult<Vector3>();

Anyone know where this problem can come from?

Prompt set Text doesnt work

Setting a prompt text to a custom text does not work.
The prompt just doesnt apear.
However using a registered text label like "CUTSCENE_SKIP" does work and produces a "Skip" button.

GetAllProps() crashing

The other pools work. Just not props. The pools example in ScriptHookRDR2 sdk props do.

Native.Function.Call can only be called from the main thread.

I have gotten this before. Reloading scripts usually fixed it . But now its every time. Even the example script. The only way i can stop it is to set tick to 1000. Then after a few seconds set tick to 1.
[19:44:49] [ERROR] Caught fatal unhandled exception:
System.InvalidOperationException: Native.Function.Call can only be called from the main thread.
at RDR2.Native.Function.Call[T](Hash hash, InputArgument[] arguments)
at RDR2.Game.get_Player()
at ExampleScript.Main.OnTick(Object sender, EventArgs e) in c:\Program Files (x86)\Steam\steamapps\common\Red Dead Redemption 2\scripts\ExampleScript.cs:line 24
at RDR2DN.Script.MainLoop()
[19:44:49] [ERROR] The exception was thrown while executing the script ExampleScript.Main.
[19:44:49] [WARNING] Aborted script ExampleScript.Main.
[19:44:54] [ERROR] Script 'ExampleScript.Main' is not responding! Aborting ...
[19:44:54] [WARNING] Aborted script ExampleScript.Main.

Text flickering.

`
public class Main : Script
{
private TextElement _text = new TextElement("Test Text", new PointF(100, 100), 1f, Color.LightBlue);

public Main()
{
    Tick += Main_Tick;
}

private void Main_Tick(object sender, EventArgs e)
{
    _text.Draw();
}

}
`
The text drawn this way is flickering (maybe not drawn each frame).
If I set Interval to 1, the game will crash.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.