saltyq / scripthookrdr2dotnet Goto Github PK
View Code? Open in Web Editor NEW*this project is ABANDONED* An ASI plugin for Red Dead Redemption 2, which allows anyone to create scripts using any .NET language.
License: zlib License
*this project is ABANDONED* An ASI plugin for Red Dead Redemption 2, which allows anyone to create scripts using any .NET language.
License: zlib License
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.
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();
}
}
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.
`
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.
Hi is there any chance to start hook/asi with game ?
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?
ped1.GiveWeapon(RDR2.WeaponHash.MeleeCleaver, 0, true);
but ped equip weapon on left hand always.....
The other pools work. Just not props. The pools example in ScriptHookRDR2 sdk props do.
What's the best way to perform simple log-based debugging for our scripts? Print to sysout?
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?)
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.
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?
ped.GiveWeapon() does fine, but doing it through Weapons doesn't
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.