Anti chaining script

Official forum of the Wake of Gods mod to Heroes of Might and Magic III.
Pollo2002
Peasant
Peasant
Posts: 96
Joined: 24 Jan 2006

Anti chaining script

Unread postby Pollo2002 » 17 May 2006, 01:15

I've been working on an anti chainning script lately and found a problem, i have no way to get the number of the hero, the hero traded with.
The idea is to remove the movement of both heroes once the traded finished or when it's start i sthe same but i have no way to identify the hero i traded with, the HE reciever doesn't have an option for that, any idea?.
Another problem is that the HE trigger , triggers when an allied hero trade or when an enemy hero attack but i want it to work ONLY when an allied hero trade :S

Edited: I figured out that i could do a HE trigger for EACH possible hero, still any better suggestion?
About the only activating when allied i could check if both heroes belong to the same side, if they do , continue, otherwise, exit

Pollo2002
Peasant
Peasant
Posts: 96
Joined: 24 Jan 2006

Unread postby Pollo2002 » 17 May 2006, 03:37

Here is the script i made and it works perfectly as i meant it to work the problem is that as you noted, it only works for VALESKA! :P
Since i can't get the trigger hero i can only set it i should make it for EVERY hero, any simpleer way to do it?
If nothing else work i will have to copy and change the parameter 130+ times and of course if i want to do a modification i better kill myself


ZVSE
!?HE1;
!!HE-1:O?y2; Determine side of trigger hero 1
!!HE1:O?y1; Determined side of affected hero 2
!!FU&y1<>y2:E; IF both heroes belong to the same side continue ,

otherwise exit
!!HE1:G?y3 W?y4; Get-hero affected Total movement(y3) and remaining

movement (y4)
!!HE-1:G?y5 W?y6; Get-hero Trigger Total movement(y5) and remaining

movement (y6)
!!VRy7:Sy3 -y4; Determine Hero affected used movement
!!VRy8:Sy5 -y6; Determine hero trigger used movement
!!VRy9:Sy7 *100 :y3; Determine hero affected pr of used movement
!!VRy10:Sy8 *100 :y5; Determine hero triggered pr of used movement
!!VRy12:Sy4 *y10 :100; Translate hero triggered pr of used movement to

hero affected movement
!!VRy14:Sy4 -y12; Variable y14 becomes new affected hero movement
!!VRy13:Sy5 *y9 :100; Translate hero affected pr of used movement to

hero affected used movement
!!VRy15:Sy6 -y13; Variable y15 becomes new triggered hero movement
!!HE1&y10>y9:Wy14;
!!HE-1&y9>y10:Wy15;

User avatar
Fnord
Round Table Knight
Round Table Knight
Posts: 341
Joined: 27 Nov 2005
Location: Victoria, BC, Canada

Re: Anti chaining script

Unread postby Fnord » 17 May 2006, 03:59

There's a command in the CM receiver that lets you check both hero numbers in the hero trading screen (the CM:H command).

The only problem is that this won't activate until a player clicks--which isn't a huge problem since no trading will occur until that happens anyway. However, it means that it wouldn't work for the AI (since the AI never "clicks").
- Fnord

Pollo2002
Peasant
Peasant
Posts: 96
Joined: 24 Jan 2006

Unread postby Pollo2002 » 17 May 2006, 05:07

No problem about the ai stuff i don't care about ai and even i will let the ai do free chain maybe can help to improve it's patetic skill.
thanks i will try what you say :)

User avatar
Fnord
Round Table Knight
Round Table Knight
Posts: 341
Joined: 27 Nov 2005
Location: Victoria, BC, Canada

Unread postby Fnord » 17 May 2006, 05:30

Pollo2002 wrote:No problem about the ai stuff i don't care about ai and even i will let the ai do free chain maybe can help to improve it's patetic skill.
thanks i will try what you say :)
Okay, that's cool then. And in case I wasn't clear, you'll need to use the mouse-click CM trigger as well (the one for the hero meeting screen is !?CM3). Then in that trigger section you can use the CM:H command to get the hero number and execute the rest of your code from there too.
- Fnord

