Engine001 Game Design: Making A Mass Stocking System

74

By sumosalesman

"There's gotta be a safe in here..."
See all 16 photos
"There's gotta be a safe in here..."

Overview

For a while I've avoided using interfaces on Engine001. It's too bad, because with a little practice and reference to the Engine001 forums, it's easy enough to make one. So if you're an Engine001 user who's been reluctant to use interfaces, I hope this brief guide can help you build your own!

Interested In Game Design?

The Art of Game Design: A book of lenses
A very well-received book on the art of game design.
Amazon Price: $42.53
List Price: $59.95
Level Up!: The Guide to Great Video Game Design
Design tips from one of the creators of the God of War series.
Amazon Price: $23.37
List Price: $44.99

Part 1: Defining Values & Creating Tables

Well, I declare!

There is a more accurate way to use interface variables, but for ease of scripting, I've used global values with the interface. Here is what you will need to declare in the "Variables and Switches" section: several variables and a table.

Variables:

  • v1, v2, v3: These will represent the dial turns the player makes.
  • p1, p2, p3: These are the numbers of the safe combination. Later on, if v1=p1, v2=p2, and v3=p3. the safe will open.
  • stock: The name of inventory you want to give out.
  • cash: The amount of money you want to give out.
  • xp: The amount of experience you want to give out (optional)
  • points: The amount of reward points you want to give out (optional)
  • py: The Y pointer for the table of combinations.

Tables:

  • vtab

You will need to add the Resize Table event in the System Triggers section; you will need to make it 3 X, 3 Y and 1 Z in size.

Here is how it looks in my game:

The variables and table setup you will need in the "Variables and Switches" area.
The variables and table setup you will need in the "Variables and Switches" area.

Configuring Combinations in System Triggers

How to get to System Triggers.
How to get to System Triggers.
Defining each combination inside System Triggers.
Defining each combination inside System Triggers.

Part 2: Building Custom Events

There are two custom events that need to be tucked into the zone and the interface: vpull and vcheck. They need to be built before the zone and interface are constructed. For your convenience, these custom events can be downloaded and imported into your game at http://seacoastgames.com/customs.zip.

vpull has two roles. Its first role is to turn the safe interface on with these events:

Turn On Active Interface: Vault This makes the Vault interface appear on the screen. However, it won't change the control scheme. If the player was using the character, the controls will let the character keep running around underneath the interface. If another interface is open, that interface will stay open and selected.

Change Active interface: Vault This forces the gamer's controls to manipulate the Vault interface, which was just made visible.

vpull also gets the combination out of row number py. In order to customize each safe, you simply assign py a value of 1, 2 or 3 in the safe's zone. Then, while still editing the zone, you add the vpull event, retrieving combination positions #1, #2 and #3 from that row. Those numbers are assigned to variables p1, p2 and p3.

Each time a combination number is changed inside the interface, the vcheck event is called, which checks the user-entered interface field values of v1, v2 and v3 against the combination variables, p1, p2 and p3. If all 3 match, the opening message is displayed and a new sound plays, as shown below.

Vcheck Custom Script

The full vcheck script.  Awards for a proper combination, a lousy sound for a failed combo.
The full vcheck script. Awards for a proper combination, a lousy sound for a failed combo.

Vpull Custom Event

This custom event also turns the interface on, saving the designer from having to repeatedly put this into the zone scripts.
This custom event also turns the interface on, saving the designer from having to repeatedly put this into the zone scripts.

Part 3: Scripting the Zone

When you draw a graphic on a map, you need to draw a zone over it for it to do anything. Once I draw a safe and create a zone for it, I go to the right side of the zone menu and double-click "Action key pressed beside zone". This is the easiest way to encourage someone to click next to it. I also check the "Act as Blocking" box on the left side of the zone menu. it looks a little silly walking over a safe!

When a safe zone is activated in the game map, it goes to row py in the table. So if you had three combinations that were:

Combination 1: 3 15 23

Combination 2: 55 1 45

Combination 3: 22 14 40

and py was 1, you would read row 1, and get 3 15 23. Here is how the script breaks down:

Variable Operation: py = 1

Variable Operation: points = 15

