Trouble with punic event

Discuss and post your mods and scenarios here for others to download.

Moderator: Vic

Post Reply
Grymme
Posts: 1776
Joined: Sun Dec 16, 2007 5:06 pm
Contact:

Trouble with punic event

Post by Grymme »

Hi

I am having trouble with a couple of events. They are supposed to check for land attrition and sea storms.

My opponent got the following
Error in exec command in event #6 on line nr 17. Then more messages appeared listing errors in event 25 in line 12, 13, 14, 27, 28, 29, and 30. Could not close the trun and had to quit using task manager.

EVENT 6 - Sea storms


0) CHECK: CheckRandomPercent < 36
1) EXECUTE: ExecMessage(0, 1, 0, 1)
2) SETVAR: TempVar1 = CheckMapWidth
3) SETVAR: TempVar2 = CheckMapHeight
4) SETVAR: TempVar5 = CheckRandomPercent
5) SETVAR: TempVar5 - 10
6) SETVAR: TempVar6 = CheckRandomPercent
7) SETVAR: TempVar5 - 25
8) LOOPER: TempVar3 FROM 0 TO TempVar1
9) LOOPER: TempVar4 FROM 0 TO TempVar2
10) CHECK: CheckRandomPercent < 31
11) CHECK: CheckLandscapeType(TempVar3, TempVar4) == 1
12) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 4, TempVar5)
13) END CHECK
14) END CHECK
15) CHECK: CheckRandomPercent < 21
16) CHECK: CheckLandscapeType(TempVar3, TempVar4) == 28
17) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 4, TempVar6)
18) END CHECK
19) END CHECK
20) END LOOPER
21) END LOOPER
22) EXECUTE: ExecReadinessLossByArea(2, 1, TempVar5, 100)
23) EXECUTE: ExecReadinessLossByArea(2, 2, TempVar6, 100)
24) END CHECK


EVENT 25 - Attrition


0) CHECK: Gameslot_Mountain & desert attrition(#3) == 1
1) SETVAR: TempVar1 = CheckMapWidth
2) SETVAR: TempVar2 = CheckMapHeight
3) SETVAR: TempVar5 = CheckRandomPercent
4) SETVAR: TempVar5 - 60
5) SETVAR: TempVar6 = CheckRandomPercent
6) SETVAR: TempVar5 - 70
7) LOOPER: TempVar3 FROM 0 TO TempVar1
8) LOOPER: TempVar4 FROM 0 TO TempVar2
9) CHECK: CheckRandomPercent < 31
10) CHECK: CheckLandscapeType(TempVar3, TempVar4) == 6
11) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 0, TempVar5)
12) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 2, TempVar5)
13) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 3, TempVar5)
14) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 8, TempVar5)
15) END CHECK
16) END CHECK
17) CHECK: CheckRandomPercent < 21
18) CHECK: CheckLandscapeType(TempVar3, TempVar4) == 5
19) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 0, TempVar6)
20) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 2, TempVar6)
21) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 3, TempVar6)
22) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 8, TempVar6)
23) END CHECK
24) END CHECK
25) CHECK: CheckRandomPercent < 31
26) CHECK: CheckLandscapeType(TempVar3, TempVar4) == 27
27) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 0, TempVar5)
28) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 2, TempVar5)
29) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 3, TempVar5)
30) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 8, TempVar6)
31) END CHECK
32) END CHECK
33) END LOOPER
34) END LOOPER
35) END CHECK


I think that the errors only comes when the attrition becomes negative because of the deductíon on lines 5 & 7 (event 6) 4 & 6 event 25). I dont want attrition being able to be 100% so i want some reduction of attrition to a certain %. Anyone who knows whats wrong and/or suggest sollutions?
My Advanced Tactics Mod page
http://atgscenarios.wordpress.com

30+ scenarios, maps and mods for AT and AT:G
Lunaticus_matrixforum
Posts: 834
Joined: Wed Dec 31, 2008 3:50 pm
Location: Germany

RE: Trouble with punic event

Post by Lunaticus_matrixforum »

