Code Help Please

Discuss and post your mods and scenarios here for others to download.

Moderator: Vic

Post Reply
JWRussell
Posts: 4
Joined: Tue Aug 01, 2017 11:42 pm

Code Help Please

Post by JWRussell »

Can someone write a code snippet for me?

Check each Hex for location type X
Does location type X belong to AI or Human
If location type X belongs to AI then change to location type Y
if it belongs to human then no action

I have come close but cant get it...

THANKS!!
User avatar
ernieschwitz
Posts: 4245
Joined: Tue Sep 15, 2009 3:46 pm
Location: Denmark

RE: Code Help Please

Post by ernieschwitz »

Curious:

What have you done so far to make the code? Can you post you code here... it might be easier to tell then where you stumbled.
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
JWRussell
Posts: 4
Joined: Tue Aug 01, 2017 11:42 pm

RE: Code Help Please

Post by JWRussell »

OK, here is what I have,,,,
I know I need to put in a CheckfiAI somewhere..but I have no idea where! or how to set it up
Also when it changes the Loctype from x to Z how do I set it ti keep the same people as it was?

0) LOOPER: TempVar0 FROM 0 TO CheckMapWidth
1) LOOPER: TempVar1 FROM 0 TO CheckMapHeight
2) CHECK: CheckLocTypeXY(TempVar0, TempVar1) == 0
3) EXECUTE: ExecChangeLocationType(TempVar0, TempVar1, 9, 0)
4) END CHECK
5) END LOOPER
6) END LOOPER
7) EXECUTE: BlockEvent
User avatar
ernieschwitz
Posts: 4245
Joined: Tue Sep 15, 2009 3:46 pm
Location: Denmark

RE: Code Help Please

Post by ernieschwitz »

Ok, I see where you are having trouble.

I made this little attempt at coding it (See image). I can't remember if CheckIfAI is supposed to = 0 or = 1 if the regime is AI. I guess that will be for you to find out ;)

Image
Attachments
Code.jpg
Code.jpg (85.21 KiB) Viewed 175 times
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
JWRussell
Posts: 4
Joined: Tue Aug 01, 2017 11:42 pm

RE: Code Help Please

Post by JWRussell »

Beautiful!! Thank you!!
User avatar
ernieschwitz
Posts: 4245
Joined: Tue Sep 15, 2009 3:46 pm
Location: Denmark

RE: Code Help Please

Post by ernieschwitz »

No problem :)
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
Post Reply

Return to “Mods and Scenarios”