Page 1 of 1

Question about People

Posted: Wed Apr 02, 2008 3:22 am
by bwheatley
Here's what i need to do i need to be able to have a city that has us people when in us control then after it gets captured the people goto the 2nd regmines people. SO heres what i did.

I really wish i could write setting to a gamevar via a gamevar # instead of having to pick from teh gui if so i could have done it all in a loop but now i need to make 1 event per city which sucks but oh well.

First the loop

Code: Select all

 0)    ' Each event nbr corresponds to a city via gamevars
 1)    LOOPER: TempVar0 FROM 26 TO 27
 2)      EXECUTE: ExecExecuteEvent(TempVar0)
 3)      EMPTY
 4)    END LOOPER
 

Code: Select all

 0)    ' AUSTIN event 26
 1)    SETVAR: TempVar0 = Gameslot_Austin X(#56)
 2)    SETVAR: TempVar1 = Gameslot_Austin Y(#86)
 3)    SETVAR: TempVar2 = CheckHexOwner(TempVar0, TempVar1)
 4)    SETVAR: TempVar3 = 0
 5)    CHECK: Gameslot_Austin Owner(#26) == TempVar2
 6)      SETVAR: TempVar3 = 1
 7)    END CHECK
 8)    CHECK: TempVar3 == 0
 9)      SETVAR: Gameslot_Austin Owner(#26) = TempVar2
 10)     CHECK: TempVar2 == 0
 11)       SETVAR: TempVar4 = 1
 12)     END CHECK
 13)     CHECK: TempVar2 > 0
 14)       SETVAR: TempVar4 = 2
 15)     END CHECK
 16)     EXECUTE: ExecChangeLocationType(TempVar0, TempVar1, 5, TempVar4)
 17)     EXECUTE: ExecMessage(TempVar2, -1, 0, -1)
 18)   END CHECK
 
 
 

RE: Question about People

Posted: Wed Apr 02, 2008 6:05 pm
by Vic
you might want to do this more like:
 
loop x=0 to mapwidth
loop y=0 to mapheight
 
if location
 
   if people = us AND reg = X
 
       then change people.
 
   end if
 
end if
 
next y
next x
 
its way less work that way

RE: Question about People

Posted: Wed Apr 02, 2008 8:37 pm
by bwheatley
oh ok i see there is execchangepeople that would work. Now whats the the function to check if its a village town etf. I see checklandscapetype but thats only going to return plains,sea,light forest etc.

RE: Question about People

Posted: Thu Apr 03, 2008 12:26 am
by bwheatley
0) LOOPER: TempVar0 FROM 0 TO CheckMapWidth
1) LOOPER: TempVar1 FROM 0 TO CheckMapHeight
2) SETVAR: TempVar10 = CheckHexOwner(TempVar0, TempVar1)
3) CHECK: TempVar10 == 0
4) EXECUTE: ExecChangePeople(TempVar0, TempVar1, 1)
5) END CHECK
6) CHECK: TempVar10 == 1
7) EXECUTE: ExecChangePeople(TempVar0, TempVar1, 2)
8) END CHECK
9) END LOOPER
10) END LOOPER
11) EMPTY
12) EMPTY


i was able to do that didnt even have to bother to check if the location was a city.

RE: Question about People

Posted: Thu Apr 03, 2008 12:27 am
by bwheatley
I just thought it was inefficient to check every single hex like that but i guess it wasn't that bad :)

Vic question for you when you exec another function do any tempvar's get passed along? from what i've been doing it seems like they do. Just curious.

RE: Question about People

Posted: Thu Apr 03, 2008 9:39 am
by Vic
Hi,
 
No the temp vars are event specific.
If you want to pass stuff along use gamevars.
 
And next to CheckLandscapeType you might want to use CheckSprite to be more precise and only affect certain urban hexes.
 
kind reg,
vic
 
 
 

RE: Question about People

Posted: Thu Apr 03, 2008 11:19 am
by bwheatley
Thanks!