Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
New Server | HOMM1: info forum | HOMM2: info forum | HOMM3: info forum | HOMM4: info forum | HOMM5: info forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Heroes 7 - Falcon's Last Flight > Thread: AI Scripts modding tutorialresearch
Thread: AI Scripts modding tutorialresearch This thread is 3 pages long: 1 2 3 · «PREV
LukaOo
LukaOo


Hired Hero
posted November 10, 2018 04:06 PM
Edited by LukaOo at 16:15, 10 Nov 2018.

vildark said:
As I don't make good progress, and it is very
My questions are:
- How do I define my function parameters?
- How do I use/inject the result of my function?
- How can I avoid calling the original function?


I think this code may help you https://github.com/LukaOo/Might-And-Magic-Heroes-VII-Mods/blob/win10.vs2017.dev/MMH7Mods/

AiAdventureMap.cpp

Here I override "Think function" for AdventureMap, and force call AI DoAttackAmy to attack specific army stack on specific map.

This code includes others overrides in AIMod.cpp.

The code was adapted for single specific map to build training environment.

P.S.

In C++ code you can not:
- Create new objects inside UE. I think It can be solved by injecting some script in like BatPio solution.    
 

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
LukaOo
LukaOo


Hired Hero
posted November 10, 2018 08:51 PM
Edited by LukaOo at 09:05, 12 Nov 2018.

Does anybody know how to drive kismet ue3? I am looking for solution to create random object with some parameters by kismet visual script. This object does not exists on map, and I try to use for this "Actor Factory" action to spawn new h7 object.  

P.s. I solved this task by using special h7 actions: "Army Spawn" and "Object Spawn".

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
MoritzBradtke
MoritzBradtke


Known Hero
posted November 12, 2018 02:55 AM
Edited by MoritzBradtke at 04:56, 12 Nov 2018.

can someone give me a hint what i am doing wrong?

i try to add some simple stuff at the Moment, i want the AI to use some activeabilities on creatures since some are missing, as well as adding new ones i create for the game but i cant get the scripts to recompile


i did everything as described in the tutorial but even if i only try to compile the 3 base files

+EditPackages=MMH7Engine
+EditPackages=MMH7GameStub
+EditPackages=MMH7Game

i get Errors and the UDK Compiler stops working and i get error, ive been using the 2014 feb Version of UDK, if i cant get to get it work ill post the Errors i get but Maybe there is something obvious im missing? this is the first time im compiling something so any hints would help what to pay Attention to

also i dont understand this:

"You can try to recompile script using "UnrealFrontend". Now project is configured to compile mods. Don't copy recompiled packages to your game, they will not work because they use native functions."


why try? dont do i have to do it? and why dont copy recompiled files, he explains how to inject em later so why does he say that? not sure About native functions yet either, how do i know which files use native functions?

i could really need some help with this, im so confused /:
im so confused im not even sure anymore how to place the files inside udk/development and which files i have to place there to make it work becaus ei tried a lot but i get Errors, either it cant find the files or something else is wrong, can i get a Little help where to place the files for now? ^^'

i have to recompile These

+EditPackages=SonnyGame(here i put my package name but where do i put it?)

+EditPackages=OnlineSubsystemUPlay
+EditPackages=MMH7Engine
+EditPackages=MMH7GameStub
+EditPackages=AkAudio
+EditPackages=MMH7Game

same here, where do i put em? inside my Project Folders Name? do i Need a classes Folder for every package of These? stupid Questions i know /:

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Vildark
Vildark


Hired Hero
posted November 12, 2018 01:54 PM
Edited by Vildark at 14:33, 12 Nov 2018.

Wow the original author of this work is in town! Thank you very much LukaOo! I will look into it.

@MoritzBradtke
I am like, what??? You can see the footer I put on BatPio wiki!!?? I thought it was personal! Indeed, Sonny is MY IA project nickname. That's really funny though.
Anyway, in the footer "Preparing UDK", I put extra steps I needed to make it work.

SonnyGame is whatever the name you should have chosen in Unreal Development Kit (UDK) to create your project.

The part "Adding necessary packages" of the footer simply completes the list of project you should add as in Preparing UDK: step 3 in the wiki.

The part "Merging files" completes Preparing UDK: step 2, because BatPio's Pawn.uc file was incomplete.

For the part "Compiling": In UnrealFrontend you should use the option "Full recompile" here:


Quote:
why try? dont do i have to do it? and why dont copy recompiled files

You should try and do it before going to next step of the wiki "AI Mod". Because it's useless to go further if you can't compile it here.
Recompiled files like MMH7Game and MMH7Engine are useless, because they are already in your game files, and should be identical. You can't directly modify MMH7Game and put it in your game file to edit IA behaviour. Try if you want, but it will not work.
Instead, You have to create a dll that will be injected with extreme injector. And inside that dll, you tell your game to call your function in your MMH7AIMod.u.

Quote:
not sure About native functions yet either, how do i know which files use native functions?


Exemple of native function call:
Quote:
native function int GetReachableCells(int movementPoints, out array<H7CombatMapCell> reachableCells);

If I understand correctly, you can't hack into this kind of function, because they are in c++ sources, not in .uc.

If you are still stuck, please post the error lines in logs you don't understand.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
MoritzBradtke
MoritzBradtke


Known Hero
posted November 12, 2018 03:48 PM
Edited by MoritzBradtke at 15:53, 12 Nov 2018.

First, thank you u gonna help me with this, i had high hopes u would respone.

Now let's start simple for the start because i don't want to cause more confusion.

Create your Project:
I've been using this as a Guideline.
https://api.unrealengine.com/udk/Three/CustomUnrealScriptProjects.html

but it seems to work a Little different than that if i dont understand it wrong…->
"Download "HMM7_2.2.1_UDK.zip" from my repository and extract to "Development" subdirectory of your UDK project."

"SonnyGame is whatever the name you should have chosen in Unreal Development Kit (UDK) to create your project."

How do i choose a name to create my Project? All I did was calling the Folder "MyProjectH7" and i put it here

C:UDK/Development/Src/MyProjectH7/Src-> now includes all "HMM7_2.2.1_UDK" content like "MMH7Game", "Core", "AkAudio" etc. which have a "classes" folder

or should it be like this

C:UDK/Development/MyProjectH7/Src-> now includes all "HMM7_2.2.1_UDK" content like  now includes all "HMM7_2.2.1_UDK" content like "MMH7Game", "Core", "AkAudio" etc. which have a "classes" folder

please check the "Src" Folder what is doubled in the first example.
My Problem is i dont understand how the Folders are built atm and the logic behind it so im confused like this. Do i have to launch the UDK build at last once like the H7Editor?(what is a modified Version of it i guess), i guess not but thought i would ask.

