Daily growth script

Official forum of the Wake of Gods mod to Heroes of Might and Magic III.

Moderator: Moderators

LarvaExotech
Leprechaun
Leprechaun
Posts: 28
Joined: 01 Jan 2007

Daily growth script

Postby LarvaExotech » Nov 2 2009, 16:29

Hello again :)

I have made a code that changes the way new recruits come to city. Its now like in Heroes4, where creatures are coming every day, not every week.

It calculates all correctly, it means that growth will be always like in original game, but divided on seven days.

For example, if you have a growth of +6 per week in original heroes3, then you will get 6 creatures at day 1.

Original Heroes3:
Day1: 0 creatures
Day2: 0 creatures
Day3: 0 creatures
Day4: 0 creatures
Day5: 0 creatures
Day6: 0 creatures
Day7: 0 creatures
Day1: 6 creatures

With my code it is divided on seven days so it will look like:
Daily Growth Heroes3:
Day1: 0 creatures
Day2: 1 creature
Day3: 2 creatures
Day4: 2 creatures
Day5: 3 creatures
Day6: 4 creatures
Day7: 5 creatures
Day1: 6 creatures

So it handles perfectly creatures that should not come every day. If you have a creature that has growth +3/week then you will get one creature on day2, one creature on day5 and one creature on day1 of new week which will equal original heroes.

Its not hardcoded, its calculated using growth stats of every creature, so if you change for example Behemoth growth with !#MA to 14 then my code will still work correctly giving you 2 behemoths per day to recruit.

Code: Select all

[ daily growth ]

!#VRv9433:S0;

!#TM91:S8/255/7/255;
!#TM92:S9/255/7/255;

!?TM92;
!!VRv9433:S0; set as not decreased

!?TM91; fires every population - decrease population
!!FU&v4933=1:E; population has been already decreased
!!UN:U98/-1/?y-1;
!!VRv1:S-1;
!!VRv2:S-1;
!!VRv3:S-1;
!!DO28116/1/y-1/1&v9433=0:P;
!!VRv9433:S1; set as decreased

!?FU28116;
!!UN:U98/-1/-1/1;
!!CA1:O?y1;
!!CA1:T?y-1;

!!CA1:N?z1;

!!FU28112:Py-1/0; get 1st lvl monster
!!FU&v10=-1:E; exit if no monster found ?
!!FU28117:P0/v10; get prod to v360
!!CA1:M1/0/?v364/?v365; get recruits
!!VRv364:-v360; sub by growth
!!VRv365:-v360; sub by growth
!!CA1&y1<>-1:M1/0/v364/v365; update recruits

!!FU28112:Py-1/1; get 2nd lvl monster
!!FU&v10=-1:E; exit if no monster found ?
!!FU28117:P1/v10; get prod to v360
!!CA1:M1/1/?v364/?v365; get recruits
!!VRv364:-v360; sub by growth
!!VRv365:-v360; sub by growth
!!CA1&y1<>-1:M1/1/v364/v365; update recruits

!!FU28112:Py-1/2; get 3rd lvl monster
!!FU&v10=-1:E; exit if no monster found ?
!!FU28117:P2/v10; get prod to v360
!!CA1:M1/2/?v364/?v365; get recruits
!!VRv364:-v360; sub by growth
!!VRv365:-v360; sub by growth
!!CA1&y1<>-1:M1/2/v364/v365; update recruits

!!FU28112:Py-1/3; get 4th lvl monster
!!FU&v10=-1:E; exit if no monster found ?
!!FU28117:P3/v10; get prod to v360
!!CA1:M1/3/?v364/?v365; get recruits
!!VRv364:-v360; sub by growth
!!VRv365:-v360; sub by growth
!!CA1&y1<>-1:M1/3/v364/v365; update recruits

!!FU28112:Py-1/4; get 5th lvl monster
!!FU&v10=-1:E; exit if no monster found ?
!!FU28117:P4/v10; get prod to v360
!!CA1:M1/4/?v364/?v365; get recruits
!!VRv364:-v360; sub by growth
!!VRv365:-v360; sub by growth
!!CA1&y1<>-1:M1/4/v364/v365; update recruits

