• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Drawing a chess board

Status
Not open for further replies.
Level 22
Joined
Feb 3, 2009
Messages
3,292
Hello, so in my roleplay map people have come up with the idea of using terrain changers to create a chess board and play chess for fun sometimes.

I wanted to make this process easier by creating a command that would draw a chess board in a specified place in the map. It should be possible with a few for loops and polar offsets, however I can't figure out an algorithm to do it in a single trigger without using regions for each square.

Help highly appreciated.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
This should suffice (tempLoc2 is the initial location, the chessboard will be formed around it):
  • Actions
    • Set tempLoc2 = (Center of (Playable map area))
    • Set tempLoc1 = (tempLoc2 offset by (-640.00, 640.00))
    • Custom script: call RemoveLocation( udg_tempLoc2 )
    • For each (Integer loopInt1) from 1 to 8, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • tempBool Equal to True
          • Then - Actions
            • Set tempBool = False
          • Else - Actions
            • Set tempBool = True
        • For each (Integer loopInt2) from 1 to 8, do (Actions)
          • Loop - Actions
            • Set tempLoc2 = (tempLoc1 offset by (((Real(loopInt1)) x 128.00), ((Real(loopInt2)) x -128.00)))
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • tempBool Equal to True
              • Then - Actions
                • Environment - Change terrain type at tempLoc2 to Lordaeron Summer - Dark Grass using variation 0 in an area of size 1 and shape Square
                • Set tempBool = False
              • Else - Actions
                • Environment - Change terrain type at tempLoc2 to Lordaeron Summer - Rock using variation 0 in an area of size 1 and shape Square
                • Set tempBool = True
            • Custom script: call RemoveLocation( udg_tempLoc2 )
    • Custom script: call RemoveLocation( udg_tempLoc1 )
It doesn't use polar offsets, but regular offsets.
This would be way better in JASS with coordinates (you could also do it in GUI with coordinates, but whatever).

There's very little customization (it's just a regular 8x8 chessboard with small squares), so if you need more: just ask :)
 
Status
Not open for further replies.
Top