Pollo2002
Peasant
Peasant
Posts: 96
Joined: 24 Jan 2006

Unread postby Pollo2002 » 17 May 2006, 06:16

Down you can see the script, it seems to work perfect, except for one ting it only work once , after that it doesn't work anymore.
as you see i did two different triggers, the first for when the flag 910 is off (default) and then other for when you click on the benchmark and go out. The second function should put the flag off again, it seems that it doesn't do it. and such on futures trades the first function doesn't trigger (Because flag 910 still set) any idea what i'm doing wrong. I did the flag thing because otherwise of course the function run everytime i did a click and i wanted to work only once per trade

ZVSE
!?CM3&-910;
!!CM:H?y16/?y17;
!!HEy17:G?y3 W?y4; Get-hero affected Total movement(y3) and remaining movement (y4)
!!HEy16:G?y5 W?y6; Get-hero Trigger Total movement(y5) and remaining movement (y6)
!!VRy7:Sy3 -y4; Determine Hero affected used movement
!!VRy8:Sy5 -y6; Determine hero trigger used movement
!!VRy9:Sy7 *100 :y3; Determine hero affected pr of used movement
!!VRy10:Sy8 *100 :y5; Determine hero triggered pr of used movement
!!VRy12:Sy4 *y10 :100; Translate hero triggered pr of used movement to hero affected movement
!!VRy14:Sy4 -y12; Variable y14 becomes new affected hero movement
!!VRy13:Sy5 *y9 :100; Translate hero affected pr of used movement to hero affected used movement
!!VRy15:Sy6 -y13; Variable y15 becomes new triggered hero movement
!!HEy17&y10>y9:Wy14;
!!HEy16&y9>y10:Wy15;
!!IF:V910/1;

!?CM3&910;
!!CM:I?y1;
!!IF&y1=30720:V910/0;

Pollo2002
Peasant
Peasant
Posts: 96
Joined: 24 Jan 2006

Unread postby Pollo2002 » 17 May 2006, 06:21

Since we are on the thing, i didn't exactly got in the help what % does in the VR recivers. As yo can see i need to get some porcentages and used several VR recieveres to get the numbers i wanted, maybe there was a simplier method using the % character? :S
EDIT: a few minutes later i understood it

Pollo2002
Peasant
Peasant
Posts: 96
Joined: 24 Jan 2006

Unread postby Pollo2002 » 17 May 2006, 07:11

after trying i found out that i can set the flag off again if i RIGHT click on the benchmark.
Wich makes everthing more complicated, i want it to be off when i just click it to go out.
Maybe i will have to copy the script just 130+ times? :S
Can i use somehow the DO recierve instead of do that or it has no sense?

User avatar
Fnord
Round Table Knight
Round Table Knight
Posts: 341
Joined: 27 Nov 2005
Location: Victoria, BC, Canada

Unread postby Fnord » 17 May 2006, 07:32

I'm sure there is a way to do it. I have a feeling another value must be returned when you left-click on the checkmark. I'll look into it and post what I find shortly.

EDIT: Okay, I was wrong. This is really weird but it seems that left-clicking the checkmark (to exit the hero meeting screen) doesn't trigger any of the triggers. It works fine in the single hero screen as far as I recall.

So..you'll have to use another trigger to reset the flag. I suggest using two adventure map triggers, CM0 for the right-clicks and CM5 for left-clicks. That should do the trick, right?

e.g.,

Code: Select all

!?CM0;
!!IF:V910/0;

!?CM5;
!!IF:V910/0;
- Fnord

Pollo2002
Peasant
Peasant
Posts: 96
Joined: 24 Jan 2006

Unread postby Pollo2002 » 17 May 2006, 09:56

excellent i feel stupid how didn't think of it, after all if you don't click on the adventure map you can't do a new trading :S

so here is the script i'm using, and for now it works just fine, the only difference with my past method is that now your first click on the trading screen make the screen do some strange stuff for a fraction of second with is a little annoying, but i can live with that, better than copy the script for each hero
Thanks :)
i left the script writen here for if any other person wanna try to play without chaining.

