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: ask for help on ERM idea
Thread: ask for help on ERM idea
songfx
songfx


Adventuring Hero
posted November 26, 2010 01:08 PM

ask for help on ERM idea

I am making a small WOG map,


player: red
computer: other seven colors

Now I need a script like below,

at end of every day,
one random hero of each color will appeared at (1,1,0) and attack the red town at (5,5,0) one by one.
the troops of each hero is random from its race, but the total HP of the troops is no more than 300*days. For example, on 10th day, the blue hero Ivor ( who is not exist on the map before this event) appeared at (1,1,0). The total HP of his troops is no more than 3000, so he may lead such troops from Rampart, 6 War Unicorn + 3 Dendriod Guard + 78 Grand Elf + 46 Centaur + 42 Wood Elf£¬ 6*110+
3*55+78*15+46*8+42*15£½2993.

I am not sure whether above information is enough for script.
Many thanks in advanced.


____________
Chinese WOG Forum

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


Admirable
Omnipresent Hero
Wog refugee
posted November 27, 2010 07:59 PM
Edited by Salamandre at 20:08, 27 Nov 2010.

The script can be done, however you will have many problems making it work properly. First, the IA will not attack a well defended town unless it is scripted to "go to". And this command is the buggiest I ever saw. You will end with IA heros overlapping each other, not moving, freezing turn and blocking the way.

In 300 spartans I triggered 55 heros to "go to", one every two days and had A LOT of problems to make it work.  I had to place the target at more than 2 days march to avoid overlapping and block. 7 heros "go to" every day and in same area seems to me impossible...

Then you have to make a precise list of creatures type used for each faction. 1 gold dragon is <> HP as 3 unicorns, but much more effective when attacking a castle, so some creatures may be banned.

Only Jim Vogan maybe could find some "work around" way for this, I guess.
____________
Era II mods and utilities

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


Admirable
Legendary Hero
ghost of the past
posted November 27, 2010 08:12 PM
Edited by Vlaad at 20:12, 27 Nov 2010.

Would the AI attack if it has no towns left?

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


Admirable
Omnipresent Hero
Wog refugee
posted November 27, 2010 08:20 PM

If for example, Blue has no more towns or heros on the map and you bring him with ERM, he will not move. A dead faction is dead for ever, tested.


____________
Era II mods and utilities

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


Admirable
Legendary Hero
ghost of the past
posted November 27, 2010 08:56 PM
Edited by Vlaad at 20:58, 27 Nov 2010.

Can town owner be changed? Let Blue start with a town, set his new hero and the troops, take away the town?

I remember I managed once with a very simple script to move several AI heroes where I wanted, but you're right - if something goes wrong, it can be a mess.

I understand losing the besieged town in this scenario would mean instant loss for the human player? If so, that could solve some problems...
____________

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


Admirable
Omnipresent Hero
Wog refugee
posted November 27, 2010 09:03 PM
Edited by Salamandre at 21:25, 27 Nov 2010.

You can give a starting town then remove it later, but then you need to script "can live without". Otherwise it is a dead faction and he will not move when pop in. But if you script "can live without" then he will not attack naturally the town because he does not need it, so you have to tell him "go to". While you can script several heroes in different positions to do what you want, bringing 7 of them each day on the same square can snow your game crazily. I tried this and got armies mixed, visual glitches and freezes.

Here is what I did:

Script x player to live without town.*
On day n disable the script and make the hero move towards the town, he will attack.
After he attacks, enable again the script "live without".
Next hero, disable the script, check if previous hero is alive, kill him if yes, and so on.

It is called "work around" by clumsy tactics.

Another option, much safer would be the following, used in Alexander (sorry for same over and over references to great maps)