!!FU28112:Py-1/5; get 6th lvl monster
!!FU&v10=-1:E; exit if no monster found ?
!!FU28117:P5/v10; get prod to v360
!!CA1:M1/5/?v364/?v365; get recruits
!!VRv364:-v360; sub by growth
!!VRv365:-v360; sub by growth
!!CA1&y1<>-1:M1/5/v364/v365; update recruits

!!FU28112:Py-1/6; get 7th lvl monster
!!FU&v10=-1:E; exit if no monster found ?
!!FU28117:P6/v10; get prod to v360
!!CA1:M1/6/?v364/?v365; get recruits
!!VRv364:-v360; sub by growth
!!VRv365:-v360; sub by growth
!!CA1&y1<>-1:M1/6/v364/v365; update recruits

!?FU28117; get castle creature production (x1 = creature level, x2 = creature number , castle at v1/v2/v3)
!!MA:Gx2/?v360; get growth to v360

!!FU28115:Px1; check if correct lvl built
!!VRv360&-2:S0; set to 0 if not built
!!FU&-2:E; exit (return 0)

!!VRv361:Sv360 :2;

!!CA1:B3/9; check if castle is built
!!VRv360&1:+v360; double production if castle
!!CA1:B3/8; check if citadel is built
!!VRv360&1:+v361; 50% production if citadel
!!CA1:B3/26; check if grail is built
!!VRv360&1:*2;

!?TM35; fires every day for every color
!!OW:C?y-2;
!!UN:U98/-1/?y-1;
!!DO28111/1/y-1/1:Py-2; for every castle with y-2 color

!?FU28111;
!!UN:U98/-1/x16/1; store coors to v1/v2/v3
!!CA1:O?y-1; store castle owner to y-1
!!FU28114&y-1=x1:P;

!?FU28114; add daily prod

!!VRv4:Sv1 -1; po4 stores first 4 lvl
!!VRv5:Sv2;
!!VRv6:Sv3;

!!VRv7:Sv1 +1; po7 stores last 3 lvls
!!VRv8:Sv2;
!!VRv9:Sv3;

!!CA1:T?y-1;

!!CA1:N?z1;

!!FU28112:Py-1/0;
!!FU&v10=-1:E; exit if no monster found ?
!!UN:N3/2/v10/0;
!!MA:Gv10/?y-2;
!!VRy-3:Sy-2 :2;

!!FU28115:P0; check if 1lvl built
!!VRy-2&-2:S0; set to 0 if not built
!!CA1:B3/9; check if castle is built
!!VRy-2&1:+y-2; double production if castle
!!CA1:B3/8; check if citadel is built
!!VRy-2&1:+y-3; 50% production if citadel
!!PO4:V0/?y-4;
!!VRy-2:*100 :7;
!!VRy-4:+y-2; add daily production
!!VRy-5:Sy-4 :100;
!!PO4&y-5<=0:V0/y-4; set new value to city
!!CA1:M1/0/dy-5/dy-5; add new monsters to city
!!VRy-5:*100; x100 it
!!VRy-4:-y-5; sub y-5 from y-4
!!PO4:V0/y-4; set new value

!!FU28112:Py-1/1;
!!FU&v10=-1:E; exit if no monster found ?
!!UN:N3/2/v10/0;
!!MA:Gv10/?y-2;
!!VRy-3:Sy-2 :2;

!!FU28115:P1; check if 2lvl built
!!VRy-2&-2:S0; set to 0 if not built
!!CA1:B3/9; check if castle is built
!!VRy-2&1:+y-2; double production if castle
!!CA1:B3/8; check if citadel is built
!!VRy-2&1:+y-3; 50% production if citadel
!!PO4:V1/?y-4;
!!VRy-2:*100 :7;
!!VRy-4:+y-2; add daily production
!!VRy-5:Sy-4 :100;
!!PO4&y-5<=0:V1/y-4; set new value to city
!!CA1:M1/1/dy-5/dy-5; add new monsters to city
!!VRy-5:*100; x100 it
!!VRy-4:-y-5; sub y-5 from y-4
!!PO4:V1/y-4; set new value

