Problem with 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:

Problem with event

Post by Grymme »

Hi

I am having some problems with an event that i cannot understand by reading the code.

The event depicts the Baltic peoples uprising at the start of Barbarossa. During the first four rounds there is a lot of Baltic partisans (friendly to the Axis showing up)-

The thing that i cannot understand is that this event works fine when it comes to human vs human play. But when the AI plays AG Nord the event doesnt produce any partisans anymore.

Any Clues? Feel free to help. Its a check round event.

0) CHECK: CheckRound < 5
1) CHECK: Gameslot_Axis/SU one Regime(#0) == 1
2) LOOPER: TempVar0 FROM 0 TO CheckMapWidth
3) LOOPER: TempVar1 FROM 0 TO CheckMapHeight
4) CHECK: CheckSlot(TempVar0, TempVar1, 4) == 3
5) CHECK: CheckHexOwner(TempVar0, TempVar1) == 1
6) CHECK: CheckRandomPercent < 25
7) CHECK: CheckRandomPercent < 2
8) EXECUTE: ExecAddUnit(113, TempVar0, TempVar1, 0)
9) EXECUTE: ExecMessage(0, 1, -1, 10)
10) END CHECK
11) END CHECK
12) END CHECK
13) END CHECK
14) END LOOPER
15) END LOOPER
16) END CHECK
17) CHECK: Gameslot_Axis/SU one Regime(#0) < 1
18) LOOPER: TempVar0 FROM 0 TO CheckMapWidth
19) LOOPER: TempVar1 FROM 0 TO CheckMapHeight
20) CHECK: CheckSlot(TempVar0, TempVar1, 4) == 3
21) CHECK: CheckHexOwner(TempVar0, TempVar1) > 7
22) CHECK: CheckHexOwner(TempVar0, TempVar1) < 11
23) CHECK: CheckRandomPercent < 25
24) CHECK: CheckRandomPercent < 2
25) EXECUTE: ExecAddUnit(113, TempVar0, TempVar1, 5)
26) EXECUTE: ExecMessage(5, 8, -1, 10)
27) END CHECK
28) END CHECK
29) END CHECK
30) END CHECK
31) END CHECK
32) END LOOPER
33) END LOOPER
34) END CHECK
35) END CHECK
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: Problem with event

Post by Jeffrey H. »

Ok, here goes. I'm a NOOB with the Editor, pre-NOOB actually.

1. "Check" statement is something like a "if/then" statement in normal programming parlance ?
2. The first bloc only works if Gameslot_Axis/SU one Regime(#0) == 1
3. The second bloc only works if Gameslot_Axis/SU one Regime(#0) < 1

Not sure what these mean but it seems that you are trying to establish what to do based on the regime status. If it's equal to 1 or less than 1 then you want to add partisans. It seems to me that the problem might lie in these statements.

Not sure why you are double filtering CheckRandomPercent, I assume this is to make the partisans appear less often ?
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: Problem with event

Post by Grymme »

Jeff.

No problems. Just writing might help get my brain going.

The thing is that the check you are talking about is refering to wether the gameslot one Axis/SU regime is on. The thing is that the even works both if the Axis/SU is on or not. As i have understood is -1 means no So X< 1 would trigger an event if X is -1. They just dont work when the AI is playing. So i dont think that can be the problem. But i cannot be sure.

I am dubblefiltering to make it less than 1% chance of partisans appearing.
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: Problem with event

Post by Jeffrey H. »

Perhaps you can start off by loading a variable with the current staus of the value of Gameslot_Axis/SU one Regime(#0) and then find a way to display it ? It''s like when debugging progams in the old days by writing out variables inside of fucntions and loops and then checking them to troubleshoot your conditionals.

The basic structure of Gameslot_Axis/SU one Regime(#0) leaves me with a number of questions, what's the #0 for ? is the space around "one" really allowed ?

Two sequential 1% checks doesn't make the probability any less than 1% for the next check. I'm guessing that the CheckRandomPercent function returns only integers ? If so, you can always create another variable and divide the outcome of calling CheckRandomPercent by 100, then it would always be <1.
History began July 4th, 1776. Anything before that was a mistake.

Ron Swanson
User avatar
ernieschwitz
Posts: 4654
Joined: Tue Sep 15, 2009 3:46 pm
Location: Denmark

RE: Problem with event

Post by ernieschwitz »

Oh yes, his method of getting a percentage less than 1% works. First you make an "if sentance" (a check) that gives less than 2%, then you run a second "if sentance" (a check) that gives less than 25% ... the end result is 0.5%.

But the solution to the original question escapes me...
Creator of High Quality Scenarios for:
  • Advanced Tactics Gold
    DC: Warsaw to Paris
    DC: Community Project.
Try this Global WW2 Scenario: https://www.vrdesigns.net/scenario.php?nr=280
User avatar
ernieschwitz
Posts: 4654
Joined: Tue Sep 15, 2009 3:46 pm
Location: Denmark

RE: Problem with event

Post by ernieschwitz »

... or something like that...
Creator of High Quality Scenarios for:
  • Advanced Tactics Gold
    DC: Warsaw to Paris
    DC: Community Project.
Try this Global WW2 Scenario: https://www.vrdesigns.net/scenario.php?nr=280
Lunaticus_matrixforum
Posts: 834
Joined: Wed Dec 31, 2008 3:50 pm
Location: Germany

RE: Problem with event

Post by Lunaticus_matrixforum »

Well, the coding looks good so the solution might be the contents of the variables.
My understanding is that the second half of the event should be active if AG Nord is AI controlled which corresponds to Gameslot_Axis/SU one Regime(#0) < 1?

Also are you confident that in that case the owner of the hexes you want to check is 8, 9 or 10? I think the above recommendation to test this out with some settings to debug makes sense. Here are some tests which might be interesting:
- make an execmessage "Hello" at the beginning of the event to be sure it is called at all...
- for a hex where you know the event should fire print out the owning regime via execmessage and see if this is 8, 9 or 10
- for a hex where you know the event should fire pring out the slot value
- instead of creating a unit in case the event fires send a message to make sure the issue is not with the execaddunit command
- increase the percentage value of unit creation to see if there is an issue there

The most likely guess to me is that there is something wrongly set with the gameslot or the regimenumber. But am sure with some testing this is solvable...

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

RE: Problem with event

Post by Jeffrey H. »

Hrrmm.. The CheckHexOwner(TempVar0, TempVar1) looks a little odd.
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: Problem with event

Post by Jeffrey H. »

ORIGINAL: ernieschwitz

... or something like that...

I think he's got 1 in 4 followed by 1 in 50. Net being 1 in 200. or 0.5%. So yeah, that works.
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: Problem with event

Post by Grymme »

Thanks guys and gals.
&nbsp;
It seems that the event works now, i fiddled a little with it forward and back. Dont know what i changed exactly. Maybe it was even a horrible statistical anomaly that caused no partisans appear in two testgames.
&nbsp;
Thanks for the help anyways.
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”