Maybe if u posted the links how u have set the files inside ure UDK for the Project? that would be a big help probably (:

NEXT

Adding necessary packages
[UnrealEd.EditorEngine]
+EditPackages=SonnyGame or (MyProjectH7)
+EditPackages=OnlineSubsystemUPlay
+EditPackages=MMH7Engine
+EditPackages=MMH7GameStub
+EditPackages=AkAudio
+EditPackages=MMH7Game

what the hell is MMH7Gamestub, i cant find the Folder anywhere….


AND

The part "Merging files" completes Preparing UDK: step 2, because BatPio's Pawn.uc file was incomplete.

this leads me to another important Question related to my first Problem... when i extract content of "HMM7_2.2.1_UDK" repository into UDK... is is supposed to overwrite the old content or not? that depends where i place it of Course *see above*, im Talking About Folder like "Core" which are alraedy in the Default Development/Src but as well in the repository, if i have to overwrite the old files i would have to place the content of "HMM7_2.2.1_UDK" repository's Src Folder directly in the Src Folder of UDK, would that be correct or totally wrong?


That is it for now: I hope u can help me.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Vildark
Vildark


Hired Hero
posted November 13, 2018 11:16 AM

Hey,
I am happy too to not be alone in this.
If you want to be sure to have the same UDK as I, here is the one I saved: https://drive.google.com/file/d/0Bylc7BJ0M9nCNUJhbDlzZE5MM1E/view?usp=sharing

Quote:
How do i choose a name to create my Project? All I did was calling the Folder "MyProjectH7" and i put it here

That's it, "MyProjectH7" is your project name.

The second tree is better: C:UDK/Development/MyProjectH7/Src
Everything should be in MyProjectH7. Actually, I put my SonnyGame folder in my D:/Games folder. So my project folder is D:/Games/SonnyGame. So the "C:UDK/Development/" part does not matter.

I had to create multiple projects with UDK to really understand how it works

Of course you have to overwrite the old content. You merge the 2 Src/ folder. You should only have one Src folder. That's why they have the same name.

____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
MoritzBradtke
MoritzBradtke


Known Hero
posted November 13, 2018 08:19 PM

Thank you a lot. I'll try it again.

What i don't understand atm tough. If i have to merge the Src Folders, i will put the Src content of unziped "HMM7_2.2.1_UDK" into the C:/UDK/Development/MyProjectH7/Src Folder and merge them.


But i dont understand how u can choose a different Location for your Project how u did in D:/Games.

How would UnrealFontend be Aware of that, cant it only recompile files that are located at that specific Location at UDK Folders?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
MoritzBradtke
MoritzBradtke


Known Hero
posted November 13, 2018 10:06 PM
Edited by MoritzBradtke at 23:07, 13 Nov 2018.

I think i got it now. My Problem now is the pawn file i think.

My files are now here C:/UDK/MyProjectH7(myprojectname)/Development/Src


my Default engine ini Looks like this


[UnrealEd.EditorEngine]
+EditPackages=MyProjectH7
+EditPackages=OnlineSubsystemUPlay
+EditPackages=MMH7Engine
+EditPackages=MMH7GameStub (what is this? i cant find that folder)
+EditPackages=AkAudio
+EditPackages=MMH7Game


i get Errors from that pawn file now…
if i use the Standard pawn.uc file as u've mentioned it on biopats wiki in that Picture in development/src/engnine/classes i get this


Log: Executing Class UnrealEd.MakeCommandlet
--------------------Core - Release--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:UDKMyProjectH7BinariesWin32....UDKGameScriptCore.u'
--------------------Engine - Release--------------------
Analyzing...
C:UDKMyProjectH7DevelopmentSrcEngineClassesPawn.uc(814) : Error, Redefinition of 'event PlayActorFaceFXAnim' differs from original; different number of parameters
Compile aborted due to errors.
Warning/Error Summary
---------------------
C:UDKMyProjectH7DevelopmentSrcEngineClassesPawn.uc(814) : Error, Redefinition of 'event PlayActorFaceFXAnim' differs from original; different number of parameters
Failure - 1 error(s), 0 warning(s)
Execution of commandlet took:  1.30 seconds
[Nov 13, 9:51 ] COMMANDLET 'UDK.exe make -full' FAILED

if i dont replace the pawn.uc file and use biopats i get this…

Log: Executing Class UnrealEd.MakeCommandlet
--------------------Core - Release--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:UDKMyProjectH7BinariesWin32....UDKGameScriptCore.u'
--------------------Engine - Release--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:UDKMyProjectH7BinariesWin32....UDKGameScriptEngine.u'
--------------------IpDrv - Release--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:UDKMyProjectH7BinariesWin32....UDKGameScriptIpDrv.u'
--------------------GFxUI - Release--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:UDKMyProjectH7BinariesWin32....UDKGameScriptGFxUI.u'
--------------------GameFramework - Release--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:UDKMyProjectH7BinariesWin32....UDKGameScriptGameFramework.u'
--------------------UnrealEd - Release--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:UDKMyProjectH7BinariesWin32....UDKGameScriptUnrealEd.u'
--------------------GFxUIEditor - Release--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:UDKMyProjectH7BinariesWin32....UDKGameScriptGFxUIEditor.u'
--------------------WinDrv - Release--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:UDKMyProjectH7BinariesWin32....UDKGameScriptWinDrv.u'
--------------------OnlineSubsystemPC - Release--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:UDKMyProjectH7BinariesWin32....UDKGameScriptOnlineSubsystemPC.u'
--------------------OnlineSubsystemSteamworks - Release--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:UDKMyProjectH7BinariesWin32....UDKGameScriptOnlineSubsystemSteamworks.u'
--------------------OnlineSubsystemGameCenter - Release--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:UDKMyProjectH7BinariesWin32....UDKGameScriptOnlineSubsystemGameCenter.u'
--------------------SubstanceAir - Release--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:UDKMyProjectH7BinariesWin32....UDKGameScriptSubstanceAir.u'
--------------------SubstanceAirEd - Release--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:UDKMyProjectH7BinariesWin32....UDKGameScriptSubstanceAirEd.u'
--------------------MyProjectH7Game - Release--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:UDKMyProjectH7BinariesWin32....UDKGameScriptMyProjectH7Game.u'
--------------------UDKBase - Release--------------------
Analyzing...
C:UDKMyProjectH7DevelopmentSrcUDKBaseClassesMobilePlaceablePawn.uc(64) : Error, BEGIN OBJECT: No base template named CollisionCylinder found in parent class GamePawn:     Begin Object Name=CollisionCylinder
C:UDKMyProjectH7DevelopmentSrcUDKBaseClassesSimplePawn.uc(160) : Warning, ComponentProperty Engine.Actor:Components.Components: unresolved reference to 'Sprite)'
C:UDKMyProjectH7DevelopmentSrcUDKBaseClassesSimplePawn.uc(160) : Error, Unable to parse parameter value 'Sprite)' in defaultproperties array operation:     Components.Remove(Sprite)
C:UDKMyProjectH7DevelopmentSrcUDKBaseClassesSimplePawn.uc(163) : Error, BEGIN OBJECT: No base template named CollisionCylinder found in parent class GamePawn:     Begin Object Name=CollisionCylinder
Compile aborted due to errors.
Warning/Error Summary
---------------------
C:UDKMyProjectH7DevelopmentSrcUDKBaseClassesMobilePlaceablePawn.uc(64) : Error, BEGIN OBJECT: No base template named CollisionCylinder found in parent class GamePawn:     Begin Object Name=CollisionCylinder
C:UDKMyProjectH7DevelopmentSrcUDKBaseClassesSimplePawn.uc(160) : Error, Unable to parse parameter value 'Sprite)' in defaultproperties array operation:     Components.Remove(Sprite)
C:UDKMyProjectH7DevelopmentSrcUDKBaseClassesSimplePawn.uc(163) : Error, BEGIN OBJECT: No base template named CollisionCylinder found in parent class GamePawn:     Begin Object Name=CollisionCylinder
C:UDKMyProjectH7DevelopmentSrcUDKBaseClassesSimplePawn.uc(160) : Warning, ComponentProperty Engine.Actor:Components.Components: unresolved reference to 'Sprite)'
Failure - 3 error(s), 1 warning(s)
Execution of commandlet took:  9.01 seconds
[Nov 13, 10:04 ] COMMANDLET 'UDK.exe make -full' FAILED

edit: could it be related to Microsoft Visual C++? im using a 2013 Version, i didnt have to download it because it was on my Computer already

edit2: Maybe u did modify that pawn.uc file somehow? if so im gonna Need it as well?





 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Vildark
Vildark


Hired Hero
posted November 14, 2018 11:26 AM

I am glad you got that far
You have to merge both pawn.uc files:
Biopat's one is the one to keep but it is not complete. You should modify it.
It is missing some lines on the bottom. Open both and you will see.
You have to copy UDK pawn.uc defaut properties and put them in Biopat's.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
MoritzBradtke
MoritzBradtke


Known Hero
posted November 14, 2018 07:45 PM
Edited by MoritzBradtke at 19:55, 14 Nov 2018.

Well, I've been able to compile files without errors but warnings so far but it is working i guess (:


Now that that is working i can try to edit the AI. I have more questions tough because if i want to edit AI i need to understand more.

i tested the wait script and i was able to reproduce it, so that are great News that such stuff is possible (:


if i want to add my own changes i still Need to understand some Things and i hope u can give me some insight (:

Copy form project text:

MMH7AIMod Classes

Currently MMH7AIMod is proof-of-concept of possibility to modding AI scripts. It consists of few classes that makes possible to inject Your AI classes into game. These files should not change anything in scripts behavior.

What does that mean, These scripts should not Change anything in script behaviour? I would guess, "it breaks Nothing in game" ?

so the following files are the core of the Project, now where do they come from? he explains some Things already but not everything

1)""AIModObjectsBuilder - creates Combat AI and AI Sensors""

this seems to be a modified Version of "H7AiCombatSensors.uc" ?

2)""AIModAdventureAiBuilder.uc""
modified copy of H7AdventureController, it's used to inject AIModH7AiAdventureMap into game. Don't modify this class, it's only used method is InitAdventureAI.

3)""AIModH7AiCombatMap"" - copy of H7AiCombatMap
4)""AIModH7AiAdventureMap.uc"" - modified copy of H7AiAdventureMap