Hi Grymme,
some comments:
The error in event 6 is probably straightforward: You are taking away ships that possibly can have loaded troops as passengers. If you remove too many or all ships the system does not know what to do with the passengers and crashes....
The second one I do not know, maybe some follow-up?
BTW: Are you actually certain you want to set tempvar5 in line 7 (event 6) and line 6 (event 25)? Doing an execremovetroops with a negative number should actually have no effect afaik but it still might make sense to check if tempvar5 < 0 and then set it to 0...
User avatar
Jeffrey H.
Posts: 3154
Joined: Fri Apr 13, 2007 6:39 pm
Location: San Diego, Ca.

RE: Trouble with punic event

Post by Jeffrey H. »

I don't have any direct experience with the editor. But I don't understand what you are trying to lines 4-7 of event 6, particularly with line 7. In my old basic/fortran way of looking at things, if you want to reset the variable value, you could do it like this:
&nbsp;
4) SETVAR: TempVar5 = CheckRandomPercent
5) SETVAR: Tempvar5 = TempVar5 - 10
6) SETVAR: TempVar6 = CheckRandomPercent
7) SETVAR: TempVar6 = TempVar5 - 25

This way you get to reset the values of the two tempvars by offsets of CheckRandomPercent.
&nbsp;
History began July 4th, 1776. Anything before that was a mistake.

Ron Swanson
User avatar
Jeffrey H.
Posts: 3154
Joined: Fri Apr 13, 2007 6:39 pm
Location: San Diego, Ca.

RE: Trouble with punic event

Post by Jeffrey H. »

Also, I could not find ExecRemoveTroops&nbsp;in the manual. Is is possible to use CheckMapWidth() directly in the looper statement, without first loading a value in a tempvar ?
History began July 4th, 1776. Anything before that was a mistake.

Ron Swanson
Grymme
Posts: 1776
Joined: Sun Dec 16, 2007 5:06 pm
Contact:

RE: Trouble with punic event

Post by Grymme »

Lunaticus, Jeffrey etc

Yeah. I think i can solve the tempvar issues.

Something like

Tempvar 4= Checkrandompercent
Check if Tempvar4 is bigger than x then set Tempvar 4 to 0.¨

But the issue with the ships remain. Are you sure this will crash the game? Is there a workaround. Maybe Vic can weigh in on this. Because it would really be a pity if the storm attrition didnt work. In the real war the romans lost several fleets because of storms and it really influenced the events of the war.
My Advanced Tactics Mod page
http://atgscenarios.wordpress.com

30+ scenarios, maps and mods for AT and AT:G
Lunaticus_matrixforum
Posts: 834
Joined: Wed Dec 31, 2008 3:50 pm
Location: Germany

RE: Trouble with punic event

Post by Lunaticus_matrixforum »

Well one solution might be on the engine side to have ships automatically drop excess passengers if transports are sunk by the exec.

Otherwise maybe you can do some testing if this only comes up if all ships are sunk or if some are sunk. If it comes up if all transports are sunk than you can try if eliminating all troops carried can be killed by execremovetroops first. But would be wary because accessing carried troops is not normally straightforward. If the issue comes up if the transported troops are heavier then what the transport can carry then this becomes difficult but you might like to try removing troops here, too...
&nbsp;
I assume the engine has some function which is used if in combat a transport fleet is hurt and some excess troops have to be removed. Would probably be easiest to access that one....
Grymme
Posts: 1776
Joined: Sun Dec 16, 2007 5:06 pm
Contact:

RE: Trouble with punic event

Post by Grymme »

Thanks lunaticus.

It would actually be nice to have Vics view on this. Can the engine handle it in some way?
My Advanced Tactics Mod page
http://atgscenarios.wordpress.com

30+ scenarios, maps and mods for AT and AT:G
User avatar
Jeffrey H.
Posts: 3154
Joined: Fri Apr 13, 2007 6:39 pm
Location: San Diego, Ca.

RE: Trouble with punic event

Post by Jeffrey H. »

ORIGINAL: Grymme

Lunaticus, Jeffrey etc

Yeah. I think i can solve the tempvar issues.

Something like

Tempvar 4= Checkrandompercent
Check if Tempvar4 is bigger than x then set Tempvar 4 to 0.¨

But the issue with the ships remain. Are you sure this will crash the game? Is there a workaround. Maybe Vic can weigh in on this. Because it would really be a pity if the storm attrition didnt work. In the real war the romans lost several fleets because of storms and it really influenced the events of the war.

What I meant was, is it possible to do this in the editor ?

8) LOOPER: TempVar3 FROM 0 TO CheckMapWidth()

I have the feeling the answer is no, the looper statement prolly must have a tempvar and not a function itself.