ZVSE
!?CM3&-910;
!!CM:H?y16/?y17;
!!HEy17:G?y3 W?y4; Get-hero affected Total movement(y3) and remaining movement (y4)
!!HEy16:G?y5 W?y6; Get-hero Trigger Total movement(y5) and remaining movement (y6)
!!VRy7:Sy3 -y4; Determine Hero affected used movement
!!VRy8:Sy5 -y6; Determine hero trigger used movement
!!VRy9:Sy7 *100 :y3; Determine hero affected pr of used movement
!!VRy10:Sy8 *100 :y5; Determine hero triggered pr of used movement
!!VRy12Sy4 *y10 :100 ; Translate hero triggered pr of used movement to hero affected movement
!!VRy14:Sy4 -y12; Variable y14 becomes new affected hero movement
!!VRy13:Sy5 *y9 :100; Translate hero affected pr of used movement to hero affected used movement
!!VRy15:Sy6 -y13; Variable y15 becomes new triggered hero movement
!!HEy17&y10>y9:Wy14;
!!HEy16&y9>y10:Wy15;
!!IF:V910/1;

!?CM5&910;
!!IF:V910/0;

User avatar
Fnord
Round Table Knight
Round Table Knight
Posts: 341
Joined: 27 Nov 2005
Location: Victoria, BC, Canada

Unread postby Fnord » 17 May 2006, 17:17

Pollo2002 wrote:excellent i feel stupid how didn't think of it, after all if you don't click on the adventure map you can't do a new trading :S
It takes awhile to get used to all the possibilities of ERM (and even then, it's easy to forget something that later seems obvious).
Pollo2002 wrote: so here is the script i'm using, and for now it works just fine, the only difference with my past method is that now your first click on the trading screen make the screen do some strange stuff for a fraction of second with is a little annoying, but i can live with that, better than copy the script for each hero
Thanks :)
The strange stuff is probably the automatic screen redraw of the adventure screen hero information window (the one in the lower-right corner) caused by the HE:W command.

Try using the "no redraw" syntax instead which just requires that you add /1 after each HE:W command.

For example:

Code: Select all

!!HEy17:G?y3 W?y4/1; Get-hero affected Total movement(y3) and remaining movement (y4) 
If you put that in for all four of them, I think it will solve the problem (unless HE:G also causes a problem..but hopefully it doesn't since there's no "no redraw" for it that I know of).
- Fnord

Pollo2002
Peasant
Peasant
Posts: 96
Joined: 24 Jan 2006

Unread postby Pollo2002 » 17 May 2006, 21:13

Yes! now it works excellent! thanks a lot!

User avatar
Fnord
Round Table Knight
Round Table Knight
Posts: 341
Joined: 27 Nov 2005
Location: Victoria, BC, Canada

Unread postby Fnord » 18 May 2006, 00:18

Pollo2002 wrote:Yes! now it works excellent! thanks a lot!
Great! And you're very welcome. :)

Just a note: it might be wise to warn players that this script will also mean that transferring of artifacts or learning spells from another hero with the Scholar skill will also reduce movement, and that revisiting the hero multiple times in a turn (i.e., re-entering the hero trading screen) will continue to reduce movement each time (if I understand it correctly).

If you want to avoid this, you could ignore any click that's not on a creature slot of one of the heroes. Or if you're fine with transferring of artifacts reducing movement (because chaining artifacts is also disliked by some players), you could check for a creature slot click or an artifact position click and ignore any other.
- Fnord

Pollo2002
Peasant
Peasant
Posts: 96
Joined: 24 Jan 2006

Unread postby Pollo2002 » 18 May 2006, 21:40

K yes , can be
My script was intended to work every time heroes trade, i did want to penalize trade by itself.
What my script does is try to reduce to the hero with movement an amount of movement in % equal to the amount of % movement the hero with less movement spended this turn.


Return to “Wake of Gods”

Who is online

Users browsing this forum: No registered users and 3 guests