!!FU28112:Py-1/2; *** edit ***
!!FU&v10=-1:E; exit if no monster found ?
!!UN:N3/2/v10/0;
!!MA:Gv10/?y-2;
!!VRy-3:Sy-2 :2;

!!FU28115:P2; check if 3lvl built *** edit ***
!!VRy-2&-2:S0; set to 0 if not built
!!CA1:B3/9; check if castle is built
!!VRy-2&1:+y-2; double production if castle
!!CA1:B3/8; check if citadel is built
!!VRy-2&1:+y-3; 50% production if citadel
!!PO4:V2/?y-4; *** edit ***
!!VRy-2:*100 :7;
!!VRy-4:+y-2; add daily production
!!VRy-5:Sy-4 :100;
!!PO4&y-5<=0:V2/y-4; set new value to city *** edit ***
!!CA1:M1/2/dy-5/dy-5; add new monsters to city *** edit ***
!!VRy-5:*100; x100 it
!!VRy-4:-y-5; sub y-5 from y-4
!!PO4:V2/y-4; set new value *** edit ***

!!FU28112:Py-1/3; *** edit ***
!!FU&v10=-1:E; exit if no monster found ?
!!UN:N3/2/v10/0;
!!MA:Gv10/?y-2;
!!VRy-3:Sy-2 :2;

!!FU28115:P3; check if 4lvl built *** edit ***
!!VRy-2&-2:S0; set to 0 if not built
!!CA1:B3/9; check if castle is built
!!VRy-2&1:+y-2; double production if castle
!!CA1:B3/8; check if citadel is built
!!VRy-2&1:+y-3; 50% production if citadel
!!PO4:V3/?y-4; *** edit ***
!!VRy-2:*100 :7;
!!VRy-4:+y-2; add daily production
!!VRy-5:Sy-4 :100;
!!PO4&y-5<=0:V3/y-4; set new value to city *** edit ***
!!CA1:M1/3/dy-5/dy-5; add new monsters to city *** edit ***
!!VRy-5:*100; x100 it
!!VRy-4:-y-5; sub y-5 from y-4
!!PO4:V3/y-4; set new value *** edit ***

!!FU28112:Py-1/4; *** edit ***
!!FU&v10=-1:E; exit if no monster found ?
!!UN:N3/2/v10/0;
!!MA:Gv10/?y-2;
!!VRy-3:Sy-2 :2;

!!FU28115:P4; check if 5lvl built *** edit ***
!!VRy-2&-2:S0; set to 0 if not built
!!CA1:B3/9; check if castle is built
!!VRy-2&1:+y-2; double production if castle
!!CA1:B3/8; check if citadel is built
!!VRy-2&1:+y-3; 50% production if citadel
!!PO7:V0/?y-4; *** edit ***
!!VRy-2:*100 :7;
!!VRy-4:+y-2; add daily production
!!VRy-5:Sy-4 :100;
!!PO7&y-5<=0:V0/y-4; set new value to city *** edit ***
!!CA1:M1/4/dy-5/dy-5; add new monsters to city *** edit ***
!!VRy-5:*100; x100 it
!!VRy-4:-y-5; sub y-5 from y-4
!!PO7:V0/y-4; set new value *** edit ***

!!FU28112:Py-1/5; *** edit ***
!!FU&v10=-1:E; exit if no monster found ?
!!UN:N3/2/v10/0;
!!MA:Gv10/?y-2;
!!VRy-3:Sy-2 :2;

!!FU28115:P5; check if 5lvl built *** edit ***
!!VRy-2&-2:S0; set to 0 if not built
!!CA1:B3/9; check if castle is built
!!VRy-2&1:+y-2; double production if castle
!!CA1:B3/8; check if citadel is built
!!VRy-2&1:+y-3; 50% production if citadel
!!PO7:V1/?y-4; *** edit ***
!!VRy-2:*100 :7;
!!VRy-4:+y-2; add daily production
!!VRy-5:Sy-4 :100;
!!PO7&y-5<=0:V1/y-4; set new value to city *** edit ***
!!CA1:M1/5/dy-5/dy-5; add new monsters to city *** edit ***
!!VRy-5:*100; x100 it
!!VRy-4:-y-5; sub y-5 from y-4
!!PO7:V1/y-4; set new value *** edit ***

