Call to H-IV mapmakers - AI enchancing scripts

The old Heroes games developed by New World Computing. Please specify which game you are referring to in your post.
User avatar
Duzeom_
Conscript
Conscript
Posts: 235
Joined: 07 Mar 2011

Unread postby Duzeom_ » 20 May 2015, 12:33

I only wonder if these sophisticated scripts, even if possible to create, would brake a game or drastically slow it down. I already noticed it that doing scripts in a loop can freeze a game.

User avatar
Karmakeld
CH Staff
CH Staff
Posts: 1126
Joined: 12 Nov 2011

Unread postby Karmakeld » 20 May 2015, 12:40

This shouldn't Be looped, but Be a series of conditionsl events.
I don't it would create issues but I get your concern
I'm silent in seven languages - and I got all my familys fear.
Everytime you throw dirt, you loose a little ground

User avatar
Duzeom_
Conscript
Conscript
Posts: 235
Joined: 07 Mar 2011

Unread postby Duzeom_ » 20 May 2015, 12:42

It would be looped after every AI hero.

(and every artifact because you can't take all artifacts with one command, you must do it one by one)

User avatar
Karmakeld
CH Staff
CH Staff
Posts: 1126
Joined: 12 Nov 2011

Unread postby Karmakeld » 20 May 2015, 13:03

I've tested a script that takes away a portion of your troops based on your diplomacy skill. It checks for basically all death and chaos aligned troops and I did this test with several encounteres without any crashes. The same idea that is suggested in this tread. Should the artifact script turn out to be unstable, the other script is likely to be aswell.
What I meant with loop, was running the same script inside the script :-)
Like triggering a battle upon victory = you'll never win.
For this to be an issue I think AI would have to encounter several neutrals within a short period of time, for the game not to be able to keep up with the script(s) being triggered. But again, it can be tested for unstability.
I'm silent in seven languages - and I got all my familys fear.
Everytime you throw dirt, you loose a little ground

User avatar
PatFX
Peasant
Peasant
Posts: 68
Joined: 05 Mar 2015
Location: Montreal, Canada

Unread postby PatFX » 20 May 2015, 17:54

2) Decreasing of luck and morale doesn't affect a quick combat, so I still prefer giving creatures at time of battle.
I did some test about decreasing/increasing luck and moral.

In one of my map, I use these kind of script, but I change the owner of the neutral for red player (me), so I control the neutral when he face a computer. The script works fine....

.... but when the computer fight neutral (without change owner), the moral and luck has no effect..... 8|

I did few test (change owner, then decrease/increase luck/Moral and then chage owner back to "no player".... and many more test with custom triggered script...) and nothing works.....

It looks like we can't modified luck and moral for computer vs neutral fight. I will need to do more test, but I think it's simply not working....

Neutral vs player works but not vs computer.

I will do some more test tonight and give some feedback to you.


PatFX

User avatar
Karmakeld
CH Staff
CH Staff
Posts: 1126
Joined: 12 Nov 2011

Unread postby Karmakeld » 20 May 2015, 18:09

Is the script placed on the neutral or the computer?
While you're at it how about running some tests where you increase Heroes att/def by e.g. 30/30, 50/50, 99/99?
I'm silent in seven languages - and I got all my familys fear.
Everytime you throw dirt, you loose a little ground

User avatar
Karmakeld
CH Staff
CH Staff
Posts: 1126
Joined: 12 Nov 2011

Unread postby Karmakeld » 20 May 2015, 18:32

Dalai regarding this request:
For example, script that gives your opponent in multiplayer game control over neutral armies on battlefield will be in high demand for some players.
Look in the script library on the FrontPage.
There is already a map/script showing how to do this.
I'm silent in seven languages - and I got all my familys fear.
Everytime you throw dirt, you loose a little ground

User avatar
Taro
Scout
Scout
Posts: 163
Joined: 11 Feb 2011
Location: Poland

Unread postby Taro » 20 May 2015, 20:09

PatFX - this will not work because it is QUICK combat. When you also change owner to human player then you play NORMAL combat, and you can see the effects of morale and luck. There are more factors which doesn't work during QC, like drain life of vampires.

Quick combat is not a simulation of real combat. It's result is calculated with some algorithm.

Karmakeld, that is what I was thinking about more or less. It's hard to take into consideration all factors and even if artifact list will be bad it's still better than what we have now.

So, can we give our propositions of lists? :devil:

User avatar
Karmakeld
CH Staff
CH Staff
Posts: 1126
Joined: 12 Nov 2011

Unread postby Karmakeld » 20 May 2015, 21:15