So we know he used some of the core files to create the mod like 3) but he also altered some like 4) and 2), also he added "AIMod" to all of em so they are new files, not just copies regardless he changes something or not.

I'm not sure yet what he did with 1), if noone can tell me i would have to figure it out myself.


Now what is this-> "MMH7ScriptsMod.dll" ?
It is in a Folder called "MMH7ScriptsMod" together with 2 Folders with 2 seperate "MMH7AIMod.u" files, are These even related to the "MMH7ScriptsMod.dll"? do they have any Purpose being there, if so why are there 2? one in "scriptmod" and one in "scriptmoddumbexample", i guess they don't but i'm not sure.


Now i've read "MMH7ScriptsMod.dll" can be created by compiling and i might have to do this? can i use the old "MMH7ScriptsMod.dll" for all my Projects if i alter something in the scripts or do i have to create it new?

What i've tried so far but it didnt work i think since the creature didnt use the skill.

I've used the 4 files above and added
"H7AiUtilityCrAbilityScatterShot.uc"
and
"MyH7AiActionUseAbilityCreature.uc"
to the mod folder.

I've also changed 3)"AIModH7AiCombatMap" since it holds links to "H7AiActionUseAbilityCreature", so i changed that part to "MyH7AiActionUseAbilityCreature"


"H7AiUtilityCrAbilityScatterShot.uc"