!!FU28112:Py-1/6; *** edit ***
!!FU&v10=-1:E; exit if no monster found ?
!!UN:N3/2/v10/0;
!!MA:Gv10/?y-2;
!!VRy-3:Sy-2 :2;

!!FU28115:P6; check if 5lvl built *** edit ***
!!VRy-2&-2:S0; set to 0 if not built
!!CA1:B3/9; check if castle is built
!!VRy-2&1:+y-2; double production if castle
!!CA1:B3/8; check if citadel is built
!!VRy-2&1:+y-3; 50% production if citadel
!!PO7:V2/?y-4; *** edit ***
!!VRy-2:*100 :7;
!!VRy-4:+y-2; add daily production
!!VRy-5:Sy-4 :100;
!!PO7&y-5<=0:V2/y-4; set new value to city *** edit ***
!!CA1:M1/6/dy-5/dy-5; add new monsters to city *** edit ***
!!VRy-5:*100; x100 it
!!VRy-4:-y-5; sub y-5 from y-4
!!PO7:V2/y-4; set new value *** edit ***

!?FU28112; get monster number to v10 (x1 = town type, x2 = level)
!!VRv10:S-1;s
!!DO28113/0/173/1:Px1/x2;

!?FU28113; ...
!!MA:Lx16/?y-1;
!!MA:Ox16/?y-2;
!!VRv10&x1=y-2/x2=y-1:Sx16;

!?FU28115; check if x1 level dwelling (upgraded or not) is built
!!IF:V2/0; not built initially
!!VRy1:Sx1 +30;
!!CA1:B3/y1; check if unupg is built
!!IF&1:V2/1; set flag if yes
!!FU&1:E; exit if yes
!!VRy1:+7;
!!CA1:B3/y1; check if upg is built
!!IF&1:V2/1; set flag if yes
!!FU&1:E; exit if yes

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

Postby GreatEmerald » Nov 2 2009, 19:21

Ooh, awesomeness! This will be very useful!

User avatar
Salamandre
Genie
Genie
Posts: 1032
Joined: 13 May 2006
Location: France
Contact:

Postby Salamandre » Nov 3 2009, 7:46

Brilliant, but who is going to play with 2 scripts which invalidate the billion maps mechanics done until now? Moreover, by introducing mechanics from a game which failed horribly.

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

Postby GreatEmerald » Nov 3 2009, 11:18

Salamandre wrote:Brilliant, but who is going to play with 2 scripts which invalidate the billion maps mechanics done until now? Moreover, by introducing mechanics from a game which failed horribly.

Those who like playing random maps?
And HoMM4 is a great game IMO, so it's just your subjective opinion.

User avatar
Beholder
Scout
Scout
Posts: 150
Joined: 27 Feb 2006
Location: Poland, Kraków
Contact:

Postby Beholder » Nov 3 2009, 14:37

GreatEmerald wrote:And HoMM4 is a great game

it's just your subjective opinion ;)
Beholder

User avatar
Qurqirish Dragon
Genie
Genie
Posts: 1011
Joined: 06 Jan 2006
Location: Flying the skies of Ohlam

Postby Qurqirish Dragon » Nov 3 2009, 15:15

Nice script. I won't be using it, but that is because if I want H4-style growth, I'll play H4. I'm certain a lot of H4 fans would use this one.
Matthew Charlap -353 HoMM map reviews and counting...

LarvaExotech
Leprechaun
Leprechaun
Posts: 28
Joined: 01 Jan 2007

Postby LarvaExotech » Nov 3 2009, 18:58

I don't think that daily growth is bad idea, I think its the feature that I liked most in H4. Its a bit more realistic, because recruits are not coming every week but every day, and also it changes a game tactics a bit.

For example there are no "oooh its 7th day so I will built dragon cavern because i will have more dragons tommorow", while player who built the same cavern on day 2nd, would end with the exact amount of dragons as player1 do.

