ObjectiveThis is a tutorial designed to demonstrate a method of creating three new skills: Telekinesis, Pyrokinesis, and Cryokinesis. Right now, Cryokinesis aside from graphics, isn't much different from Pyrokinesis, but in the future, there may be a way to add unique flavor to these events.
Targeting SystemIn addition to providing three new skills, it also demonstrates a method of targeting event objects without touching them. Rocks are used in this example, and a targeting mechanism for 8 separate targets per map. Expanding the total number of targets is fairly straight forward. While this version always keeps track of 8 targets, even if there's only 2 left (meaning it can take a while to cycle through phantom targets to get to real ones). I have yet to solve the phantom targeting issue.
TelekinesisMoving event objects, such as non player characters, tree stumps, stone walls, boulders, and so on is now possible. The objects are moved around by WASD (up,down,left,right) controls, and can hover over other objects in the game, such as trees or walls. During this time, the objects 'pass' through just about anything. When "set down", the objects regain the pass-ability settings they had before. For example, a heavy boulder blocking a pathway could be moved out of the way, or the path of enemy soldiers in a chase scene could be blocked off; or a giant chess game could be played against the computer. "shift" is used to lock the target, while escape or "x" is used to unlock the target, allowing another target to be selected.
Previous and Next targets are switched by pressing "A" and "D", respectively. Currently objects stay wherever you put them until you leave the map. When you come back, they return to their starting positions. I'm still working on this.
Pyrokinesis and Destructible EventsObjects can be targeted and damage can be inflicted to the object, using a new concept called "Community Health" or "Community Hit Points". Communities include Wood, Stone, Flesh, Metal, and Water. This tutorial uses the "Stone" Community. When a target's Community health damage exceeds their assigned hit points, they are destroyed. How they are destroyed is up to you, and how you set up your animations and sound effects. In my version, pyrokinesis causes targets to explode, transforming impassible boulders into passable rubble.
Note: These targets stay destroyed even after leaving the map and returning..
Step 1: Creating the skillsclick spoilers to reveal images. Let me know if you need the available code in text form. Step one involves creating three new skills, Telekinesis, Pyrokinesis, and Cryokinesis. You will have to come back to these skills to add the common events they invoke (parts 2-4).
Step 2: Skill triggered Common EventsImmediately after making your skills, you want to make the common events they call to. You'll note that Step 3 is the same as this step, for pyrokinesis and cryokinesis, and all three call the common event from step 3: Target On. The variable you are setting up ranges from 0 to 3. That's which psychokinetic power you are activating. Obviously, if you had more powers, this number range would be greater, and is easy enough to expand. "0" is reserved for "every power inactive". Clearly, you would want to rewrite this switch mechanism if you want more than one power to be functional at one time, like the ability to fly and use forcefield at the same time.
Step 3: Target OnIndicates which power is currently active and deactivates the others. This is the code you would likely edit if you wanted multiple powers on.
Step 4: how to Activate Pyrokinesis and CryokinesisThe event codes for turning on Pyrokinesis and Cryokinesis. Note this is virtually identical to the telekinesis code. All three use switches such as TK on, PyroK on, and cryoK on. You could just as easily have "Forcefield on" or "Flight on".
Step 5: Telekinesis EffectsThese are the codes for moving the events. You basically insert the 'call common event' into the objects that can be moved, and this is the code they call. Since the events are tricked into calling them out personally, they are personally effected. The basic logic is "I move north" without specifying who "I" is, in this case, "this event" is substituted for "I" and "Move Up" for "north". While turning on the skill has a base cost, there's also a maintenance cost associated with moving or changing direction. When I first tried this out, I had a cost of 10 SP per move, but that burned through the character's SP almost immediately. So I set it to 1 SP, and this gives character a few moments of Telekinesis.
Personally I'm using "Sanity" instead of "Spell Points" because the use of mind powers strains the mind driving the characters insane. I haven't set up a side effect of low/0 Sanity other than shutting down the powers, but this is a great opportunity for a Sanity related common event.
Step 6: Pyrokinesis EffectsVery similar to the Telekinesis, except four directions have turned into two directions. The "W" or "UP" button represents increasing temperature, which essentially sets off the animation. The animation has a frame duration that has to be matched up to your 'wait' duration, otherwise it won't overlap right, and all you will experience is sound effects and the first frame. I set the maintenance cost to 10, rather than 1, because the wait time is large enough to slow it down, and the power is destructive. Instead of doing damage as a negative, it ADDS to Variable determining community Hit Points, representing Total damage. When total damage exceeds the target's listed Community HP, it triggers the destruction sequence.
At this point it is important to understand that just as the Telekinesis code could be adapted to "fly', the pyrokinesis code could be adapted to setting things on fire, transmuting elements, or boiling water. I'm also contemplating causing the damage of pyrokinesis and cryokinesis to combine in weird ways, sometimes canceling, and sometimes causing objects to explode.
The damage listed is for the type of community damage (like stone) that it does. Below this number you can also have things like damage vs. wood, damage vs. flesh, and so on. By making these figures different, you create an elemental type of damage. The "S" or "Down" button is supposed to lower the temperature to a max of room temperature. I haven't figured out how to do this yet, but in theory, if you didn't destroy the object, it might be healed. Alternatively, you can use this to put out fires or damage fire elementals by "negatively" controlling their fire aspect. You might even be able to make a heat shield that absorbs fire damage or something. I just put the button option there to play with. In the mean time, you can use it as a "cancel" button if desired.
Step 7: Cryokinesis EffectsSimilar to pyrokinesis in most conceivable ways, with different damage ranges. This is the first of the three where I'll be trying a new special effect, and introducing the 'water' element, to see if I can make ice. I'll probably have to import parts of the ice tilemap into the event image list so I can have something switch to them. Next I'll work on "paralyze" and "sheathed in ice" effects, which may be possible by setting a semi permanent 1 frame animation. Thoughts of a campy ice bridge also come to mind.
Step 8: Targeting CodeThis is the code for targeting 8 different objects on the screen. You can expand it or contract it to fit your needs. I figured since, outside the doorways, I don't generally use more than 4 or 5 events, 8 per map should be plenty. The size of this common event increases with the square of its number. In other words, if you want 16 targets, it will be about 4 times longer than the thing listed below. Basically it just turns off other targets while turning on one. This is the type of code you want to modify if you want to target multiple objects at once. Many times during testing, I accidentally had multiple objects moving at one time.
I added the wait so you could focus on one target. Without the wait, it flashes through the targets so quickly it becomes irritating. I also have an animation called 'Select' which is a ~200/255 opacity flash of blue. You can use whatever single frame animation you like, such as highlighted brackets, white overlay, or whatever.
Step 9: Making RocksMake eight events, virtually identical. I recommend making one all the way through (steps 10-14) and then copying it, changing the target number to equal 2, 3, 4, etc. Until you have 8 targets. The differences should be listed in event pages 2 and 3.
Step 10-14: Setting up the EventsStep 10:
Step 11: This is the step that calls the common events this object is subject to. You can set up objects to be completely unaffected by certain things by omitting an effect like pyrokinesis or telekinesis.
Step 12: The third event page checks to see if damage has exceeded its community hp, if so, the target checks to see if it is currently targeted. If both are true, the target moves on to steps 13 and 14, being 'destroyed'. during the process of being destroyed, it resets the damage to community hit points to zero. The requirement for "currently targeted" is what prevents the other events from also being destroyed.
Step 13: first destruction stage. The entire purpose of this page is to transfer from the "am i dead?" page to "i am dead" page without the 'reset hp' interfering and making a loop.
Step 14: Dead-dead. The object is destroyed. Ironically, this stage could have built in switches for "restore/rebuild" allowing you to make engineers or healers who rebuild something destroyed as part of the plot.
I hope if you guys had the patience to review this tutorial, you found something you liked. There are a lot of different issues addressed, and a lot of room for improvement. I'm not sure if I like the 'destructible events' or 'telekinesis' part more. You definitely don't have to use all parts of this tutorial, and I encourage you to add, modify, or ignore parts as befits the situation.
-Shin