Script Hook RDR2 SDK
主要編譯是基於ScriptHookRDR2.dll,當遊戲更新時,只需要更新ScriptHookRDR2.dll即可,一般情況開發文件不需要進行更新,不過不排除特殊情況。 - 如果想讓遊戲重新加載asi腳本,但不想重啓遊戲,只需在遊戲目錄中創建一個空的“ScriptHookRDR2.dev”文件,然後在遊戲中按“Ctrl+R”,聽到“滴”的聲音,即表示腳本卸載完成,再次按“Ctrl+R”,聽到“滴
截圖 共 5 張
模組介紹 作者原文
主要編譯是基於ScriptHookRDR2.dll,當遊戲更新時,只需要更新ScriptHookRDR2.dll即可,一般情況開發文件不需要進行更新,不過不排除特殊情況。 - 如果想讓遊戲重新加載asi腳本,但不想重啓遊戲,只需在遊戲目錄中創建一個空的“ScriptHookRDR2.dev”文件,然後在遊戲中按“Ctrl+R”,聽到“滴”的聲音,即表示腳本卸載完成,再次按“Ctrl+R”,聽到“滴滴滴”的聲音,即表示腳本加載完成;
**注:該包爲開發者用的,非開發者請轉到** **
Script Hook RDR2 SDK:
主要編譯是基於ScriptHookRDR2.dll,當遊戲更新時,只需要更新ScriptHookRDR2.dll即可,一般情況開發文件不需要進行更新,不過不排除特殊情況。
DeBug:
- 如果想讓遊戲重新加載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:
- 你必須使用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周圍的載具]]( [獲取ped周圍的ped]]( “[IS_ENTITY_A_MISSION_ENTITY [是否爲任務實體]]( [設置爲任務實體]](
- 可以在Pools\script.cpp中查看實體相關的代碼示例;
編譯:
- 實例中的腳本需要“Visual Studio 2013”或更高的版本才能正常編譯
使用條款:
- 您只能使用此SDK編譯/製作線下的腳本Mod,禁止用於線上;
- 您在發佈腳本時,請勿包含“ScriptHookRDR2.dll”文件,需要將ScriptHookRDR2.dll的下載指向,以避免玩家下載的Script Hook RDR2不是最新版本;
實例
- 壓縮包中包含 “NativeTrainer”和 Pools的源碼,如需獲取更多詳細,請自行查看NativeTrainer\script.cpp和Pools\script.cpp
- * *
EN:; THIS ARCHIVE REDISTRIBUTION IS NOT ALLOWED, USE THE FOLLOWING LINK INSTEAD;
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 mi …
安裝與使用 安裝:按包內說明操作
- 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
- 這類遊戲沒有通用的模組管理器:有的模組直接替換遊戲檔案、有的放進遊戲專屬的 Mods 資料夾、有的要先裝遊戲對應的社群載入器或工具,以包內說明為準。
- 嚴格按說明放置檔案;標註「前置依賴」的模組需要把依賴一併裝好。
- 啟動遊戲確認載入成功;部分遊戲需要在設定或模組選單裡手動啟用。
不同遊戲、不同模組的安裝位置差異很大,包內說明是最可靠的依據。