1) Create a small area for each faction and put a town.
2) Bring the same hero each two days with same army + bonuses in front of town (AI will not necessarily recruit, so needs ERM)
3) Place a teleporter one way entrance leading to the desired target
4) Create an event in front of the teleporter, giving the creatures and primary skills you wish, enable it again after visit. Use a variable to check day and add the HP bonuses at each visit.
5) Set AI to move on the teleporter
6) Place the exit behind a border gate, so the human can't block it (AI will not take a teleporter if a strong army on the other side)

This will create an AI stronger at each passage and it works safer than using the same square to place everyone.
____________
Era II mods and utilities

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


Adventuring Hero
posted November 28, 2010 12:43 AM

Many thanks for your replies.
It seem very hard to make it work.
I am thinking another way to get similar effect.

1)At the end of each day. 7 battle will be triggered, Just like the battle caused by "Targ Of The Rampaging Ogre" every Monday in "Artifact Boost" mode. But the attacker troops are led by AI heroes.

2)For the random troops numbers, maybe we can do it like this,
get 7 random creatures from its race. The number of first troops is total HP(3000) / 7 / creature HP(110 for war unicorn), the second troops is balanced HP / 6 /creature HP, and so on.

3)Another thing, if AI heros don't want to attack, is it possible to give him troops which is too much strong, making the AI believe he can capture the town very easy. However, when the battle triggered, we replace his troops with script.

Pls check whether it is workable.
Sorry for my poor English.

Thanks.
____________
Chinese WOG Forum

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


Admirable
Omnipresent Hero
Wog refugee
posted November 28, 2010 03:49 AM

Interesting script. As player, I would certainly dislike to have 7 consecutive battles as town defender each day because if a single wrong move or loss I have to close the game and reload the autosave with all 7 battles again. I will think about.
____________
Era II mods and utilities

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


Adventuring Hero
posted November 28, 2010 04:32 AM
Edited by songfx at 04:34, 28 Nov 2010.

Quote:
Interesting script. As player, I would certainly dislike to have 7 consecutive battles as town defender each day because if a single wrong move or loss I have to close the game and reload the autosave with all 7 battles again. I will think about.

My map will be very small, and game will last no more than 30 days.
As I know there is a way to forbid save/load. So player don't have chance to repeat a single battle. If player lose the town, the game will not end directly. He will get his score in this game, then game over.
This map will be much similar to some RPG maps of Tower Defend in Warcraft and Starcraft.
____________
Chinese WOG Forum

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


Responsible
Supreme Hero
posted November 28, 2010 07:55 PM

The script below will need some editing.  I used an old test map with a castle at 14/8/0, so where you see 14/8/0 or v998=14 ... these must be edited to the actual location.  I used Crag Hack (102) as the attacking hero (Blue) and Inteus (140) as the defender (Red).  I add logs around CH so he can't wander off instead of attacking, and remove them at the end of the battle.  The UN:I and UN:O commands will have to be edited for different log coordinates also.  I have tested over a dozen times and CH has always attacked, but there is no guarantee, as Salamandre says.

I assumed you wanted seven stacks of attackers.  The more stacks, the closer the randomly-selected HP total will typically be to the day's HP limit.  The number of stacks could be varied, but it is hard-coded.  The attacks start at day 2 (Timer 4).

It would be better to send you the test map.  Salamadre has my email address.  If you email me I will reply with the test map attached.

ZVSE

** Songfx Random Armies script, JHV, Nov. 28, 2010

!#UN:P5/0; [Map isn't wogified]
!#UN:P6/1; [Heroes don't start with Commanders]
!#UN:P3/1; [disable Commanders]
!#UN:P900/0; [Stack Experience is disabled]
!#UN:J4/32768; 8x standard WoG AI Thinking Radius

!#TM4:S2/10/1/2; Blue day 2-10  (Blue is Warrior type)

** variables:
* v6000 = 14*creature type, 0=Castle, 1=Rampart, ... (Conflux not included)
* v6001 = current HP limit = 300*c
* v6002 = total HP of selected cr's
* v6003 = number of different cr #'s chosen (max=7)
* V6004 = number of different cr #'s still in cr-list minus 1
* v6010-v6023 = list of cr#'s to choose from
* v6030-v6043 - number of creatures chosen, v6030=# of v6010's, etc.
* v6050-v6056 - save Inteus's troop slot MA #'s
* v6060-v6066 - save Inteus's troop slot stack counts