is the activeability from the lizardmen, it is a brandnew file, so all i did was copying the similiar "H7AiUtilityCrAbilityNova.uc" and changed the Name, so it fits the archetype in the H7editor, is thos correct way to do it? of Course ive altered the file and changed everything from nova to scattershot.

"MyH7AiActionUseAbilityCreature.uc"

is a file that is already in the game, so i added a "My" in front of it like BatPio did with "MyH7AiSensorGoodTimeToWait.uc", then i changed the file a bit, renamed the old Name to new one in the script, added a new line to the abilties and added the scattershot, made sure to use the same layout in the script for the new added one, same as the others, so it Looks like this, i only had to Change the first part:-> (scattershot is below Nova)

//=============================================================================
// MyH7AiActionUseAbilityCreature
//=============================================================================
//
//=============================================================================
// Copyright 2013-2015 Limbic Entertainment All Rights Reserved.
//=============================================================================
class MyH7AiActionUseAbilityCreature extends H7AiActionBase;

var protected H7AiUtilityCrAbilityAcidBreath            mUAcidBreath;
var protected H7AiUtilityCrAbilitySolderingHands        mUSolderingHands;
var protected H7AiUtilityCrAbilityMagicAbsorption       mUMagicAbsorption;
var protected H7AiUtilityCrAbilityResurrection          mUResurrection;
var protected H7AiUtilityCrAbilityPiercingShot          mUPiercingShot;
var protected H7AiUtilityCrAbilityFeralCharge           mUFeralCharge;
var protected H7AiUtilityCrAbilityBackstab              mUBackstab;
var protected H7AiUtilityCrAbilityCharge                mUCharge;
var protected H7AiUtilityCrAbilityEntanglingRoots       mUEntanglingRoots;
var protected H7AiUtilityCrAbilityFatalStrike           mUFatalStrike;
var protected H7AiUtilityCrAbilityFieryEye              mUFieryEye;
var protected H7AiUtilityCrAbilityInspiringPresence     mUInspiringPresence;
var protected H7AiUtilityCrAbilityLifeDrain             mULifeDrain;
var protected H7AiUtilityCrAbilityLeafDaggers           mULeafDaggers;
var protected H7AiUtilityCrAbilityLivingShelter         mULivingShelter;
var protected H7AiUtilityCrAbilityMightyPounce          mUMightyPounce;
var protected H7AiUtilityCrAbilityNova                  mUNova;
var protected H7AiUtilityCrAbilityScatterShot           mUScatterShot;
var protected H7AiUtilityCrAbilityPoisonedBlades        mUPoisonedBlades;
var protected H7AiUtilityCrAbilitySixHeaded             mUSixHeaded;
var protected H7AiUtilityCrAbilitySplash                mUSplash;
var protected H7AiUtilityCrAbilitySoulFlayingBreath     mUSoulFlayingBreath;
var protected H7AiUtilityCrAbilitySoulReaver            mUSoulReaver;
var protected H7AiUtilityCrAbilityStrikeAndReturn       mUStrikeAndReturn;
var protected H7AiUtilityCrAbilityStrikeAndReturnMelee  mUStrikeAndReturnMelee;
var protected H7AiUtilityCrAbilitySweepingBash          mUSweepingBash;
var protected H7AiUtilityCrAbilityThorns                mUThorns;
var protected H7AiUtilityCrAbilityWitheringBreath       mUWitheringBreath;
var protected H7AiUtilityCrAbilityWitheringVenom        mUWitheringVenom;
var protected H7AiUtilityCrAbilityDivingAttack          mUDivingAttack;
var protected H7AiUtilityCrAbilityFireNova              mUFireNova;
var protected H7AiUtilityCrAbilityWhirlingDeath         mUWhirlingDeath;
var protected H7AiUtilityCrAbilityArmourPiercing        mUArmourPiercing;
var protected H7AiUtilityCrAbilityBreathOfLight         mUBreathOfLight;
var protected H7AiUtilityCrAbilityRuneTeleport          mURuneTeleport;
var protected H7AiUtilityCrAbilityThrowingHammer        mUThrowingHammer;
var protected H7AiUtilityCrAbilityRage                  mURage;
var protected H7AiUtilityCrAbilityMagmaPond             mUMagmaPond;

