Page 1 of 1

Looping in areacode

Posted: Sun Feb 08, 2009 11:01 am
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.

RE: Looping in areacode

Posted: Mon Feb 09, 2009 6:07 am
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)

RE: Looping in areacode

Posted: Mon Feb 09, 2009 6:54 am
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

RE: Looping in areacode

Posted: Mon Feb 09, 2009 2:23 pm
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[:'(]