Taro, I think you should just give yours, otherwise this artifact discussion will never reach an end ;|
Suggested changes to your list can be added, but let's progress to the next stage - actual listing.. :-D
I'm silent in seven languages - and I got all my familys fear.
Everytime you throw dirt, you loose a little ground

User avatar
PatFX
Peasant
Peasant
Posts: 68
Joined: 05 Mar 2015
Location: Montreal, Canada

Unread postby PatFX » 20 May 2015, 21:27

Is the script placed on the neutral or the computer?
I did some test with both, test on neutral and computer and nothing works...

I will try with att/def, but I want to do some more test first with luck/moral because sometime, the computer fight without heroes in his troop.


Regarding the artifact script, I forgot to tell you something: One thing you need to know is that if you have 2 or more of the same artifact, the first one that will be remove are those in your backpack. For this reason, you need to put several script of the same artifact:

Conditionnal:If heroes has Mage's robe, take mage's robe and vMageRobe = vMageRobe + 1.

Conditionnal:If heroes has Mage's robe, take mage's robe and vMageRobe = vMageRobe + 1.
.....

Then at the end :
Conditionnal: If vMageRobe =1, give 1 mage's robe and set vMageRobe to 0.

Conditionnal: If vMageRobe =2, give 2 mage's robe and set vMageRobe to 0.


This is really important because if the hero has 2 Mage's Robe and 1 Robe of the Guardian, the script will remove the Mage's Robe in the backpack remove the Robe of the Guardian, then give back the Robe of the Guardian, but there will be already a Mage's robe equip (the second one that was not remove), so the Robe of the Guardian will go in your backpack

For example, script that gives your opponent in multiplayer game control over neutral armies on battlefield will be in high demand for some players.

This is really easy to do...but......:
You only need to change owner of neutral on encounter. If the neutral is victorious, you change back owner to "no player"..... but there is a little problem......because the troop is no more neutral, the player can pay to surrender and save the creature (send to the nearest castle)....

There is 2 way to counter this:

1- The first method consist of giving a Shacle of War to the opposing troop..... but the troop need a hero and the hero need at least 1 slot empty to wear th Shacle of War. So you need to remove item on that hero and then give shacle of war, and then give back his item.... at he end of combat, you need to remove Shackle of War (defeat or Victorious). If the neutral troop (change owner) face an other player troop with only creature, this method don't work.

2- The second method (the best one) consist of removing gold from player to prevent him to pay and surrender. Then at the end of combat (defeat or victorious), you need to give him back his gold. With this method, you need to find how many gold the player own and then give back the same quantity. The binary way is the best but need a lot of script:

.....
if gold >= 8192, take 8192 gold and set vG8192 to 1
if gold >= 4096, take 4096 gold and set vG4096 to 1
If gold >= 2056, take 2056 gold and set vG2056 to 1
if gold >= 1024, take 1024 gold and set vG1024 to 1
.....
if gold >= 2, take 2 gold and set vG2 to 1
if gold >=1, take 1 gold and set vG1 to 1

Then (at the end of combat):
....
if vG8192 = 1, give 8192 gold
.....
if vG1 = 1, give 1 gold


The same kind of script can be use to modified the quantity of creatures of a troop (instead of gold, look for a creature type, find the quantity using same the method has gold). Then, if you want they troop to have only 50% creatures, you need to do a binary right shift (1 right shift = /2, 2 right shift = /4, 3 right shift = /8....). You can do 1 left binary shift for 2X.... 2 left bianry shift for 4X....

For exemple: the neutral troop has 10 medusa but you want this troop to become 5 medusa when fighting a computer:

if number of medusas >=16, take 16 medusa and set vM16 to 1
if number of medusas >=8, take 8 medusa and set vM8 to 1
if number of medusas >=4, take 4 medusa and set vM4 to 1
if number of medusas >=2, take 2 medusa and set vM2 to 1
if number of medusas >=1, take 1 medusa and set vM1 to 1


result:

vM16 = 0
vM8 = 1
vM4 = 0
vM2 = 1
vM1 = 0

Binary = 01010 = 10 decimal

right binary shift = 00101 = 5 decimal

To do this, you need to shift the value from 1 variable to an other

vM16 to vM8
vM8 to vM4
vM4 to vM2
vm2 to vM1
vM1 is lost

so:

Set vM1 to 0
If vM2 = 1, set vM1 to 1 and vM2 to 0
if vM4 = 1, set vM2 to 1 and vM4 to 0
if vM8 = 1, set vM4 to 1 and vM8 to 0
.......


Then,
if vM1 = 1, give 1 medusa
if vM2 = 1, give 2 medusa
if vM4 = 1, give 4 medusa
.......