Variable Operation: stock = "Baseball Bat" (don't use quotes when you type Baseball Bat, the program will do it automatically).

Variable Operation: xp = 15

Variable Operation: cash = 5

Last off all, the custom event vpull is called. vpull shows the interface and turns its controls on. It also gets the three combination numbers from table vtab, in row py, and assigns them to variables p1, p2 and p3.

The zone's work is all done. From here, the interface will be doing all the work.

Zone Script for the Safe

Part 4: Making the Safe Interface, Part 1

The first thing I have is a backdrop picture of a safe, which is only there for looks and completely inactive. In order to make it, I first created an Effect with these steps:

  1. In the Effects menu, click the Add button in the upper left.
  2. Click on the gray square near "Change Amount".
  3. Click on the gray square in the new menu, or right click and paste in a new image on your clipboard.
  4. Save the effect. It will now be the very last effect in the drop-down list of effects. NOTE: it ought to be a perfectly square image, and I think less than 256x256.

From here, I went to the Interface menu and created a new interface. From what I can tell, I can see that there is a one-time chance to edit the interface's activation and cancellation triggers, but I'm probably wrong.

As far as I can tell, you only get one chance to make your interface entry and cancel options on this screen.
As far as I can tell, you only get one chance to make your interface entry and cancel options on this screen.

The Safe Interface: Background

Once done with the menu above, I've clicked on the Field icon, then clicked on the grid. When you do, the Field menu will appear. Here, I've changed the field's behavior to "static effect". By choosing the very last effect in the drop-down menu, you choose the image effect you just created. I called it "Bank" in this example; it's in blue. Feel free to adjust the position by changing the coordinates (shown in the red rectangle below). You can view how it looks when you hit OK and you can get back into it by double clicking the first field in the Interface menu on the upper left.

Creating the Interface Background

Making the background image for the interface (which is actually a static effect).
Making the background image for the interface (which is actually a static effect).

The Safe Interface: Field 1

Now for the fun part: the text fields. Hopefully your image has some areas where numbers will show up well against it.

Next, I'll add Field 1. I do these steps:

  1. Click on the Interface grid again. The Field menu will open again. Keep Behavior untouched.
  2. Double click the Activated trigger and add Advanced Message Box, Variable Operation and Change Selected Field Value events. For Advanced Message Box, fill it in as shown below. For Variable Operation, assign Last Input as shown below for variable v1. For Change Selected Field Value, assign v1 to the field's value as shown below. Add the vcheck Custom Event from the right menu by double clicking it.
  3. Tie all the nodes together in the order you made them. Drag your mouse over them all, right click, choose Copy, and then click Save.
  4. Also add a ? to Initial Text, click the Selectable box, and change the Selected color box to something different like red.
  5. Click OK after.


Making Interface Field 1

Making interface field 1.
Making interface field 1.

Advanced Message Box for Field 1

Advanced Message Box configuration for Field 1.
Advanced Message Box configuration for Field 1.

Change Selected Field Value, Field 1

Changing Selected Field Value and assigning it the value of v1.
Changing Selected Field Value and assigning it the value of v1.

Assigning Message Box Input to v1

Assigning the last input value from the message box to variable v1.
Assigning the last input value from the message box to variable v1.

Fields 2 & 3

Create fields 2 and 3 by following these steps:

  1. Double click on the grid to make a new field. Double click the Activated trigger section. Right click and Paste. Connect the pasted events to the GO button. Also, in the Activated scripts, change the "first" in the Advanced Message Box text to "second" for the second field and "third" for the third. Also, change variable v1 to v2 and v3 for the second and third fields. To change variables, DON'T type in the variables, but click the small square to the right of the field. Go through Global Variables and select them. Also remember for each field: add a ? to Initial Text, click the Selectable box, and change the Selected color box to something different like red.
  2. Congratulations! Your interface is done. Save it through the File menu.

Pasting and Editing Fields 2 and 3

Making edits to each interface field.
Making edits to each interface field.

Summary

The last thing to do is test your interface! To do this, just choose Test Game and press Enter near your safe. The safe image should show up, like in this development version. If it doesn't work and you're trying to make your safe work, just leave a comment and I'll try to help you as best I can. Just let me know where it stops working.

Thanks for reading!

A successful test of the safe system.  You may want to draw black squares on the safe where you plan to put the numbers.
A successful test of the safe system. You may want to draw black squares on the safe where you plan to put the numbers.

ERRATA: While writing a recent update, I discovered that, in rare instances, it's possible that numbers from one field can be written in other fields while quickly using the arrow keys. I had made a "Cancel" field to fix this, but I've replaced "Change Selected Field Value" with "Change Text/Value" (can we get an event rename with 'Field' in it?). A sample instance is shown below; it's best to replace all instances of "Change Selected Field Value" in my original script. It's not necessary, but your game players will be more grateful.

Replacing "Change Selected Field Value" with the wallflowery event "Change Text/Value".
Replacing "Change Selected Field Value" with the wallflowery event "Change Text/Value".

Comments

Vic 8 months ago

Excellent! Now I can build that farm game. Er, wait a min...

Submit a Comment
Members and Guests

Sign in or sign up and post using a hubpages account.



    • No HTML is allowed in comments, but URLs will be hyperlinked
    • Comments are not for promoting your Hubs or other sites

    Please wait working