Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Shared Event Code VP for Oil and Raw

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Advanced Tactics Series >> Mods and Scenarios >> Shared Event Code VP for Oil and Raw Page: [1]
Login
Message << Older Topic   Newer Topic >>
Shared Event Code VP for Oil and Raw - 6/2/2015 2:30:21 AM   
E6Jarhead

 

Posts: 29
Joined: 6/1/2015
From: Hendersonville, NC
Status: offline
This event will give 20 VP to all instances of Oil and Raw.
If you want a different VP amount changes the number "20" in lines 7 and 15

0) Comment Change VP of Raw and Oil Locations
1) CommentRaw
2) LOOPER: TempVar0 FROM 0 TO CheckMapWidth
3) LOOPER: TempVar1 FROM 0 TO CheckMapHeight
4) Comment Line below checks for location type #2 Raw
5) CHECK: CheckLocTypeXY(TempVar0, TempVar1) == 2
6) Comment Line below Changes VP amount of that Hex to 20
7) EXECUTE: ExecChangeVP(TempVar0, TempVar1, 20)
8) END CHECK
9) END LOOPER
10) END LOOPER
11) Comment Oil
12) LOOPER: TempVar0 FROM 0 TO CheckMapWidth
13) LOOPER: TempVar1 FROM 0 TO CheckMapHeight
14) CHECK: CheckLocTypeXY(TempVar0, TempVar1) == 3
15) EXECUTE: ExecChangeVP(TempVar0, TempVar1, 20)
16) END CHECK
17) END LOOPER
18) END LOOPER

< Message edited by E6Jarhead -- 6/2/2015 3:37:24 AM >
Post #: 1
RE: Shared Event Code VP for Oil and Raw - 6/2/2015 8:28:31 AM   
ernieschwitz

 

Posts: 3893
Joined: 9/15/2009
From: Denmark
Status: offline
You could make this code shorter if you wanted to, and more efficient.

Let me show you how:

0) Comment Change VP of Raw and Oil Locations
1) Comment Raw
2) LOOPER: TempVar0 FROM 0 TO CheckMapWidth
3) LOOPER: TempVar1 FROM 0 TO CheckMapHeight
4) Comment Line below checks for location type #2 Raw
5) CHECK: CheckLocTypeXY(TempVar0, TempVar1) == 2
6) Comment Line below Changes VP amount of that Hex to 20
7) EXECUTE: ExecChangeVP(TempVar0, TempVar1, 20)
8) END CHECK
14) CHECK: CheckLocTypeXY(TempVar0, TempVar1) == 3
15) EXECUTE: ExecChangeVP(TempVar0, TempVar1, 20)
16) END CHECK
9) END LOOPER
10) END LOOPER

I´ve kept the line numbers the way you wrote them originally. Notice that I just moved the Check for Oil, into the looper for checking for raw. By doing it this way, you only run 1 looper that checks every hex on the map.

(in reply to E6Jarhead)
Post #: 2
RE: Shared Event Code VP for Oil and Raw - 6/2/2015 1:02:43 PM   
E6Jarhead

 

Posts: 29
Joined: 6/1/2015
From: Hendersonville, NC
Status: offline
Awesome....Shorter is better.....I've been lurking, playing and privately modding for years now...so a lot of my codes are not streamlined but brute force. So any suggestions are welcome!

Thanks!

(in reply to ernieschwitz)
Post #: 3
RE: Shared Event Code VP for Oil and Raw - 6/2/2015 1:51:54 PM   
ernieschwitz

 

Posts: 3893
Joined: 9/15/2009
From: Denmark
Status: offline
Also, this event could do with a BlockEvent at the end. This would cause it only to run once. No need to have VPs reset to 20 each turn...

(in reply to E6Jarhead)
Post #: 4
RE: Shared Event Code VP for Oil and Raw - 6/2/2015 2:17:35 PM   
E6Jarhead

 

Posts: 29
Joined: 6/1/2015
From: Hendersonville, NC
Status: offline
I have yet to explore the block event. I agree with you and did not know it was running this event each turn. Please keep the advise coming! Im trying hard to learn and would love to be able to contribute back in some way to the community

(in reply to ernieschwitz)
Post #: 5
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Advanced Tactics Series >> Mods and Scenarios >> Shared Event Code VP for Oil and Raw Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.781