History began July 4th, 1776. Anything before that was a mistake.

Ron Swanson
User avatar
Jeffrey H.
Posts: 3154
Joined: Fri Apr 13, 2007 6:39 pm
Location: San Diego, Ca.

RE: Trouble with punic event

Post by Jeffrey H. »

ORIGINAL: Lunaticus

I assume the engine has some function which is used if in combat a transport fleet is hurt and some excess troops have to be removed. Would probably be easiest to access that one....

This is what I was thinking, it must do something during combat. How to access that something with an event is not so clear.


History began July 4th, 1776. Anything before that was a mistake.

Ron Swanson
User avatar
Vic
Posts: 9931
Joined: Mon May 17, 2004 2:17 pm
Contact:

RE: Trouble with punic event

Post by Vic »

The events where not designed to deal with passengers. So that wont work.

I think the best way to work around this is too add an extra regime that is at war with everybody and call it "Weather" or "Nature".

Then make a special SFType called Storm and fill a predef unit with Storm units and then drop a Storm unit or more (depending on fleet power points in hex) on a sea hex with navy in it.

Make sure to set the Storm SFtypes to self destruct so they dont remain on the map.

This is the best course of action i can come up with.

Will take a long the passenger and events issue for the next release. thanks for spotting it Grymme!

Kind regards,
Vic
Visit www.vrdesigns.net for the latest news, polls, screenshots and blogs on Shadow Empire, Decisive Campaigns and Advanced Tactics
Grymme
Posts: 1776
Joined: Sun Dec 16, 2007 5:06 pm
Contact:

RE: Trouble with punic event

Post by Grymme »

Thanks for the help Vic.

Innovative thoughts regarding the storm. 2 issues with it. I would like a check to see if there are any units in the hex, and the number of "storm" that attack would somehow have to be calculated on how many SFTs were in the hex. But otherwise i can see some positive things with doing it this way. First of all the ships come up on the casualty list and second the readiness loss, and retreat function suddenly meld in well with the sea storm theme.

Will get to work in it now.

Meanwhile here is my second atempt at a land attrition event. The changes are highlighted. The way i am trying to build the event there will be a maximum attrition of 30% (low mountains) and 40 % (high mountains). this is simulated by the fact that if the attrition tempvars become higher than that the attrition is set to 0.

Thoughts anyone?

0) CHECK: Gameslot_Mountain & desert attrition(#3) == 1
1) SETVAR: TempVar1 = CheckMapWidth
2) SETVAR: TempVar2 = CheckMapHeight
3) SETVAR: TempVar7 = 40
4) SETVAR: TempVar8 = 30

5) SETVAR: TempVar5 = CheckRandomPercent
6) CHECK: TempVar5 > TempVar7
7) SETVAR: TempVar5 = 0
8) END CHECK
9) SETVAR: TempVar6 = CheckRandomPercent
10) CHECK: TempVar6 > TempVar8
11) SETVAR: TempVar6 = 0
12) END CHECK

13) LOOPER: TempVar3 FROM 0 TO TempVar1
14) LOOPER: TempVar4 FROM 0 TO TempVar2
15) CHECK: CheckRandomPercent < 31
16) CHECK: CheckLandscapeType(TempVar3, TempVar4) == 6
17) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 0, TempVar5)
18) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 2, TempVar5)
19) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 3, TempVar5)
20) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 8, TempVar5)
21) END CHECK
22) END CHECK
23) CHECK: CheckRandomPercent < 21
24) CHECK: CheckLandscapeType(TempVar3, TempVar4) == 5
25) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 0, TempVar6)
26) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 2, TempVar6)
27) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 3, TempVar6)
28) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 8, TempVar6)
29) END CHECK
30) END CHECK
31) CHECK: CheckRandomPercent < 31
32) CHECK: CheckLandscapeType(TempVar3, TempVar4) == 27
33) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 0, TempVar5)
34) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 2, TempVar5)
35) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 3, TempVar5)
36) EXECUTE: ExecRemoveTroops(TempVar3, TempVar4, 8, TempVar6)
37) END CHECK
38) END CHECK
39) END LOOPER
40) END LOOPER
41) END CHECK
My Advanced Tactics Mod page
http://atgscenarios.wordpress.com

30+ scenarios, maps and mods for AT and AT:G
Grymme
Posts: 1776
Joined: Sun Dec 16, 2007 5:06 pm
Contact:

RE: Trouble with punic event

Post by Grymme »

Hmm... thinking about the storm event now.
&nbsp;
The difficulty is how to make the number of storms attack being dependant of the number of SFTs (unit size) in the hex. I dont want people being immune to storms because the have large fleets so the storm has to be variable in size dependant on the size of the unit in the hex that is being attacked. That is a unit of 10 tiremes should be attack with between 5-15 storms. A unit of 50 tiremes might get attacked by between 25-75 storms.
&nbsp;
There doesnt seem to be a way to change a predefined unit by exec. But you could set that slot to a tempvar and then make a varieable. but i am not sure how. So basicly i am looking for tips.
My Advanced Tactics Mod page
http://atgscenarios.wordpress.com

30+ scenarios, maps and mods for AT and AT:G
Grymme
Posts: 1776
Joined: Sun Dec 16, 2007 5:06 pm
Contact:

RE: Trouble with punic event

Post by Grymme »

Here is a clumsy atempt at a new sea storm event. Predefined units 18-22 contain 1,2,5,10 and 12 storms respectivly ( a storm is a selfdestructing tireme with own artwork, regime etc).

0)    CHECK: CheckRandomPercent < 36
1)      EXECUTE: ExecMessage(0, 1, 0, 1)
2)      SETVAR: TempVar1 = CheckMapWidth
3)      SETVAR: TempVar2 = CheckMapHeight
4)      LOOPER: TempVar3 FROM 0 TO TempVar1
5)        LOOPER: TempVar4 FROM 0 TO TempVar2
6)          CHECK: CheckRandomPercent < 31
7)            CHECK: CheckLandscapeType(TempVar3, TempVar4) == 1
8)              EXECUTE: ExecAddUnit(18, TempVar3, TempVar4, 6)
9)              CHECK: CheckRandomPercent < 50
10)               EXECUTE: ExecAddUnit(19, TempVar3, TempVar4, 6)
11)             END CHECK
12)             CHECK: CheckRandomPercent < 50
13)               EXECUTE: ExecAddUnit(20, TempVar3, TempVar4, 6)
14)             END CHECK
15)             CHECK: CheckRandomPercent < 50
16)               EXECUTE: ExecAddUnit(21, TempVar3, TempVar4, 6)
17)             END CHECK
18)             CHECK: CheckRandomPercent < 25
19)               EXECUTE: ExecAddUnit(22, TempVar3, TempVar4, 6)
20)             END CHECK
21)           END CHECK
22)         END CHECK
23)         CHECK: CheckRandomPercent < 21
24)           CHECK: CheckLandscapeType(TempVar3, TempVar4) == 28
25)             EXECUTE: ExecAddUnit(18, TempVar3, TempVar4, 6)
26)             CHECK: CheckRandomPercent < 50
27)               EXECUTE: ExecAddUnit(19, TempVar3, TempVar4, 6)
28)             END CHECK
29)             CHECK: CheckRandomPercent < 50
30)               EXECUTE: ExecAddUnit(20, TempVar3, TempVar4, 6)
31)             END CHECK
32)             CHECK: CheckRandomPercent < 50
33)               EXECUTE: ExecAddUnit(21, TempVar3, TempVar4, 6)
34)             END CHECK
35)             CHECK: CheckRandomPercent < 25
36)               EXECUTE: ExecAddUnit(22, TempVar3, TempVar4, 6)
37)             END CHECK
38)           END CHECK
39)         END CHECK
40)       END LOOPER
41)     END LOOPER
42)     EXECUTE: ExecReadinessLossByArea(2, 1, TempVar5, 100)
43)     EXECUTE: ExecReadinessLossByArea(2, 2, TempVar6, 100)
44)   END CHECK

The event should add between 1 and 30 storms attacking.
My Advanced Tactics Mod page
http://atgscenarios.wordpress.com

30+ scenarios, maps and mods for AT and AT:G
Grymme
Posts: 1776
Joined: Sun Dec 16, 2007 5:06 pm
Contact:

RE: Trouble with punic event

Post by Grymme »

For the record. I know there are to many end checks in the event published above. Fixing it.
My Advanced Tactics Mod page
http://atgscenarios.wordpress.com

30+ scenarios, maps and mods for AT and AT:G
Post Reply

Return to “Mods and Scenarios”