function String DebugName()
{
return "Use Ability";
}

function Setup()
{
mUAcidBreath = new class'H7AiUtilityCrAbilityAcidBreath';
mUSolderingHands = new class'H7AiUtilityCrAbilitySolderingHands';
mUMagicAbsorption = new class'H7AiUtilityCrAbilityMagicAbsorption';
mUResurrection = new class'H7AiUtilityCrAbilityResurrection';
mUPiercingShot = new class'H7AiUtilityCrAbilityPiercingShot';
mUFeralCharge = new class'H7AiUtilityCrAbilityFeralCharge';
mUBackstab = new class'H7AiUtilityCrAbilityBackstab';
mUCharge = new class'H7AiUtilityCrAbilityCharge';
mUEntanglingRoots = new class'H7AiUtilityCrAbilityEntanglingRoots';
mUFatalStrike = new class'H7AiUtilityCrAbilityFatalStrike';
mUFieryEye = new class'H7AiUtilityCrAbilityFieryEye';
mUInspiringPresence = new class'H7AiUtilityCrAbilityInspiringPresence';
mULeafDaggers = new class'H7AiUtilityCrAbilityLeafDaggers';
mULifeDrain = new class'H7AiUtilityCrAbilityLifeDrain';
mULivingShelter = new class'H7AiUtilityCrAbilityLivingShelter';
mUMightyPounce = new class'H7AiUtilityCrAbilityMightyPounce';
mUNova = new class'H7AiUtilityCrAbilityNova';
mUScatterShot = new class'H7AiUtilityCrAbilityScatterShot';
mUPoisonedBlades = new class'H7AiUtilityCrAbilityPoisonedBlades';
mUSixHeaded = new class'H7AiUtilityCrAbilitySixHeaded';
mUSplash = new class'H7AiUtilityCrAbilitySplash';
mUSoulFlayingBreath = new class'H7AiUtilityCrAbilitySoulFlayingBreath';
mUSoulReaver = new class'H7AiUtilityCrAbilitySoulReaver';
mUStrikeAndReturn = new class'H7AiUtilityCrAbilityStrikeAndReturn';
mUStrikeAndReturnMelee = new class'H7AiUtilityCrAbilityStrikeAndReturnMelee';
mUSweepingBash = new class'H7AiUtilityCrAbilitySweepingBash';
mUThorns = new class'H7AiUtilityCrAbilityThorns';
mUWitheringBreath = new class'H7AiUtilityCrAbilityWitheringBreath';
mUWitheringVenom = new class'H7AiUtilityCrAbilityWitheringVenom';
mUDivingAttack = new class'H7AiUtilityCrAbilityDivingAttack';
mUFireNova = new class'H7AiUtilityCrAbilityFireNova';
mUWhirlingDeath = new class'H7AiUtilityCrAbilityWhirlingDeath';
mUArmourPiercing = new class'H7AiUtilityCrAbilityArmourPiercing';
mUBreathOfLight = new class'H7AiUtilityCrAbilityBreathOfLight';
mURuneTeleport = new class'H7AiUtilityCrAbilityRuneTeleport';
mUThrowingHammer = new class'H7AiUtilityCrAbilityThrowingHammer';
mURage = new class'H7AiUtilityCrAbilityRage';
mUMagmaPond = new class'H7AiUtilityCrAbilityMagmaPond';
}

