Looping in areacode

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:

Looping in areacode

Post by Grymme »

Hi

Here is an event i am having some problems with

0) CHECK: Gameslot_Local guerillas(#2) == 1
1) SETVAR: TempVar1 = CheckMapHeight
2) SETVAR: TempVar2 = CheckMapWidth
3) LOOPER: TempVar3 FROM 0 TO TempVar1
4) LOOPER: TempVar4 FROM 0 TO TempVar2
5) CHECK: CheckSlot(TempVar3, TempVar4, 9) == 8
6) CHECK: CheckSFTypeInArea(9, 8, 126, 1) < 1
7) CHECK: CheckHexOwner(TempVar3, TempVar4) == 1
8) CHECK: CheckRandomPercent < 50
9) EXECUTE: ExecAddUnit(15, TempVar3, TempVar4, 0)
10) END CHECK
11) END CHECK
12) END CHECK
13) END CHECK
14) END CHECK
15) END LOOPER
16) END LOOPER


The purpose of this event is to first check if a certain gamevariant is on. That part works. Then it is supposed to check a certain part of the map, a province, (areaslot 9,8) to see if there is a special SFT (antiguerilla troop) from a special regime there). Then check if that part is owned by said regime. If all conditions are met there would be a % chance of a guerilla unit appearing in any of those hexes. So when i run the event it says there is an error on command line 5. What am i doing wrong?

And is it possible to add a loop that is restricted to a certain are and play the unit in only that area? I am quite sure its possible, just dont know how.

Also is it possible to count the number of antiguerillatroops in the province and let that number affect the chance of an guerillaunit appearing?

Thanks for any help in advance.
My Advanced Tactics Mod page
http://atgscenarios.wordpress.com

30+ scenarios, maps and mods for AT and AT:G
User avatar
welk
Posts: 1199
Joined: Sun Sep 17, 2006 6:41 pm
Location: France

RE: Looping in areacode

Post by welk »

I had the exactly same problem  with his kind of line code :

0) CHECK: Gameslot_Local guerillas(#2) == 1
1) SETVAR: TempVar1 = CheckMapHeight
2) SETVAR: TempVar2 = CheckMapWidth

3) LOOPER: TempVar3 FROM 0 TO TempVar1
4) LOOPER: TempVar4 FROM 0 TO TempVar2
5) CHECK: CheckSlot(TempVar3, TempVar4, 9) == 8


It seems that the programe does not accept this code, or perhaps I have made the same unknow error as you.

As I said to Vic, a better check formule to implement in the event editot would be, to search value of group of hexagones : check-in-slot (x)== y (search directly all hex of slot x that have y as value, without having to use loop)
User avatar
Vic
Posts: 9931
Joined: Mon May 17, 2004 2:17 pm
Contact:

RE: Looping in areacode

Post by Vic »

ORIGINAL: Grymme

Hi

Here is an event i am having some problems with

0) CHECK: Gameslot_Local guerillas(#2) == 1
1) SETVAR: TempVar1 = CheckMapHeight
2) SETVAR: TempVar2 = CheckMapWidth
3) LOOPER: TempVar3 FROM 0 TO TempVar1
4) LOOPER: TempVar4 FROM 0 TO TempVar2
5) CHECK: CheckSlot(TempVar3, TempVar4, 9) == 8
6) CHECK: CheckSFTypeInArea(9, 8, 126, 1) < 1
7) CHECK: CheckHexOwner(TempVar3, TempVar4) == 1
8) CHECK: CheckRandomPercent < 50
9) EXECUTE: ExecAddUnit(15, TempVar3, TempVar4, 0)
10) END CHECK
11) END CHECK
12) END CHECK
13) END CHECK
14) END CHECK
15) END LOOPER
16) END LOOPER


The purpose of this event is to first check if a certain gamevariant is on. That part works. Then it is supposed to check a certain part of the map, a province, (areaslot 9,8) to see if there is a special SFT (antiguerilla troop) from a special regime there). Then check if that part is owned by said regime. If all conditions are met there would be a % chance of a guerilla unit appearing in any of those hexes. So when i run the event it says there is an error on command line 5. What am i doing wrong?

And is it possible to add a loop that is restricted to a certain are and play the unit in only that area? I am quite sure its possible, just dont know how.

Also is it possible to count the number of antiguerillatroops in the province and let that number affect the chance of an guerillaunit appearing?

Thanks for any help in advance.

Thats an easy one.
Switch tempvar3 and tempvar4 around in the checkslot line.
You are feeding it with invalid coordinates that are outside the map.

remember tempvar3 in your code is the Y axis and tempvar4 the X axis!

kind regards,
Vic
Visit www.vrdesigns.net for the latest news, polls, screenshots and blogs on Shadow Empire, Decisive Campaigns and Advanced Tactics
User avatar
welk
Posts: 1199
Joined: Sun Sep 17, 2006 6:41 pm
Location: France

RE: Looping in areacode

Post by welk »

Thanks for your bug report in my/our brain(s)[:D]. Please, send to me by mail&nbsp;the detailled crash report for next release[:'(]
Post Reply

Return to “Mods and Scenarios”