How to use the kazstring plugin advanced functions

So, Kazstring can do basic stuff like display the names of items or skills. This can be useful working with stuff like Steal events, or you could store strings of text as a name. But today, we'll discuss more complicated things you can do with the KazString plugin.

Making A Custom Restart

At the end of a game, if you want some sort of extra content in the game, you can do the following.

The store_file code stores a Hero number (in this case, hero #20) into an external file. The file is called dynstore, shown here.

So, when you want to load the extra content, you load this file to a new name, make sure the original name is properly named to match up with this, and compare the two. Because it is stored outside the game engine, this means you can do things like even after the New Game option, start the game a different way the second time.

You could for instance, directly after the New Game, give the option (just move the load_file code to directly after the new game).

Start New Game
New Game +

In the latter, the extra scenes are loaded. and a switch can be turned on to change events.

Using Arrays

I'm not sure how many people know about C++ arrays, so I'll explain how this works. With a variable, it takes up a single slot.

For example Random number 19-35 looks like this.

(It's a random number, so it actually only contains one number)>

An array is basically a grid of numbers, for instance is



or 5 rows of 10 columns of stored numbers. By default, much like variables, these basically contain 0. There are two array commands, get_array (which draws an array replacing a variable), and store array which stores a specific number or value into an array. For example:

store_array 1, 2, 13 does the following.



By the way, this isn't completely accurate. The array actually starts at zero rather than one.

Once stored get_array 1, 2, 124 pulls that 13 out, and stores it into variable 124, replacing whatever was in the variable. This behavior is actually useful, because it means you can have a variable behave like a switch, turning "on" events by setting them to a number which is then stored, and then the variable gets set to 0 after the event making it only run if the array slot is equal to more than a certain number.

You can use this for keyed doors, treasure chests, and even to keep track of sidequests. There are by the way 21 rows and 1001 columns (
) so you have a few to work with (I could make more very easily, if people need it). Here's an example code.

Note that you can simplify matters by doing things by variable, making less adjustments to the code. Again, this is just a simple matter of comparing a number to activate a branch. But this saves a few thousand switches and variables, and a whole lot of lines of code.

You could also in theory do a Sudoku puzzle (which normally requires checking a ton of variables against each other). Well, I wouldn't, but you could.


Pages: 1
You can also make an entirely internal treasure-chest common event.

Just pull the Facing Up and ThisEvent movement outside the common event.

It should look like this

Array Row, Set (whatever)
Array Column, Set (whatever)
TreasureID, Set (whatever)
Condition Hero Facing Up
ThisEvent Face Left, Face Up
Call Common Event: Treasure
ThisEvent Face Down
End Event Processing

Inside the common event you have basically the code above, and then another common event something to handle the treasure ID (you can also work with quantities). Here, you use the @store_item to draw the item name, and then it displays what's inside by common event and variable. If you have multiple items possible in a treasure chest, you'll need a third common event, which clears all the numbers so you don't have carryover variables if one chest has only one after one with six items inside.
Just as an update, there now is a simpler and more direct way to handle treasure chests. I made a compare_array comment, which checks whether the number is equal to the value in question, and turns on a switch if so.

The get_array is still there, but I'd recommend that for battle stuff, like assigning damage for attacks or something.

There's a ton of new comment effects, mainly dealing with shifting around temporary numbers into/from variables/switches.
Can you upload the new image?
because it's already no longer available for us
Thanks bulma ^^
Pages: 1