It also removes crappy "1st day red rush" thing, where red player can take a castle of blue player on day1 with fully population, while blue player wouldn't even have chance to recruit troops.

It creates more tactics because you must choice if you would build a city hall or vampire dwelling, because both grant you the same bonus. If you will build a city hall earlier then you would have more cash, if you would buy vampires earlier then you would have some vampires more. Without mine script choice would be obvious - buy a city hall because it doenst make a diffrence if you build mansion on day 4, 5, 6 or 7.

It also gives better defending possibilities for each player, because even if enemy come to your city on day4, you can still buy troops from half of week and try to defend your town.

User avatar
Salamandre
Genie
Genie
Posts: 1032
Joined: 13 May 2006
Location: France
Contact:

Postby Salamandre » Nov 3 2009, 19:10

Those scripts need months of testing as they change the mechanics a lot (the random events script too).

How will AI react if it can not do what for it was programmed? How would AI react if his best hero is strike by death finger, or illness? The human player will just reload until he gets a better roll.
Don't get me wrong, I see how this script is well done, but you just bring it from Heroes 4 and think that it will work in Heroes 3?
I am sure it will create a lot of problems as it is.

I would say such script can find its place in 3.59 but needs carefully balance. And don't bring the "crappy" red rush in discussion, it is one of the features of the game, if one loses to it, then does not know how to play. Same for hit and run, town sitting. They are part of the game and have an efficient counter.

I did not say HoMM4 was a bad game, I said it failed horribly. Nuance. It could not seduce the huge H3 community because it was a mechanics break, not a continuity. Same for H5. When moving from H2 to H3, 100% of the tournaments followed and 100% of the players moved on. From H3 to H4 were none. From H3 to H5 20% only. Statistics from ToH and russian tournaments. We are talking about experienced players there, not lurkers.
Last edited by Salamandre on Nov 3 2009, 19:19, edited 1 time in total.

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

Postby GreatEmerald » Nov 3 2009, 19:18

Salamandre wrote:How will AI react if it can not do what for it was programmed? How would AI react if his best hero is strike by death finger, or illness? The human player will just reload until he gets a better roll.

Well, why don't you try it and see? As for reloading, humans can already do that if they want with heroes in their tavern and other random events in the stock game as well.

User avatar
Salamandre
Genie
Genie
Posts: 1032
Joined: 13 May 2006
Location: France
Contact:

Postby Salamandre » Nov 3 2009, 19:21

Sorry man, I don't have to try to see how it will cripple AI, I know it will cripple it. The negative random effects have to be modified for AI, as it has no counter for them.

User avatar
Beholder
Scout
Scout
Posts: 150
Joined: 27 Feb 2006
Location: Poland, Kraków
Contact:

Postby Beholder » Nov 3 2009, 19:29