function RunScoresForAbility( H7AiCombatSensors sensors, H7Unit currentUnit, out array<AiActionScore> scores, H7BaseAbility ability )
{
local AiActionScore             score;
local H7AiSensorInputConst      sic;
local array<float>              utOut;
local int                       k;
local H7AiUtilityCombiner       currentUtility;

sic = sensors.GetSensorIConsts();

score.action = Self;
score.score = 0.0f;

    if( ability.GetArchetypeID() == "A_MagicAbsorption" )      { currentUtility = mUMagicAbsorption; }
else if( ability.GetArchetypeID() == "A_Resurrection" )         { currentUtility = mUResurrection; }
else if( ability.GetArchetypeID() == "A_SolderingHands" )       { currentUtility = mUSolderingHands; }
else if( ability.GetArchetypeID() == "A_PiercingShot" )     { currentUtility = mUPiercingShot; }
else if( ability.GetArchetypeID() == "A_PiercingShot_Apprentice" )     { currentUtility = mUPiercingShot; }
else if( ability.GetArchetypeID() == "A_FeralCharge" )          { currentUtility = mUFeralCharge; }
else if( ability.GetArchetypeID() == "A_Backstab" )             { currentUtility = mUBackstab; }
else if( ability.GetArchetypeID() == "A_Charge" )               { currentUtility = mUCharge; }
else if( ability.GetArchetypeID() == "A_EntanglingRoots" )      { currentUtility = mUEntanglingRoots; }
else if( ability.GetArchetypeID() == "A_FatalStrike" )          { currentUtility = mUFatalStrike; }
else if( ability.GetArchetypeID() == "A_FieryEye" )             { currentUtility = mUFieryEye; }
else if( ability.GetArchetypeID() == "A_InspiringPresence" )    { currentUtility = mUInspiringPresence; }
else if( ability.GetArchetypeID() == "A_LeafDaggers" )          { currentUtility = mULeafDaggers; }
else if( ability.GetArchetypeID() == "A_LifeDrain" )            { currentUtility = mULifeDrain; }
else if( ability.GetArchetypeID() == "A_LivingShelter" )        { currentUtility = mULivingShelter; }
else if( ability.GetArchetypeID() == "A_MightyPounce" )         { currentUtility = mUMightyPounce; }
else if( ability.GetArchetypeID() == "A_Nova" )                 { currentUtility = mUNova; }
else if( ability.GetArchetypeID() == "A_ScatterShot" )          { currentUtility = mUScatterShot; }
else if( ability.GetArchetypeID() == "A_PoisonedBlades" )       { currentUtility = mUPoisonedBlades; }
else if( ability.GetArchetypeID() == "A_SixHeaded" )            { currentUtility = mUSixHeaded; }
else if( ability.GetArchetypeID() == "A_Splash" )               { currentUtility = mUSplash; }
else if( ability.GetArchetypeID() == "A_SoulFlayingBreath" )    { currentUtility = mUSoulFlayingBreath; }
else if( ability.GetArchetypeID() == "A_SoulReaver" )           { currentUtility = mUSoulReaver; }
else if( ability.GetArchetypeID() == "A_StrikeAndReturn" )      { currentUtility = mUStrikeAndReturn; }
else if( ability.GetArchetypeID() == "A_StrikeAndReturn_Disable" ) { currentUtility = mUStrikeAndReturnMelee; }
else if( ability.GetArchetypeID() == "A_SweepingBash" )         { currentUtility = mUSweepingBash; }
else if( ability.GetArchetypeID() == "A_Thorns" )               { currentUtility = mUThorns; }
else if( ability.GetArchetypeID() == "A_WitheringBreath" )      { currentUtility = mUWitheringBreath; }
else if( ability.GetArchetypeID() == "A_WitheringVenom" )       { currentUtility = mUWitheringVenom; }
else if( ability.GetArchetypeID() == "A_AcidBreath" )           { currentUtility = mUAcidBreath; }
else if( ability.GetArchetypeID() == "A_ArmourPiercing" )       { currentUtility = mUArmourPiercing; }
else if( ability.GetArchetypeID() == "A_DivingAttack" )         { currentUtility = mUDivingAttack; }
else if( ability.GetArchetypeID() == "A_FireNova" )             { currentUtility = mUFireNova; }
else if( ability.GetArchetypeID() == "A_WhirlingDeath" )        { currentUtility = mUWhirlingDeath; }
else if( ability.GetArchetypeID() == "A_BreathOfLight" )        { currentUtility = mUBreathOfLight; }
   else if( ability.GetArchetypeID() == "A_RuneTeleport" )         { currentUtility = mURuneTeleport; }
else if( ability.GetArchetypeID() == "A_ThrowingHammer" )       { currentUtility = mUThrowingHammer; }
else if( ability.GetArchetypeID() == "A_Rage" )                 { currentUtility = mURage; }
else if( ability.GetArchetypeID() == "A_MagmaPond" )            
{










 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Vildark
Vildark


Hired Hero
posted November 15, 2018 11:12 AM

I am sorry that is where I am stuck too.
You have to compile MMH7ScriptsMod.dll if you want it to be different, that means if you want to change something in c++ like I tried to do. You can see my post on the previous page where I have summed up everything I have understood.
Maybe LukaOo answer can help you too.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
MoritzBradtke
MoritzBradtke


Known Hero
posted November 15, 2018 12:26 PM

Vildark said:
I am sorry that is where I am stuck too.
You have to compile MMH7ScriptsMod.dll if you want it to be different, that means if you want to change something in c++ like I tried to do. You can see my post on the previous page where I have summed up everything I have understood.
Maybe LukaOo answer can help you too.


I see. I still don't understand what the "MMH7ScriptsMod.dll" actually is tough. So that would help if u could explain it to me (:

I don't know if someone can answer it but I understand that some sort of "hook" is used to force the game to use the H7AIMod files but i don't know how to configure that myself. Is that the result what u get when compiling "MMH7ScriptsMod.dll" files?

What is the "hook"? is the "MMH7ScriptsMod.dll" the hook?

Also "C++" is the Code used in the .uc script files like "H7AiActionMoveCreatureStack", is that Right?

So that means the original "MMH7ScriptsMod.dll" file of the project can't be used if u Change something else than like he did with the wait command, u have to create a new "MMH7ScriptsMod.dll", is that correct?

Sry for so many Questions but hope i can get answers (: i really would like to improve the AI but with some Things i just dont have experience, so i Need to ask to understand it


 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Vildark
Vildark


Hired Hero
posted November 15, 2018 05:12 PM

Your enthousiasm is bliss

MMH7ScriptsMod.dll is a c++ program (*.c and *.h files, not *.uc, not *.u). When you inject it, you force the game to consider it like its own dll and use it. Then, any c++ functions inside that MMH7ScriptsMod.dll can be executed.
There are specifically some functions, called "hooks", that are called when specific actions inside the game are called. Therefore their names: they hook on an existing function to execute yours.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
MoritzBradtke
MoritzBradtke


Known Hero
posted November 16, 2018 02:32 PM
Edited by MoritzBradtke at 14:34, 16 Nov 2018.

Thanks (:

Ah, well. So if i understand it, that means if i want to Change the AI by altering some of the .uc files which are used for the AI behaviour, that isnt enough, i also have create a new .dll to make my AIMod work, so that means the tutorial
-> https://github.com/BatPio/Might-And-Magic-Heroes-VII-Mods/wiki/AI-Mod


is actually not complete? I thought it was alraedy working but i guess only for the wait example. So now u are working on the files related to the .dll to make ure changes on the .uc game files work I guess.

So what we now have to do is compiling "MMH7ScriptsMod" to get the new .dll?

That is what u are doing atm right? u are working on some files of this Folder, configure em to call ur'e changes in the "MMH7AIMod.u" with specific changes u made, not the wait example Change.


And we lack information About it? so we do not really know which of These files to Change, so we have to find it out ourselves.

What i don't understand is what u're Problem is, why it isn't working for u. I read what u wrote About it but dont understand everthing yet.

Did u consider trying something simple first like the wait example to see if u can make it work in the game instead of trying to fix the Firewall "bug"?


Do we even know how to create another .dll? does it work the same as the MMH7AIMod.u when u compile some .uc files? is it the same process?


wish u best luck on succes anyway, if u have some time to answer my Questions, i would be thankful (:

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread » This thread is 3 pages long: 1 2 3 · «PREV
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0961 seconds