From Gothic 2 Online: Wiki
Jump to navigation Jump to search


Nice to know, that someone decided to help us with wiki. But before you start you need to know couple of things. So let's do this.
NOTE! Article should be made carefully, otherwise it will be deleted! So please don't just copy and paste ready examples.

Type of article

First you need to classify where put the functions/events. There are several categories:

  • Client (Only available on client-side)
  • Server (Only available on server-side)
  • Shared (Available on both client-side and server-side)


The last step is choose template from the list:

Let's stay here for a while. I'm sure that some part of template code are not understandable and some of them need to get some extra information.

Syntax is the representation of function structure.

  • Example 1:
bool isOnline(int id)
  • Example 2 with optional parameters:
string getName(int id [, bool full_name = false])
  • Example 3 with more optional parameters:
string getName(int id [, bool full_name = false [, bool add_id = false ]])
  • Example 4 with unknown number of parameters:
float calculate(float factor [, va_list args...])

Params is a list of parameters given to a called event.

  • Example 1:
int pid, float fatness
  • Example 2:
int pid, string message
  • Example 3 with table. In this situation you should describe what data is available in what slot:
string name, table data
string name, array[int] data
  • Example 5 with array, that contains table. In this situation you should describe exactly what data is available in array.
string name, array[table] data

Returns describes what happend if you return some value from event using eventValue.

  • Example with onPlayerHit. This callback can change damage for given to player by returning new value:
local function hitHandler(pid, kid, dmg, type)
	// We don't want damage greater than 200
	if (dmg < -200)

addEventHandler("onPlayerHit", hitHandler);

So in Returns we should write that, we can change given damage value.

Related functions/events is a list of the same type of functions/event.

All the functions/events are assigned to a some category template. The name of the template consists of type, prefix and name.
Noteworthy is only the prefix. The letter F is an abbreviation of Functions and the letter E is an abbreviation of Events.

  • Example 1:
  • Example 2:
  • Example 3:

You can check the names of category templates by viewing source of list of functions\events.

Good examples