Custom Scripts

Custom Scripts are pieces of code attached to maps which will help players in creating rich interactive maps. It enables an infinite variety of "game modes" such as Tower Defense, RPGs, Hero maps and many more.

Posted by Trigger01 on March 25th, 2014
I've been planning and spinning around ideas on how to implement scripts since last year. This month, I've finally started to make some practical progress. It's now possible to create some basic scripts, or Triggers as they are called in various real-time strategy games such as Warcraft III and Starcraft II.

It's already possible to declare variables, check if statements and call various functions having a direct effect on the game world.

Sample Script


events: UnitDies
if (event.Unit.Team == 1)
var killCounter;
killCounter++;
ShowMessage("You've killed " + killCounter + " enemies", 255, 255, 255);


This is a basic script that I made during implementation. What it does from top to bottom is the following:

#1. Registers an event, UnitDies. This means that this particular code will run whenever an unit dies.

#2. It continues with checking if the unit that just died was on team 1 (the players default team is 0).

#3. Then it registers a variable named killCounter (variables can only register once) and increments it with one.

#4. The last thing it does is the action itself, displaying a message in white color showing the player how many enemy units he/she has killed.

Editor


The code editor itself currently has no syntax checker, it consists of a plain and simple text editor. In fact, the syntax is not even decided at this point, but I will most likely go for something like C#/Java as that is what I personally enjoy writing in. I also think it would be fairly easy to get into for non-programmers wishing to make some awesome user maps.

Limitless


While I want to make scripts as limitless as they were in the much modded game Warcraft III, it seems like it would take a lot of time to achieve that. Time which perhaps would be better spent elsewhere.

Nonetheless, my next two goals are to make looping and creating custom functions possible. I will also have to spend some time creating the entire library of functions that will be available. Everything from moving the camera, spawning different amounts of units, events such as when an unit enters a specific part of the map or when players enter a message.

Another important part is to make sure it's stable and that it under no circumstances is possible to crash or bug the game as well as giving the modder as much information as possible about occuring errors.

Leave a Comment:

Avatar

AntonJosefsson January 19th, 2038

Dude, that is amazing! I'd love to help you test this once you get far enough with it :)


Avatar

Trigger01 January 19th, 2038

[#22] Thanks, I'm very excited about it as well! I'll enjoy some needed assistance! =)