






注:该包为开发者用的,非开发者请转到 https://mod.3dmgame.com/mod/145572
主要编译是基于ScriptHookRDR2.dll,当游戏更新时,只需要更新ScriptHookRDR2.dll即可,一般情况开发文件不需要进行更新,不过不排除特殊情况。
- 如果想让游戏重新加载asi脚本,但不想重启游戏,只需在游戏目录中创建一个空的“ScriptHookRDR2.dev”文件,然后在游戏中按“Ctrl+R”,听到“滴”的声音,即表示脚本卸载完成,再次按“Ctrl+R”,听到“滴滴滴”的声音,即表示脚本加载完成;
- 若想让DeBug功能在游戏中正常工作,必须在主函数“DllMain()”中调用“scriptUnregister()”方法,具体请查阅“NativeTrainer\main.cpp”中的代码;
- 脚本重载只适用于正常加载的*.asi文件,不支持加载中途加入的*.asi文件,[比如说,游戏运行时有个test.asi文件,如果先按“Ctrl+R”卸载,然后加一个“test2.asi”文件,重载的时候将无法识别新的“test2.asi”文件]
- 你必须使用keyboard hook 代替 GetKeyState/GetAsyncKeyState API,这样才能确保所有按键都可以正常工作;
- 需要在主函数“DllMain()”中调用keyboardHandlerRegister() /keyboardHandlerUnregister()函数来处理按键操作的加载/卸载;
- 具体详细可参看NativeTrainer\main.cpp中的代码示例;
- 游戏当前使用的实体都储存在pools中,每种类型的实体都有一个单独的pools,使用“worldGetAllVehicles()”方法可以让您访问任何类型的实体;
- 在访问这些实体时,请注意,不是通过脚本创建许多实体,所以脚本对实体并没有完全的控制权,如果您想防止实体被游戏删除或想删除实体,则需要将实体转换为“任务实体[SET_ENTITY_AS_MISSION_ENTITY]”来获取完全控制权,未设置为任务实体的实体随时都可能被游戏删除,因此,我们需要在脚本执行的间隔中调用一下这些实体(即WAIT (0)函数的调用)
- 原始脚本也遵循上面的规则,如同时使用从世界访问实体“GET_PED_NEARBY_VEHICLES [获取ped周围的载具]”和“GET_PED_NEARBY_PEDS [获取ped周围的ped]”时,也请调用 “IS_ENTITY_A_MISSION_ENTITY [是否为任务实体]”和“SET_ENTITY_AS_MISSION_ENTITY [设置为任务实体]”
- 可以在Pools\script.cpp中查看实体相关的代码示例;
- 实例中的脚本需要“Visual Studio 2013”或更高的版本才能正常编译
- 您只能使用此SDK编译/制作线下的脚本Mod,禁止用于线上;
- 您在发布脚本时,请勿包含“ScriptHookRDR2.dll”文件,需要将ScriptHookRDR2.dll的下载指向 http://www.dev-c.com/rdr2/scripthookrdr2/ ,以避免玩家下载的Script Hook RDR2不是最新版本;
- 压缩包中包含 “NativeTrainer”和 Pools的源码,如需获取更多详细,请自行查看NativeTrainer\script.cpp和Pools\script.cpp
; THIS ARCHIVE REDISTRIBUTION IS NOT ALLOWED, USE THE FOLLOWING LINK INSTEAD
; http://www.dev-c.com/rdr2/scripthookrdr2/
SCRIPT HOOK RDR 2 SDK
v1.0.1207.73
1. General concept
The main concept is that your compiled script plugin depends only on ScriptHookRDR2.dll,
so when the game updates the only thing that user must do in order to make your
script working again is to update script hook runtime (i.e. ScriptHookRDR2.dll).
2. Changes
v1.0.1207.73
- initial release
3. Features
Runtime asi script reloading:
In order to use this feature you must create empty file called "ScriptHookRDR2.dev"
in you game's main dir. While being ingame press CTRL + R, beep sound will tell
you that all loaded scripts are fully unloaded and you can replace your *.asi,
press CTRL + R again to load the scripts, triple beep will indicate that
everything is loaded. You must have the call to scriptUnregister() SDK func in
your plugin's DllMain in order reloading feature to work correctly, see
NativeTrainer\main.cpp for more details.
Script reloading can be applied only to the *.asi plugins which were loaded
normally, i.e. using asi loader when the game was started. Script reloading is
performed by script hook and not by asi loader.
Keyboard hook:
You must use keyboard hook instead of GetKeyState/GetAsyncKeyState WIN API funcs,
because it guarantees that all key presses will be handled correctly. Keyboard
handler must be registered/unregistered in DllMain of your plugin using SDK funcs
keyboardHandlerRegister/keyboardHandlerUnregister, see NativeTrainer\main.cpp for
more details.
Example of using keyboard hook can be found in NativeTrainer\keyboard.cpp, the
trainer script is using keyboard.cpp provided functions, your projects should do
the same.
Entity pools:
All entities that game currently uses are stored in pools, each type of entity
has a separate pool. Using SDK funcs worldGetAllVehicles/Peds/Objects you can
access any entity you need.
While accessing these pools you should remember that lots of entities are being
created not by scripts, so scripts have no full control over that entities and
for ex. if you want to prevent entity from deletion by the engine or delete it
by yourself you will need to gain script control over it via setting this entity
as mission entity. Entities which are not set as mission ones can be deleted by
the engine at any time, so you must not reuse handles of these entities between
engine ticks (i.e. WAIT calls).
Original scripts follow the same rules as written above while using the natives
which access entities from the world, for ex. GET_PED_NEARBY_VEHICLES and
GET_PED_NEARBY_PEDS. See these natives as well: IS_ENTITY_A_MISSION_ENTITY,
SET_ENTITY_AS_MISSION_ENTITY.
Example of using entity pools can be found in Pools\script.cpp file.
4. Compilation
All samples here can be compiled using MSVC 2013 or higher.
5. Terms of use
- You are allowed to use this SDK only for writing scripts intended to work offline.
- You are not allowed to redistribute ScriptHookRDR2.dll with your script plugins,
provide the link to the latest runtime instead:
http://www.dev-c.com/rdr2/scripthookrdr2/
6. Samples
There are few samples included - NativeTrainer and Pools, for more details
see NativeTrainer\script.cpp and Pools\script.cpp.
(C) Alexander Blade 2019
暂无更多介绍
如果您在使用MOD站的时候遇到任何问题,可发送邮件到 mod@3dmgame.com
关于3DMGAME|招聘信息|网站地图|联系我们|媒体信息|家长监护申请引导|家长监护|汉化翻译CopyRight©2009-2021 MOD.3DMGAME.COM All Right Reserved 京ICP备14006952号-1 京网文(2016)1650-207号