Free and Open Source real time strategy game with a new take on micro-management

Map editor guide

From Globulation2

Revision as of 19:42, 19 December 2005 by Ion bidon (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

fast copy from [1]

Note: Updated mapeditor for windows users will be released soon.

This guide will help you to use the map editor integrated into the game.

The map editor

The map editor is quite straightforward. Some obscure behaviours are described below:

  • When clicking with the middle button on a team (the color square corresponding to the team), the team is toggled between an AI and a human. By default teams are AI. It doesn't change anything for multiplayer and custom games, but for campaigns, one team has to be set to humans.
  • When deleting a team, all related buildings and units are destroyed.
  • If terrain is set to water under a unit who can't swim, the unit is deleted.

Scripting

Introduction

SGSL is a little scripting language for Globulation 2. SGSL is simple and has a very easy syntax. An SGSL script is nothing else than a list of lines which are executed sequentially. The power of SGSL is it's ability to execute several scripts at the same time. So there can be, for instance, two different ways to win the game, and both will be valid. This is known as multi-threaded-scripting (MTS).

SGSL is functional, that is, every keyword is a function. In order for the script to continue, each of the functions has to evaluate to true. The syntax is simple, math-like with "functionName(list arguments)" possible arguments can also be functions.

SGSL can be edited from the map editor. In the SGSL editor, script can be saved or loaded to external text files.

Keywords

The possible keywords (functions) are:

show("text", lang)
Shows "text" until hide is reached. If lang is given, "text" is only displayed if lang is equal to the current language.
hide
Hides the text displayed by show.
wait(condition)
Waits until condition is fullfiled.
timer(time)
Starts a global timer. When it reaches 0, the game is won. The remaining time is shown on the screen.
activate(player)
deactivate(player)
Activates/deactivates the player with number player. Not implemented anymore
alliance(player1, player2, level)
Changes alliance level between players player1 and player2 to level.
label("labelName")
Puts the marker "labelName" in the code to go back with jump.
Jump("labelName")
Jumps to the code labelled "labelName" by label.
setArea("name", x, y, r)
Defines an area with the name "name" at x, y and radius r on the map.
summonUnits("areaName", amount, type, level, player)
Creates an amount of globules of type type, controlled by the player at the position set by the area "areaName". The radius of the area is not important, but if there is no place to summon the globules, less or no globules will be summoned.
summonFlag("flagName", x, y, r, unitcount, team)
Creates a WarFlag for the team with the given position x, y and radius r. The WarFlag is set to require unitcount units.
destroyFlag("flagName")
Destroys a flag created by summonFlag
win(player)
loose(player)
Makes player win/lose the game (note the misspelling of the word lose).
story
Indicates the beginning of a new script to execute in parallel.
guiEnable(guiElement)
guiDisable(guiElement)
Enables/disables a GUI element. GUI elements are:
  • AllianceScreen
  • BuildingTab
  • FlagTab
  • TextStatTab
  • GfxStatTab
  • ExporationFlag
  • WarFlag
  • ClearingFlag
  • ForbiddenFlag
  • CancelFlag
  • any variable (see below)

Conditions

The possible parameters for the function wait are:

any integer
The amount of seconds to wait (example: wait (300), makes the script execution wait for 300 seconds at this line).

The other conditions are functions returning true or false (true meaning that waiting is over / false meaning it will continue to wait):

not(function)
Negates the result of the function given as parameter.
isdead(player)
Returns true if the player "player" (designed by an integer) is dead.
area("areaName", who)
Returns true if globules or structures of the players designed by the function who are in the area "areaName". Who may be:
  • enemy(player) enemies of player
  • ally(player) allies of player
  • an integer p player p
variable(...) comparison value
True when the comparison comparison is true between value and the result of the function variable. comparison can be: greater-than, less-than and equal to

Variables

variable(player, level, "flagName")
Returns the amount of buildings (or globules, depending of the chosen "variable" function) belonging to the player player and which are of level level (levels are disregarded for globules) that are under the flag "flagName". To search the entire map, the parameter "flagName" can be omitted. The support for flags in variables has been removed. Now one can only search the entire map.
The "variable" functions are the following:
  • Worker: Amount of working globules.
  • Explorer: Amount of exploring globules.
  • Warrior: Amount of warrior globules.
  • Swarm: Amount of swarms.
  • Inn: Amount of inns.
  • Hospital: Amount of hospitals.
  • Racetrack: Amount of race tracks.
  • Pool: Amount of swimming pools.
  • Camp: Amount of training camps.
  • School: Amount of schools.
  • Tower: Amount of towers.
  • Market: Amount of markets.
  • Wall: Amount of walls.
Misc