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 ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Heroes 3.5 - WoG and Beyond > Thread: Better AI Fun but Impossible!!
Thread: Better AI Fun but Impossible!! This thread is 2 pages long: 1 2 · «PREV
Salamandre
Salamandre


Admirable
Omnipresent Hero
Wog refugee
posted April 26, 2013 03:28 PM
Edited by Salamandre at 15:30, 26 Apr 2013.

Because it was intended to help AI getting same towns, not human. If you want the feature to work for human as well, the whole script need changes...

Thats why I suggested to use that script I wrote, add it to better AI. You can convert towns you conquer to your faction by right clicking on them.
____________
Era II mods and utilities

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


Known Hero
The Bringer of Rain
posted April 26, 2013 05:02 PM

Quote:
Because it was intended to help AI getting same towns, not human. If you want the feature to work for human as well, the whole script need changes...

Thats why I suggested to use that script I wrote, add it to better AI. You can convert towns you conquer to your faction by right clicking on them.


Yeah I understand that.  I'm just trying to figure a way to get human to change automatically.  

Thanks for the help with the script.

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


Admirable
Omnipresent Hero
Wog refugee
posted April 26, 2013 05:10 PM
Edited by Salamandre at 18:09, 26 Apr 2013.

AI starting town type is stored at game start. Human isn't, because there was no need. So when you remove the 1000 flag, the scripts checks what is the starting town type of the attacker. In this case, attacker being human, the script does not find any reference, because only AI towns were stored.

As I said, if you want better AI to give same bonuses to human, the whole script must be redone. Better you edit the map in that case.
____________
Era II mods and utilities

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


Known Hero
The Bringer of Rain
posted April 26, 2013 07:05 PM
Edited by StrikerX at 19:09, 26 Apr 2013.

Well I figured out I don't want to remove the -1000 just change it to 1000.  But still same difference.  Your old script works fine changing towns to the human faction type when I take a town.  The problem I was trying to get around was the two hero defending town issue.  

I've done more testing and for some reason this command will never return the human player as the owner of the the defending town while in the BA trigger.

!!CA300: O?v1; [check defending town owner]  

No matter where I place it..  Even at the end after the last command changes the type of the city still says the owner is the original owner.  But when the trigger / battle is complete the owner / flags are changed to mine.  It's really bugging me!  The AI on AI works fine and is set before the trigger completes.

I realized I could just add your old script as 1000 and keep your new script as is for the AI with the -1000.

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


Admirable
Omnipresent Hero
Wog refugee
posted April 26, 2013 07:15 PM

The old script is buggy, as it returns AI first town from list but sometimes it screws. The latest update checks in memory AI town type and stores at start game in SN:W^AI town/$^; and it will work 100%.

But is only for AI, if you want human you have to store it also and remove checks which exit if player is AI. Quite tricky.
____________
Era II mods and utilities

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


Known Hero
The Bringer of Rain
posted April 26, 2013 07:30 PM

Do you know a way around that !!CA300 problem of ownership?  When I print the variables to the in game screen it seems to show the right owner of the AI but doesn't change ownership to the human till after the !!BA command is done.  

I was thinking it needed some type of refresh command but I don't see anything like that.


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


Admirable
Omnipresent Hero
Wog refugee
posted April 26, 2013 08:15 PM

But you need to start a new game while the human starting town is stored, right now it is not. So you first need to add command to store it, and only then work in !?BA1 script. If you just want to convert towns after battle, why don't you use a simple converting command, it will be much easier than change a 1 whole month tested and retested script. I am reluctant to dig in and change, it took me long time to make it bug free.
____________
Era II mods and utilities

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


Known Hero
The Bringer of Rain
posted April 26, 2013 09:10 PM
Edited by StrikerX at 21:16, 26 Apr 2013.

Quote:
But you need to start a new game while the human starting town is stored, right now it is not. So you first need to add command to store it, and only then work in !?BA1 script. If you just want to convert towns after battle, why don't you use a simple converting command, it will be much easier than change a 1 whole month tested and retested script.


Actually that's what I'm working on right now.  Whenever I click a town it will check ownership and if human player owns it the faction type will be set automatically to the human's starting faction type.

The point I'm at now is kind of what your talking about I think.  I wanted to set the human players starting faction type as a variable in the start of the script kind of like you set the difficulty to a variable with this command

!#UN:J2/?v1823; get difficulty

Mostly going off examples I can find .. not exactly sure how to do that.  It's not really needed I guess.  I could use the same code you have to get starting type of first town of human player and it shouldn't change as long as I don't lose it but would be nice to have it stored so even if the human player loses all his town it still knows which faction type to set to without having to check each time.

Quote:
I am reluctant to dig in and change, it took me long time to make it bug free.


I wasn't suggesting this at all.  Yours works great the way it is for what it's suppose to do.  I'm just kinda learning scripting and thought it would be cool to try out this with your harder AI script.  Just got done playing Age of Wonders II and I liked how it was where you could migrate towns to whatever town type you already owned.  Kind of like the destroy town script but that takes way too long to destroy, wait a week and then rebuild.  Game is over by the time you have it productive.

I appreciate the help.. I think we fixed the only issue I found with your script so now I'm just kind of trying to figure out some things.

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


Admirable
Omnipresent Hero
Wog refugee
posted April 26, 2013 09:24 PM

Ok, found the problem, after battle erm is not updated enough fast, so even if you won battle, the town is still considered other faction.

Replace with this at end:

;All AI towns will match his faction
!?BA1;  only vs neutral towns or AI-AI
!!BA:P?v300/?v301/?v302;
!!OBv300/v301/v302:T?y2;
!!FU&y2<>98:E; exit if not town
!!HE-1:O?v2;
!!FU&v2<0:E; exit if hero dead
!!CA300:H0/?y1;
!!FU&y1>-1:E;
!!FU15020:Pv2;
!!OW:C?y1;
!!SN:W^AI town^/?y2;
!!CA300&y2>=0:Oy1 Ty2 I0;

The script now checks if there is a second hero in garrison, and will convert only if you defeat him as well.
____________
Era II mods and utilities

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


Known Hero
The Bringer of Rain
posted April 26, 2013 10:16 PM
Edited by StrikerX at 17:36, 27 Apr 2013.

Quote:


;All AI towns will match his faction
!?BA1;  only vs neutral towns or AI-AI
!!BA:P?v300/?v301/?v302;
!!OBv300/v301/v302:T?y2;
!!FU&y2<>98:E; exit if not town
!!HE-1:O?v2;
!!FU&v2<0:E; exit if hero dead
!!CA300:H0/?y1;
!!FU&y1>-1:E;
!!FU15020:Pv2;
!!OW:C?y1;
!!SN:W^AI town^/?y2;
!!CA300&y2>=0:Oy1 Ty2 I0;

The script now checks if there is a second hero in garrison, and will convert only if you defeat him as well.


Nice.. this works really well now for both human and AI capturing 2 hero towns.  I saw what you mean too.  I have test map setup and had the AI take over all different types of towns with no troops and they all changed barbarian at start of first week..  It even kept my starting town type even though I lost the original town I could still change types to that same one when I captured others which is nice.

Quote:
Ok, found the problem, after battle erm is not updated enough fast, so even if you won battle, the town is still considered other faction.


I'm glad your understanding what I was seeing..  It seemed like there was a problem with it updating.  Good work around.



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

Page compiled in 0.0607 seconds