User Tools

Site Tools


Simple Scripts

This section will help explain how to create simple scripts for commonly posted scripting problems.

Walk to Cursor Location

Edit the “Left Click (Pressed)” Control Combination (the one with the blue downward arrow) inside the “Cursor” Input Set of the Input Triggers window. Underneath the “Cursor Action Down” event, simply create a “Walk to Cursor” event. The player will now move to wherever the cursor is clicking on the Map.

Alternatively, you can use a “Walk To Location” event instead. Select “(Main)” for the Map (so that it's always looking at where the player is currently located) and use Cursor.TargetXofZ(0) and Cursor.TargetYofZ(0) for the X and Y coordinates respectively.


Create a Light on a Map of your choosing. Then create a Timer with “Every Interval” set to a small value like 0.025 seconds. Then inside the “Every timer tick” trigger, use a “Position Light” event to move the Light to the player's X and Y coordinates: Actor(“main”).X and Actor(“main”).Y

For an added layer of depth, you may wish to create a battery Variable that slowly depletes as the light is in use and re-charges when the light is turned off.

Day/Night Cycle

First create a Switch to toggle between daytime and night-time - ensuring the “Default Value” is set to “ON”. Next, create a Timer on your “HUD” Interface with “Every Interval” set to a large value like 5 minutes. Then inside the “Every timer tick” trigger, use a “Switch Branch” event to check the state of your day/night cycle. Use a “Change Sun Color” event, with a light color for when the Switch is turned ON and a darker color for when the Switch is turned OFF. For best results, ensure your “Change Sun Color” events have a fairly lengthy duration (eg: 30 seconds) so that the transition from day to night is not instantaneous.

For a more advanced day/night cycle, you may wish to use the “Date / Time” Use Values to retrieve the actual date/time from the user's machine and set up a day/night cycle accordingly. You may also want your Shops/Inns to be affected by the current day/night cycle by having them open/close during the day/night respectively.

Dice Roll/Fishing System

Inside an appropriate trigger, create a “Random Probabilities Branch” event and set at least two different probabilities out of 100% (eg: “Probability 1” = 50%, “Probability 2” = 35% and “Probability 3” = 15%). For each probability, a new node will be created to set up appropriate rewards for each outcome. For the highest probabilities (the ones it's most likely to land on) assign common/low value rewards and for the lowest probabilities (the ones it's least likely to land on) assign rare/high value rewards.

simplescripts.txt · Last modified: 2017/08/19 05:49 by Lee