* Functions:  FU302-FU308

* Flags:  3-4 temporary

* Timer: TM4

!?TM4;
* save Inteus's troops
!!HE140:C0/0/?v6050/?v6060 C0/1/?v6051/?v6061 C0/2/?v6052/?v6062;
!!HE140:C0/3/?v6053/?v6063 C0/4/?v6054/?v6064 C0/5/?v6055/?v6065 C0/6/?v6056/?v6066;
!!HE140:K; remove Inteus from map
!!CA14/8/0:H0/140; put Inteus in garrison
* remove Inteus's troops except for one peasant to tempt CH
!!HE140:C0/0/139/1 C0/1/-1/0 C0/2/-1/0 C0/3/-1/0 C0/4/-1/0 C0/5/-1/0 C0/6/-1/0; remove Inteus's troops
!!HE140:O0; restore Inteus to Red
!!HE102:P14/9/0; put Crag Hack in front of castle
!!HE102:O1; restore CH to Blue
** give HE102 Ballista, Ammo Cart, Tent
!!HE102:A4/4 A4/5 A4/6;
!!AI:S102/-1/1/14/8/0/5000000/3; tell CH to attack castle
* put logs around CH
!!UN:I13/9/0/130/0; place log object on map
!!UN:I13/10/0/130/0;
!!UN:I14/10/0/130/0;
!!UN:I15/10/0/130/0;
!!UN:I15/9/0/130/0;

** random creature selection
!!VRv6000:S0 T7 *14; chose random creature type, 0-7 (Conflux not included), times 14
!!DO303/0/13/1:P; set cr#'s in v6010-v6023
!!FU307:P; sort list by HP (Monk < Swordsman)
!!VRv6001:Sc0*300;
!!VRv6002:C0/0/13;
!!VRv6030:C0/0/0/0/0/0/0/0/0/0/0/0/0/0;
!!IF:V4/1; initialize collapse flag
!!FU304:P; select cr's
!!VRv6004:S-1; initialize stack count for FU305
!!DO305/0/13/1:P; collapse lists
** at this point slots 0-v6004 are set
** with cr MA #'s in v6010 list and stack counts in v6030 list
!!IF:M^HP limit = %V6001, Total HP selected = %V6002^;
!!DO306/0/6/1:P102; fill CH's troop slots

!?FU303; x16=cr rank in type v6000:14
!!VRy1:Sx16+6010; index to cr-list in v6010-v6023
!!VRvy1:Sv6000+x16;

!?FU304; select creatures randomly
!!VRy1:S0 Rv6004; random creature index from cr-list
!!VRy2:Sy1+6010; index to cr-#
!!MA:Pvy2/?y3; get HP
!!VRy4:Sv6002+y3;
*!IF:M^FU304: y1=%Y1, HP(y1)=%Y3, v6002=%V6002, y4=%Y4, stack count = %V6003, v6004=%V6004^;
!!IF:V3/1; OK
!!IF&y4>v6001:V3/0; N.G.
!!VRv6004&-3:Sy1-1; remove cr's from list (HP too large)
* if cr ok, add to its troop stack
!!VRv6002&3:Sy4; new HP total
!!VRy5&3:Sy1+6030; index to troop stack
!!VRvy5&3:+1;
!!VRv6003&vy5=1/3:+1; add to stack count
!!VRv6004&v6003=7/4/3:S-1; initialize for FU305
!!DO305/0/13/1&v6003=7/4/3:P; collapse lists (once only)
!!FU304&v6004>-1:P; select another cr