With this method, you can give/remove any % of creatures (% = 1/2 exponent X)




PatFX

User avatar
PatFX
Peasant
Peasant
Posts: 68
Joined: 05 Mar 2015
Location: Montreal, Canada

Unread postby PatFX » 21 May 2015, 17:26

I had no time for luck/moral test last night.....

Regarding combat of computer vs neutral, I think it's better to remove a % of creatures from the neutral instead of giving creatures to the computer and then remove some creatures.

Regarding the artifact list:

After you remove all artifact from the heroes and set each variable to 0 or 1 (1 if the hero has the artifact) and before starting to give back artifact to the hero, we should use a variable to look if the hero has a complet set (Tiger, Archmage....) and then set a variable for each set.

Exemple: if the player has the Tiger helm (vTigerHelm = 1), Tiger Armor (vTigerArmor = 1) and Frost Hammer (vFrostHammer = 1), set vSetTiger to 1.

Those variable will be usefull for the next step (give back artifact), but dont foreget to set those variable to 0 at the end (after all artifact are give back)


here is my list for artifact on shoulder:

if vSetArchmage = 1:
give Angel Feather Cloak and set vAngelFeatherCloak to 0
give Staff of Disruption and set vStaffDisruption to 0
give Archmage's Hat and set vArchmageHat to 0
give Wayfaring Boots and set vWayfaringBoots to 0
give Ring of Flare and set vRingFlare to 0

If vRobeGuardian = 1:
give Robe of the Guradian and set vRobeGuardian to 0

if SetDarkPriest = 1:
give Cloak of Darkness and set vCloakDarkness to 0
give Ring of Light and set vRingLight to 0

if totalnumberof creatures >=1 and vCapProtection = 1, give Cap of Protection and set vCapProtection to 0

if skillmastery(magic resistance) = -1
if vInvulnerableCloak = 1, give Neener's Invulnerable Cloak and set vInvulnerableCloak to 0

if skillmastery(magic resistance) = 0
if vInvulnerableCloak = 1, give Neener's Invulnerable Cloak and set vInvulnerableCloak to 0
if vMantleSpell = 1, give Mantle of Spell Turning and set vMantleSpell to 0

if skillmastery(magic resistance) = 1
if vInvulnerableCloak = 1, give Neener's Invulnerable Cloak and set vInvulnerableCloak to 0
if vMantleSpell = 1, give Mantle of Spell Turning and set vMantleSpell to 0
if vCowlResistance = 1, give Cowl of Resistance and set vCowlResistance to 0

if skillmastery(magic resistance) = 2 or skillmastery(magic resistance) = 3
if vInvulnerableCloak = 1, give Neener's Invulnerable Cloak and set vInvulnerableCloak to 0
if vMantleSpell = 1, give Mantle of Spell Turning and set vMantleSpell to 0
if vCowlResistance = 1, give Cowl of Resistance and set vCowlResistance to 0
if vCloakWarding = 1, give Cloak of Warding and set vCloakWarding to 0

if vCLoakDarkness =1, give Cloak of Darkness and set vCloakDarkness to 0

if vAngelFeatherCloak = 1, give Angel Feather Cloak and set vAngelFeatherCloak to 0

if skillmastery(magic resistance) = -1
if vMantleSpell = 1, give Mantle of Spell Turning and set vMantleSpell to 0
if vCowlResistance = 1, give Cowl of Resistance and set vCowlResistance to 0
if vCloakWarding = 1, give Cloak of Warding and set vCloakWarding to 0

if skillmastery(magic resistance) = 0
if vCowlResistance = 1, give Cowl of Resistance and set vCowlResistance to 0
if vCloakWarding = 1, give Cloak of Warding and set vCloakWarding to 0

if skillmastery(magic resistance) = 1
if vCloakWarding = 1, give Cloak of Warding and set vCloakWarding to 0

if vCapProtection = 1, give Cap of Protection and set vCapProtection to 0

if vMageRobe = 1, give Mage's Robe and set vMageRObe to 0

if vCloakDistraction = 1, give Cloak of Distraction and set vCloakDistraction to 0

if skillmastery(magic resistance) = 4
if vInvulnerableCloak = 1, give Neener's Invulnerable Cloak and set vInvulnerableCloak to 0
if vMantleSpell = 1, give Mantle of Spell Turning and set vMantleSpell to 0
if vCowlResistance = 1, give Cowl of Resistance and set vCowlResistance to 0
if vCloakWarding = 1, give Cloak of Warding and set vCloakWarding to 0



RESUME:

Set Archmage
Robe of the Guardian
Set Dark Priest
Cap of Protection (if creatures in troop)
100% magic resistance
Cloak of Darkness
Angel Feather Cloak
80% magic resistance
70% magic resistance
50%magic resistance
30% magic resistance
Cap of Protection (no creature, but usefull for summon/illusion)
Mage's Robe
Cloak of Distraction
magic resistance on a hero with grandmaster magic resistance (useless, but prevent from deleting artifact)


PatFX

User avatar
GreatEmerald
CH Staff
CH Staff
Posts: 3330
Joined: 24 Jul 2009
Location: Netherlands

Unread postby GreatEmerald » 21 May 2015, 18:41

By "Cap of Protection" I assume you mean the Cape of Protection...

User avatar
Karmakeld
CH Staff
CH Staff
Posts: 1126
Joined: 12 Nov 2011

Unread postby Karmakeld » 21 May 2015, 19:25

Just to set one thing clear, a Cap is put on the head whilst a Cape is placed on your shoulders (CapE of Protection). :) (GE you just beat me to it I can see, by the minutte).
I'm also not sure which artifacts offer 80% MR. :| I couldn't fint it.

Now I have a few exceptions from your list: The Archmage's set. Sure the hero would benefit from Flight, Heavenly Shield and Blur in combat. But only IF the hero has magic skill(s) and the enemy has troops/hero with wards/high Magic Resistance. If not I would put it after the Dark Priest set, as both the Robe of the Guardian and the Dark Priest set offers better protection for the AI hero. In fact, I'd just might place it as 3rd under any circumstances (also to make listing easier, leaving out too many 'if's').
Now I don't think we need to complicate things too much, so I'd also say that Angel Feather Cloak is generally more useful/powerful than Cloak of Darkness.
I just tested some hero vs. hero (same skills and levels) and with Angel Feather Cloak hero gets +300 hits points. Now it takes more than twice as many turns to kill the hero with the Angel Feather Cloak (+300 hp) compared to Cloak of Darkness (10 def.) (if you compare the max dmg. possible).
Based on this newly obtained info, and taking Hero survivability into account, I would list it:

Robe of the Guardian (first 3 attacks wasted, and AI won't think to use weakest troops for those attacks - might also save AI troops vs neutrals)
Archmage Set (+300 hp, blur, flight, ignore all enemy MR)
Angel Feather Cloak (+300 hp + flight)
Dark Priest Set (Guardian Angel)
Neener’s Invulnerable Cloak (100% MR)
Cape of Protection (if creatures in army, +30% MR to troops, gone if hero is dead)
Mantle of Spell Turning (70% MR)
Cowl of Resistance (+50% MR)
Cloak of Warding (+30% MR)
Cloak of Darkness (+10 defense - if opponents has aprox. the same stats, +10 is still less than 10 dmg. diff. for a lvl 10 hero)
Cape of Protection (if no troops)
Mage's Robe (spell cost reduced by 1)
Cloak of Distraction. (ignore threat area)
I'm silent in seven languages - and I got all my familys fear.
Everytime you throw dirt, you loose a little ground

User avatar
PatFX
Peasant
Peasant
Posts: 68
Joined: 05 Mar 2015
Location: Montreal, Canada

Unread postby PatFX » 21 May 2015, 21:04

By "Cap of Protection" I assume you mean the Cape of Protection...
.... my english is not really good..... Yes, I means Cape.... :)

I just tested some hero vs. hero (same skills and levels) and with Angel Feather Cloak hero gets +300 hits points. Now it takes more than twice as many turns to kill the hero with the Angel Feather Cloak (+300 hp) compared to Cloak of Darkness (10 def.) (if you compare the max dmg. possible).
Based on this newly obtained info, and taking Hero survivability into account, I would list it:
I agree. Angel Feather Cloak should come before Cloak of Darkness....but I'm not sure I would put it before 100% magic resistance....and at low level, I think Cloak of Darkness is better, but I did never test it.... and don't forget that Cloak of Darkness gives life Ward. Maybe we can use a IF to look at the experience level of the hero or the alignement of opposing troop (Life)..... I really like to add a lot of IF... :D
I'm also not sure which artifacts offer 80% MR. I couldn't fint it.
If you look at the script, 80% magic resistance come from Basic Magic resistance Skill (30%) and Cowl of Resistance together(50%) = 80%.

100% magic resistance come from Invulnerable Cloak OR many combo of Magic resistance skill and artifact, not only the Invulnerable Cloak.....

For exemple, IF :D the hero has advance magic resistance (50%) and a Mantle of Spell Turning (70%), he will be 100% magic resistance, so I did put it before CapE :) of Protection.