I think you`re discussing a separate thread here... Anyway the AI already is indeed crippled in WOG through many options... Be careful with that
Beholder

LarvaExotech
Leprechaun
Leprechaun
Posts: 28
Joined: 01 Jan 2007

Postby LarvaExotech » Nov 3 2009, 19:47

Salamandre wrote:I would say such script can find its place in 3.59 but needs carefully balance. And don't bring the "crappy" red rush in discussion, it is one of the features of the game, if one loses to it, then does not know how to play. Same for hit and run, town sitting. They are part of the game and have an efficient counter.


So if they are a part of game, why its forbidden in all leagues to make 1st day rush or hit&run? I think that instead of making way too strict rule-sets (like no 1st day rush rule), just modify game mechanics so it wont be possible anymore.

User avatar
Salamandre
Genie
Genie
Posts: 1032
Joined: 13 May 2006
Location: France
Contact:

Postby Salamandre » Nov 3 2009, 19:51

It is forbidden because of noobs and eternal crying majority. It is important to point out that the "rules" came out once tournaments had a important growth, and the veterans player were outnumbered by inexperienced ones. That also was the main reason veterans slowly quited HoMM mp. It was already proven that hit and run, dimension door, red rush and town sitting have an efficient counter if played well.

The question is: are we making scripts to help noobies to keep the level or seduce veteran by introducing harder and more interesting mechanics?

LarvaExotech
Leprechaun
Leprechaun
Posts: 28
Joined: 01 Jan 2007

Postby LarvaExotech » Nov 3 2009, 20:28

Salamandre wrote:The question is: are we making scripts to help noobies to keep the level or seduce veteran by introducing harder and more interesting mechanics?


I don't know why you do. I know that I'm making scripts because its fun for me, and I want to change something in that game, because even if its great game, it sometimes becomes a bit boring..

User avatar
Salamandre
Genie
Genie
Posts: 1032
Joined: 13 May 2006
Location: France
Contact:

Postby Salamandre » Nov 3 2009, 22:06

And it is highly appreciated. I found your battle script VERY useful and the music very well mixed and appropriate. I had only doubts about those 2 scripts but maybe it is because I am always asking myself before starting scripting if it will seduce players or they will remain indifferent to it.

So far I found very difficult to script something really useful, as the game is damn good as it is. However scripts which eliminate commands redundancy, fix bugs (as spawning monsters on key squares, negative experience bug) are always welcome.

Now, if you want to change the mechanics, my opinion is that it should be supported by a custom map/mod to introduce them softly. If you change the mechanics and players start them on ancient maps, you will have a hard time to make them accept.

I had in mind a script which could "restore" the might and magic parity but never could find the time to start on it (I am suddenly lazy when it is about scripting without a story behind)

The script should restore the importance of magic heroes, as today no one plays with them.

1) Magic heros can't learn logistic, armorer and offense
2) Might heros can't learn elemental magic, thus all spells will be on basic level
3) Expert level spells damage is multiplied


Results: a might hero can still get advantage of increased move and the damage reduction/offense but he will be unable to cast mass spells.
The magic will have a hard time to level up without logistic but will be able instead to cast mass spells and with increased damage. They will become the perfect hit/runners.

Of course needs testing and adjustments, but I think this kind of script will be adopted fast. Right now the magic heros are a big flaw in the game. The abilities should work as in M&M series (magic class can't learn body building etc)

Moreover it can be combined with different bonuses for each magic faction, as clerics and warlocks for example do not develop their magic power in the same way. A cleric could have a better heal (cure multiplied), a wizard small chances to learn a new spell on level up and so on.

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

Postby GreatEmerald » Nov 4 2009, 15:08

Who asks everyone to use it if they don't want to? And it can be easily disabled, too.
Good idea about the skill differentiation. Although I don't always use a might hero, but when using a magician, it would be a lot better to get a better chance of getting elemental magic skills (I keep getting two non-magic choices and they fill up my skill slots...).

User avatar
Salamandre
Genie
Genie
Posts: 1032
Joined: 13 May 2006
Location: France
Contact:

Postby Salamandre » Nov 4 2009, 16:44

Thats because you don't know the mechanics. For any hero, a magic skill will be offered 100% at level 4. If you ignore it and choose the other, you lose the chance.
http://heroescommunity.com/viewthread.php3?TID=17812

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

Postby GreatEmerald » Nov 4 2009, 18:52

Why do I get the feeling that knowing the mechanics is similar to cheating and makes it less interesting to play?..

User avatar
Salamandre
Genie
Genie
Posts: 1032
Joined: 13 May 2006
Location: France
Contact:

Postby Salamandre » Nov 4 2009, 19:10

Well, you was asking why you get the wrong skills, knowing the mechanics gives you the answer. One could ask:

"Why do I need to play like a champion?!"

Well, you don't need and you can enjoy as well the game playing just for fun at low level and no one is going to bash you for that. But the day when you decide to create a mod, a map or a campaign, then you realize that people playing it either find it too easy, either too hard. Some of them will find billions of shortcuts and will screw all your well planned scenario by using either cheap tactics of genial ones you weren't aware of.

So there are 2 cases when you need to know the mechanics:

1) You wanna be the biggest mother f... in MP and screw everyone and feel strong and complement the lack of girlfriend.
2) You have in mind to create some maps and need to balance them so they are not forgotten after a few days.

If none of those interest you, then there is no problem with your playing style.


Return to “Wake of Gods”

Who is online

Users browsing this forum: No registered users and 5 guests