[Ver 2.5] Programmable AI via Scripting - Mesujin - 11-26-2023
Programmable AI
"Am i allowed to post this thread?"
Disclaimer: This is just a.. fork?.. of "[2.2] Programmable AI via scripting" and "Github repository, made some minor improvements" thread.
This tool/ddraw are massively or originally made by;
• Doix | @Boop
• Som1Lse | @Som1Lse
• zort | About zort
• Luigi600 | @Luigi600 for neora compatibility
• and everyone else who have an effort in it.
DDraw Source : GitHub.
Thanks to @Luigi600 for Programmable AI for Neora, anything related to "Neora Compatibility" was made by him, i just "merge" both ddraw.
v2.5N might not necessary here, except if your neora has no "neora.dll" in the folder.
(Normal ver (v2.5) does support neora.)
Changelog ;
• Added neora compatibility, but your script might need a modification since "game.objects[]" cannot be done in neora mode, it should be "gamePtr.game.objects[]". In that case reverse compatibility is added, so "gamePtr.game.objects[]" work for both but "game.objects[]" only works for normal mode.
• Optimize the Illegal Input Protection.
• Reduce the input update for AI to the same as the player (2tu input update). This affect original AI as well.
I just want to make some changes, like adding something that's missing; background's layer, weapon_strength, etc.
Changelog ;
• Update the AngelScript version to the newer one (v2.36.1).
• Rewrite some part... actually almost every part.
• Fixed "ccatcher" and "ctimer" offset, new offset "ccatching" replacing the "ccatcher" offset.
• Remove some unused part.
• Added new offset "heal" with "game.objects[].heal".
• Added new global object "version" to help determine the version within the script.
• Added illegal input protection. (does not work 100% with "int ego()")
• Added special feature;
You can have "ai.as" in "ai/" folder, and the script will be used as a global script for any AI in the game.
Main function for this "ai.as" are the same as normal ".as" except it can't be "int ego()" but "int id()" instead, use "return 0;" if you want to overwrite any other ".as". "void id()" and "int id()" with "return 1;" are the same.
• Added new struct of background layer with the member ;
C++-Code:
int32 transparency[30]; // 0x445 | Value : game.files.get_backgrounds()[].layer[].transparency
int32 width[30]; // 0x4BD | Value : game.files.get_backgrounds()[].layer[].width
int32 x[30]; // 0x535 | Value : game.files.get_backgrounds()[].layer[].x
int32 y[30]; // 0x5AD | Value : game.files.get_backgrounds()[].layer[].y
int32 height[30]; // 0x625 | Value : game.files.get_backgrounds()[].layer[].height
int32 loop[30]; // 0x69D | Value : game.files.get_backgrounds()[].layer[].loop
int32 c1[30]; // 0x715 | Value : game.files.get_backgrounds()[].layer[].c1
int32 c2[30]; // 0x78D | Value : game.files.get_backgrounds()[].layer[].c2
int32 cc[30]; // 0x805 | Value : game.files.get_backgrounds()[].layer[].cc
int32 animation[30]; // 0x87D | Counter : game.files.get_backgrounds()[].layer[].animation
int32 rect[30]; // 0x8F5 | Value : game.files.get_backgrounds()[].layer[].rect
|
• Added new struct of weapon_strength's entry with the member ;
C++-Code:
int32 dvx; // +0x00 | Value : game.objects[].data.strength.entry[].dvx / game.files.datas[].strength.entry[].dvx
int32 dvy; // +0x04 | Value : game.objects[].data.strength.entry[].dvy / game.files.datas[].strength.entry[].dvy
int32 fall; // +0x08 | Value : game.objects[].data.strength.entry[].fall / game.files.datas[].strength.entry[].fall
int32 arest; // +0x0C | Value : game.objects[].data.strength.entry[].arest / game.files.datas[].strength.entry[].arest
int32 vrest; // +0x10 | Value : game.objects[].data.strength.entry[].vrest / game.files.datas[].strength.entry[].vrest
int32 respond; // +0x14 | Value : game.objects[].data.strength.entry[].respond / game.files.datas[].strength.entry[].respond
int32 effect; // +0x18 | Value : game.objects[].data.strength.entry[].effect / game.files.datas[].strength.entry[].effect
int8 unkwn1[20]; // +0x1C : game.objects[].data.strength.entry[].unkwn1[] / game.files.datas[].strength.entry[].unkwn1[]
int32 bdefend; // +0x30 | Value : game.objects[].data.strength.entry[].bdefend / game.files.datas[].strength.entry[].bdefend
int32 injury; // +0x34 | Value : game.objects[].data.strength.entry[].injury / game.files.datas[].strength.entry[].injury
int32 zwidth; // +0x38 | Value : game.objects[].data.strength.entry[].zwidth / game.files.datas[].strength.entry[].zwidth
int8 unkwn2[20]; // +0x3C : game.objects[].data.strength.entry[].unkwn2[] / game.files.datas[].strength.entry[].unkwn2[]
|
• And some other unspecified nor important additions and changes.
Learn the basic ; https://lf-empire.de/forum/showthread.php?tid=7946
Learn about AngelScript ; https://www.angelcode.com/angelscript/sdk/docs/manual/doc_script.html
Knowing the available syntax to access LF2's data ; https://github.com/Mesujin/LF2-AI-ScriptEngine/blob/master/Resources/Includes/game.h
Download
• Version 2.5 : GitHub, GoogleDrive.
• Version 2.5N : GitHub, GoogleDrive. (For Neora)
• Version 2.5DF : GitHub, GoogleDrive. (For darkfiren's exe)
• Version 2.5DFTU : GitHub, GoogleDrive. (For darkfiren's exe with 1tu mode)
• Version 2.4 : GitHub, GoogleDrive.
• Version 2.4DF : GitHub, GoogleDrive.
• Version 2.3 : GitHub, GoogleDrive. (from Seiko Santana)
• Version 2.2 : GitHub, GoogleDrive. (idk i can't find it)
Instruction
1. Pick one, Debug or Release. (Release for player, Debug for those who want to code an AI.)
2. Extract to your LF2 folder.
3. Create "ai" folder in your LF2 folder. (Put the ".as" file there)
4. Run LF2.
RE: [Ver 2.4?] Programmable AI via Scripting - 酱油君~ - 11-29-2023
RE: [Ver 2.4?] Programmable AI via Scripting - Mesujin - 12-03-2023
Version 2.5 Update!
Please refer to the main post for changelog and download ; https://lf-empire.de/forum/showthread.php?tid=11338&pid=209854#pid209854
|