......but maybe it's a little bit too complicate.


Neener's invulnerable Cloak is totaly useless if the hero his Grandmaster magic resistance. So I think it's important to do some IF to be sure we don't put some magic resistance artifact on a hero with Grandmaster magic resistance.

Personnaly, I prefer Cloak of Darkness over Cloak of Warding, Cowl of resistance and Mantle of Protection (except if I get 100% with these artifact and magic resistance skill) because if my hero has no magic resistance, he is probably at low level, so +10 def is welcome.

PatFX

User avatar
Karmakeld
CH Staff
CH Staff
Posts: 1126
Joined: 12 Nov 2011

Unread postby Karmakeld » 21 May 2015, 21:28

I understand your point, and ofcourse you could argue that 10 hp is still a lot compared to a heroes total hp. Thats fine with me.
I think I'll let it be up to the person doing the actual scripting to decide the amount of if's..
I'm silent in seven languages - and I got all my familys fear.
Everytime you throw dirt, you loose a little ground

User avatar
GreatEmerald
CH Staff
CH Staff
Posts: 3330
Joined: 24 Jul 2009
Location: Netherlands

Unread postby GreatEmerald » 21 May 2015, 21:38

I'd put the Cloak of Darkness at least above the Cloak of Warding. After all, magic resistance is totally useless when fighting against might creatures, and that's the majority of neutral troops.

User avatar
Dalai
Equilibris Team
Equilibris Team
Posts: 1073
Joined: 06 Jan 2006
Contact:

Unread postby Dalai » 22 May 2015, 10:25

Taro wrote:I tested decreasing first - no effect after 20 of battles. And then both decreasing on one side and increasing on the other side. Again - nothing.
That means that you were right, and luck/morale does not affect quick battles. Sad, but we'll have to deal with it.
Karmakeld wrote:I don't see a point in spending many months, making comparisons, calculations and seriously complex scripts, only to realize it still wouldn't result in the perfect choice of artifacts for a given AI hero and it's army.
Instead let just take a few steps in the right direction.
Agree.

Creating lists like the one above is very useful for this.
PatFX wrote:For exemple, IF :D the hero has advance magic resistance (50%) and a Mantle of Spell Turning (70%), he will be 100% magic resistance, so I did put it before CapE :) of Protection.
The hero will have 1 - (1-0.5)*(1-0.7) = 0.85, or 85% Magic Resistance.
"Not a shred of evidence exists in favour of the idea that life is serious." Brendan Gill

User avatar
Taro
Scout
Scout
Posts: 163
Joined: 11 Feb 2011
Location: Poland

Unread postby Taro » 22 May 2015, 13:31

In other words, artifacts give magic resistence with some % of what is not covered with skill magic resistance. If mr WITH SKILL equals 50%, then there is 50% left. 70% (artifact) from 50% (left) equals 35%.

50% (skill) plus 35% (artifact bonus calculated) is 85%.

User avatar
PatFX
Peasant
Peasant
Posts: 68
Joined: 05 Mar 2015
Location: Montreal, Canada

Unread postby PatFX » 22 May 2015, 14:02

The hero will have 1 - (1-0.5)*(1-0.7) = 0.85, or 85% Magic Resistance.
You are right. I thought it was additive, but no..... it's multiplicative.... so the only way to get 100% MR is invulnerable cloak or Grandmaster magic resistance....

User avatar
Karmakeld
CH Staff
CH Staff
Posts: 1126
Joined: 12 Nov 2011

Unread postby Karmakeld » 23 May 2015, 13:23

So I guess no one disagree to this?:
I'd put the Cloak of Darkness at least above the Cloak of Warding. After all, magic resistance is totally useless when fighting against might creatures, and that's the majority of neutral troops.
Perhaps even above Cowl of Resistance?

Anyway, let's move on.. So my girl friend said, hey I'm going out, looking for boots and shoes, so I tought I'll might as well do the same (the 3 drum hits indicated that this was a joke) :ashamed:

Wayfarer Boots (+10 spell points, +25% movement bonus, ignores all terrain penalties.)
Boots of Travel (+50% movement)
Boots of the Explorer (ignore all terrain penalties)
Winged Sandals (+2 combat movement)
Snowshoes (ignore snow terrain)
Fireproof Boots (volcanic terrain)
Boot of the Crocodile (swamp terrain)
Surefooted Boots (rough terrain)
Sandwalker Sandals (sand terrain)
I'm silent in seven languages - and I got all my familys fear.
Everytime you throw dirt, you loose a little ground


Return to “Heroes I-IV”

Who is online

Users browsing this forum: No registered users and 3 guests