Change the Script

*Nội dung này sẽ sớm có sẵn bằng ngôn ngữ bạn chọn.

With the map complete, you'll move onto polishing the experience. These next articles will cover these finishing touches:

  • Modify a script to award different points for buildings.
  • Upload a custom game image.
  • Share the experience with friends.

Open the Script

Besides just the map, other aspects of Create and Destroy can be customized through a script, a container for code used to run an experience. In this case, you'll change the points awarded by destroying buildings.

  1. At the top of the Explorer, a list of everything included in a project, on the right-hand side, type GameSettings.

  2. Double-click GameSettings to open the script editor.

GameSettings Script Contents

In the script, you'll see a section with the three different point values given to players for large buildings (HighPoints), medium buildings (MediumPoints), and for props (LowPoints).


-- Game Variables
GameSettings.intermissionDuration = 10
GameSettings.roundDuration = 30
GameSettings.minimumPlayers = 1
GameSettings.transitionStart = 3
GameSettings.transitionEnd = 3
GameSettings.pointValues = {
-- Value types must match folder names to award points correctly
LowPoints = 0,
MediumPoints = 10,
HighPoints = 15,
}

Change the Points Value

Giving players more points can make smashing buildings feel even more rewarding.

  1. Look for Line 11 in the script. Make the large buildings worth 150 points by changing HighPoints = 15, to HighPoints = 150. Be sure to keep the comma after the number.


    GameSettings.pointValues = {
    -- Value types must match folder names to award points correctly
    LowPoints = 0,
    MediumPoints = 10,
    HighPoints = 150,
    }
  2. Playtest and see how the change feels. Ask yourself if you'd like players to get more points for smashing the medium sized buildings as well. You can change that too.

  3. If desired, take some time to experiment in making changes to the script. For example, changing the number in GameSettings.roundDuration can make rounds go faster or shorter, depending on how many seconds you type.