• Tutorials

  • Home
  • Advanced Tutorial: Wall, Backdrop and Blockage Changes

    To use a GPDL script to change the walls, overlays, doors, backdrops and blockage surrounding a map square:

    1. Decide which walls (I'll use this term throughout to refer to overlays and doors as well), backdrops and/or blockage you want to change. Note the coordinates - if you want to change both sides of a wall, for example, there are two map cells involved, so two coordinates to note.
    2. Determine how you're going to change the walls, backdrops and/or blockage - by which I mean what type of event will be used to trigger the change, for example a Question Yes/No Event or Text Statement Event or Quest Stage Event. The event need not be in one of the cells noted above, nor even on the same level.
    3. For this tutorial, we will chain a Logic Block Event to contain our GPDL scripts
    4. Initial Wall Placement

    5. We will change the walls around and backdrop in the cell at 8,7. The message box on the right side shows the current statistics for the cell.
    6. We will change backdrops within the cell, and the walls within the cell and on the opposit side, so one each in the four surrounding cells. We will leave the blockage as is for this change.
    7. Wall Slot Editor

    8. The functions that we will use in our scripts require 5 pieces of information: level number, x coordinate, y coordinate, direction facing, and value.
      The functions for this part of the tutorial are:
      $SetWall
      $SetOverlay
      $SetDoor
      $SetBackground
      We will use blockage a little later on.
    9. This tutorial is using level 1, so we know the first bit of info is "1" - level numbers start at 1 and go through 255. Thanks to the note we made above we know that the second and third bits of info are "8" and "7", respectively (for the main cell, while the adjoining cells will have the second and third bits for their part of the script). The fourth piece of info is the direction facing - 0 = north, 1 = east, 2 = south, and 3 = west.
    10. The fifth bit of info requires us to look at the wall slots editor (for walls) and the backdrop slots editor (for backdrops). The numbering for both starts at 0 in the upper left corner and counts up from left to right, top to bottom.
    11. Logic Block Event

    12. I'm using a Text Statement Event to explain the situation about changing walls, etc. I have a Question Yes/No Event chained after this to ask the player if they wish to change the walls, etc. and to this I chain on the "Yes" branch the Logic Block Event.
    13. I want the previously given "Yes" answer to always cause the change, so I leave all Inputs and Gates as is and go down to First Action and set it to Always.
    14. From the drop down menu select GPDL Function.
    15. Press the elipses button to open the Script Editor to input the script.
    16. Script Editor

    17. I chose to put like with like functions, in a way that made sense to me. First, I changed the walls in the main cell - 8,7.
    18. I changed the walls in each adjoing cell so that the new look will be consistent inside and out.
    19. I changed the door graphic on both sides of the wall.
    20. Finally, I set a new backdrop on each side of the main cell to better match the new walls.
    21. Always check the syntax before continuing, it will save you a lot of headaches later on.
    22. Here's the script I used:
      	$SetWall (1,8,7,0,4);
      	$SetWall (1,8,7,1,4);
      	$SetWall (1,8,7,2,4);
      	$SetWall (1,8,7,3,5);
      	$SetWall (1,8,8,0,4);
      	$SetWall (1,7,7,1,5);
      	$SetWall (1,8,6,2,4);
      	$SetWall (1,9,7,3,4);
      	$SetDoor (1,8,7,3,5);
      	$SetDoor (1,7,7,1,5);
      	$SetBackground (1,8,7,0,1);
      	$SetBackground (1,8,7,1,1);
      	$SetBackground (1,8,7,2,1);
      	$SetBackground (1,8,7,3,1);
      	$RETURN;
      	
    23. Script Editor

    24. I have another event at 5,7 in which following the same form as above, I willa ask the player if they wish to plant a tree, and the Logic Block event will be set up the same way, but this time I am adding a wall to where none was before, so will need to change the blockage to keep the player from just passing right through the new wall choice.
    25. Here's the script I used:
      	$SetWall (1,4,7,1,8);
      	$SetBlockage (1,4,7,1,2);
      	$SetWall (1,5,7,3,8);
      	$SetBlockage (1,5,7,3,2);
      	$RETURN;
      	
    26. Wall Slot Editor

    27. The $SetBlockage function follows the same pattern as the other functions used in this tutorial. The values match the corresponding slots shown.
    28. Click OK as appropriate and Save your work. We're done.

    For Further Consideration: These functions can be used any place functions can be sued - Special Abilities, Spells, Items and Event Triggers. Additionally, there are "Get" versions of each to retrieve the current information allowing for use in conditionals and easily resetting the values to default values set in the Editor.
    With a little planning, you could allow players to plant crops, cut down trees, decorate a dwelling, blast through walls, raize a village, etc. And you need not ask the player what she wants to do - you can change their environment based on anything - Quests, ASLs, time of day, day of the week (useful for crowds in a market place), etc. Your imagination is your only limit.