!?FU305; collapse v6010 & v6030 lists down to 7 cr's or less
!!IF:V4/0;
!!VRy10:Sx16+6030; index to cr stack count
!!FU&vy10=0:E;
!!VRv6004:+1;
!!VRy11:Sv6004+6030;
!!VRvy11:Svy10;
!!VRy10:-20;
!!VRy11:-20;
!!VRvy11:Svy10;

!?FU306; x16=troop slot, x1=HE#
!!VRy20:Sx16+6010; index to MA#
!!VRy21:Sy20+20; index to count
!!HEx1:C0/x16/-1/0; empty slot
!!HEx1&x16<=v6004:C0/x16/vy20/vy21;

!?FU307; sort cr lists by HP
!!IF:V3/0; unfinished flag
!!DO308/0/12/1:P;
!!FU307&3:P;

!?FU308; bubble sort, x16=index to v6010
!!VRy1:Sx16+6010; index to cr-#
!!MA:Pvy1/?y3; get HP
!!VRy2:Sx16+6011; index to next cr-#
!!MA:Pvy2/?y4; get HP
!!FU&y4>=y3:E;
* switch
!!IF:V3/1;
!!VRy5:Svy1;
!!VRvy1:Svy2;
!!VRvy2:Sy5;


** Battle 1
!?BA0&1000/v998=14/v999=8/v1000=0;
!!BA:M1/0/?y-40/?y-41; [Check defending monster type: y-40 and number: y-41]
!!FU|y-40<>139/y-41<>1:E; [Exit if not 1 peasant]
!!BA:M1/0/v6050/v6060 M1/1/v6051/v6061 M1/2/v6052/v6062 M1/3/v6053/v6063;
!!BA:M1/4/v6054/v6064 M1/5/v6055/v6065 M1/6/v6056/v6066;
!!VRv1:S0 T20;
!!DO302/0/v1/1:P;

!?BA1&1000/v998=14/v999=8/v1000=0;
* remove logs
!!UN:O13/9/0;
!!UN:O13/10/0;
!!UN:O14/10/0;
!!UN:O15/10/0;
!!UN:O15/9/0;

!?FU302; battle randomizer
!!VRy1:R100;
!!VRy2&y1>50:R100;

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


Admirable
Omnipresent Hero
Wog refugee
posted November 28, 2010 08:47 PM
Edited by Salamandre at 20:49, 28 Nov 2010.

JimV, I think something is wrong with my provider, I sent a couple of mails but never got an answer. Maybe you were simply busy, just inform you that I got a single mail about Kazin, that's all for the week. Tell me if I should contact free.fr and ask them for a fix.
____________
Era II mods and utilities

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


Adventuring Hero
posted November 30, 2010 02:29 PM

Many thanks to Jimv.
I will try with the scripts. And revert to you later.
____________
Chinese WOG Forum

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


Responsible
Supreme Hero
posted November 30, 2010 03:51 PM

Good luck.  I should also say that in my test map there was a Blue town (impossible to reach) and Inteus and Crag Hack were both on the map at the start, although that might not be necessary in CH's case.  Also I gave Inteus a good starting army, and the Shackles of War so the enemies can't run away.  I am only doing one enemy attack (Blue) for the demonstration, so you will have to add more enemies, and of course you can change the hero numbers (140 and 102) to anything you like.  Let me know if you need help adapting the script.  I like to start small and gradually add more features to a script after the basic parts are working okay.

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


Adventuring Hero
posted December 01, 2010 01:11 AM

Thanks to both of you. I have received the test map from Salamandre.
I think this script will be OK for my map. Of course my partners and I will make some changes to it to adapt my map.
This map will be small but interesting, we still have much work to do with it. And we will consult you again when we meet difficulty. Many thanks.
____________
Chinese WOG Forum

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


Adventuring Hero
posted December 15, 2010 03:28 PM

I know too little about ERM.
Can you help me to complete my map ?
I have sent an Email to rogacev@free.fr
Pls check if you can help me.
Thanks.
____________
Chinese WOG Forum

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread »
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0517 seconds