IT/Scrivere una gamemode: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (New page: {{IT/MainP}} This guide tries to outline the process of how to write a proper gamemode. If you just started with scripting for MTA, you may want to check the other scripting tutorials at ...)
 
mNo edit summary
 
(19 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{IT/MainP}}
{{IT/MainP}}
[[Category:100%]]
[[Category:IT/Guide e tutorial]]
Questa guida cerca di definire a grandi linee le regole per scrivere una gamemode ben fatta. Se hai appena iniziato a programmare per MTA, vorrai probabilmente controllare prima gli altri tutorial che troverai nella [[IT/Pagina principale|Pagina principale]].
==Introduzione==
Una ''gamemode'' è una risorsa che, una volta avviata, domina l'intero gameplay, dicendo ai giocatori cosa fare, creando oggetti, definendo come i giocatori possono vincere o accumulare punti eccetera eccetera. Alcuni esempi sono le gamemodes Race o Deathmatch.


This guide tries to outline the process of how to write a proper gamemode. If you just started with scripting for MTA, you may want to check the other scripting tutorials at the [[Main Page]] first.
==Cosa si intende per gamemode "ben fatta"?==
==Introduction==
Per essere semplici, una gamemode "ben fatta" è una gamemode che utilizza appieno le potenzialità delle mappe (.map) di MTA; vale a dire che la gamemode non contiene elementi specifici delle mappe(pickups, oggetti, spawns, veicoli eccetera)''hardcodati'' al loro interno. Questi elementi vanno invece inseriti nelle mappe di MTA(.map) che verranno poi caricate dagli scripts. In questo modo possono essere caricate mappe diverse per la stessa gamemode, o è anche possibile creare delle mappe grazie al map editor di MTA.
A gamemode is a resource that, once started, controls all of the gameplay. This may include telling the players what to do, spawning players, creating teams, defining what the players have to do to win or to get points and much more. Examples are Race and Deathmatch.  
Un ovvio esempio di una gamemode "ben fatta" è MTA:Race: permette ai giocatori di caricare mappe personalizzate(i file .map). Non c'è bisogno di modificare la gamemode stessa per cambiare gli spawnpoints, i veicoli, eccetera.


==What does "proper gamemode" mean?==
===Files mappa===
To put it simply, a proper gamemode is one that makes full use of MTA's .map file system. This means that the gamemode code does not have any map-specific data hardcoded in it, like positions of players or cars. Instead, the gamemode should be able to load .map files which define these data. This way the gamemode can have multiple maps; also, people can create .map files for the gamemode with MTA's map editor, which is much more convenient than writing code.
Tecnicamente, i file mappa non sono altro che documenti XML con estensione .map; definiscono le basi di gioco di una o più gamemodes, anche se non possono cambiare le "regole del gioco", essendo queste definite dalla gamemode(.lua).


An obvious example of a "proper gamemode" is MTA:Race. It allows usermade maps with lots of possibilities within the .map file. To alter spawnpoints, objects etc., the user doesn't need to edit the gamemode itself.
Ogni elemento nel gioco corrisponde ad un ''nodo'' nel file .map. C'è una sintassi predefinita per elementi quali oggetti, veicoli eccetera; comunque, per elementi "speciali" delle tue gamemodes, dovrai creare tu una sintassi apposita.


===Map Files===
====Esempio====
Map files are basically XML documents with a .map extension. They define an environment to play one or more specific gamemodes in. They are however not supposed to change the rules of the game - those are defined by the gamemode.
Per il nostro esempio, prendiamo in esame la gamemode ''Capture the Flag''. Una mappa per questa gamemode deve sostanzialmente definire gli spawnpoints dei giocatori e la posizione delle bandiere, ed eventualmente la presenza di altri oggetti come i veicoli o i pickups. Un file .map molto semplificato apparirebbe così:
 
Each element in a map corresponds to a node in the .map file. There is standard syntax for common things like spawnpoints, objects and vehicles; however, for "special", gamemode specific information, you need to invent your own syntax.
 
====Example====
Let's take a Capture the Flag gamemode as an example. A map for this gamemode needs to mainly define spawnpoints and flag locations, and eventually objects and vehicles. A simplified map file could look like this:
<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
<map>
<map>
Line 26: Line 26:
</syntaxhighlight>
</syntaxhighlight>


Here you can see two MTA elements - a spawnpoint and a pickup. More importantly, this .map has a custom "flag" node which defines the position and color of the flag. The spawnpoint and pickup can be handled by existing external resources, custom elements have to be processed by the gamemode.
Qui possiamo vedere due elementi di MTA: uno spawnpoint ed un pickup. Ancora più importante, questa mappa ha un ''nodo'' chiamato ''flag'' che definisce la posizione ed il colore della bandiera. Gli spawnpoints ed i pickups possono essere gestiti da risorse esterne, ma gli elementi personalizzati devono essere processati dalle gamemodes.


To summarize - we want mass mapper input as we saw in MTA:Race. Users should NOT have to touch the gamemode script itself at all.
Insomma, vogliamo che i giocatori possano creare le proprie mappe senza aver bisogno dello script LUA.


====Example of getting the .map information====
====Esempio: come ottenere le informazioni dal file .map====
As mentioned above, your gamemode needs de retrieve custom elements that are defined in a map file and process them. This is quite easy as demonstrated below.
Come detto prima, la tua mode ha bisogno di ritrovare gli elementi personalizzati definiti in un file .map e processarli. Questo è abbastanza facile, come è dimostrato qui sotto.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- retrieve a table with all flag elements
-- crea una tabella con tutti gli elementi di tipo flag
local flagElements = getElementsByType ( "flag" )
local flagElements = getElementsByType ( "flag" )
-- loop through them
-- crea un ciclo per ogni elemento che abbiamo trovato
for key, value in pairs(flagElements) do
for key, value in pairs(flagElements) do
-- get our info
-- ottiene le info di quell'elemento
local posX = getElementData ( value, "posX" )
local posX = getElementData ( value, "posX" )
local posY = getElementData ( value, "posY" )
local posY = getElementData ( value, "posY" )
local posZ = getElementData ( value, "posZ" )
local posZ = getElementData ( value, "posZ" )
local team = getElementData ( value, "team" )
local team = getElementData ( value, "team" )
-- create an object according to the flag position
-- crea un oggetto a seconda della posizione della bandiera (flag)
createObject ( 1337, posX, posY, posZ )
createObject ( 1337, posX, posY, posZ )
-- output the team that we created a base for
-- scrive in chat il team per cui abbiamo creato una base
outputChatBox ( "Base for team " .. team .. " created" )
outputChatBox ( "Base creata per il team ".. team .."!" )
end
end
</syntaxhighlight>
</syntaxhighlight>
The [[getElementsByType]] function retrieves a table of all the elements of a certain type (the type corresponds to the node name in the .map file). This works for both custom types and built-in MTA types (like "vehicle" or "player").
La funzione [[IT/getElementsByType|getElementsByType]] restituisce una tabella contenente tutti gli elementi di un dato tipo (il tipo corrisponde al nome del ''nodo'' [nell'esempio "flag"] nel file .map). Questo funziona sia per i tipi personalizzati sia per quelli di default di MTA (come "vehicle" o "player").
[[getElementData]] can be used to retrieve the xml attributes set in the .map file.
[[IT/getElementData|getElementData]] è usato per ritrovare gli attributi impostati nell'XML.
In this simple example, an object is created at the flag's location and a message is outputted in the chatbox. In reality, you will of course need to do more during map loading, like in this case setting up collision shapes to detect players taking the flag.
In questi semplice esempio, un oggetto è creato nella posizione della bandiera e un messaggio viene inviato in cheatbox. In realtà, bisognerà fare ovviamente del lavoro in più durante il caricamento della mappa, come in questo caso creare delle ''forme di collisione'' per determinare quando un player cattura la bandiera.
 


==Map manager==
==Il map manager==
Having read the section above it should be clear that a gamemode should always consist of two parts:
Dopo aver letto la sezione di sopra dovrebbe essere chiaro che una gamemode consiste di due parti:
* The gamemode resource that always stays the same
* La ''resource'' della gamemode, che resta sempre uguale
* Many different maps resources that give the gamemode map-specific information
* Molte ''resource'' delle mappe, che forniscono alla gamemode informazioni legate alla mappa


Now instead of writing a map-loader for every single gamemode, the [[Map manager]] provides functions to load gamemodes and maps. Simply put, when you enter the correct command (for example 'gamemode ctf ctf-italy') it will start both resources 'ctf' and 'ctf-italy' while triggering an event ([[onGamemodeMapStart]]) to tell the 'ctf' resource that a map was loaded. The 'ctf' resource can then access the information 'ctf-italy' contains and start spawning players etc.
Ora, al posto di scrivere uno script che carichi la mappa per ogni gamemode, il '''[[IT/Map manager|Map manager]]''' fornisce funzioni per caricare le gamemodes e le mappe. Semplicemente, quando digiti il comando giusto (per esempio 'gamemode ctf ctf-italy') avvierà le due ''resource'' 'ctf' e 'ctf-italy', chiamando anche l'evento '[[IT/Map_manager#Eventi|onGamemodeMapStart]]' per avvertire la ''resource'' 'ctf' che una mappa è stata caricata. La ''resource'' 'ctf' può quindi accedere alle informazioni contenute in 'ctf-italy' e iniziare a spawnare i players, etc.


===How to use the mapmanager===
===Come usare il map manager===
To use the mapmanager service, your gamemode resource has to be tagged as such first. More specifically you'll be setting the "type" attribute of its <info> tag to "gamemode" inside meta.xml. Also, you can set the "name" attribute to a friendly name (like "Capture the flag") that will be shown on ASE instead of the resource name.
Per usare questa feature, la tua gamemode deve essere ''taggata'' di conseguenza. In maniera più specifica, dovremo impostare, nel meta.xml, l'attributo "type" della ''tag'' <info> a "gamemode". Inoltre, possiamo impostare per l'attributo "name" un nome più 'familiare' (come "Capture the flag") che verrà mostrato nel server browser al posto del nome della ''resource''.
<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
<!-- meta.xml in "cowcatapult" gamemode -->
<!-- meta.xml della gamemode "cowcatapult" -->
<meta>
<meta>
     <info type="gamemode" name="Cow catapulting 2.0"/>
     <info type="gamemode" name="Cow catapulting 2.0"/>
Line 69: Line 68:
</syntaxhighlight>
</syntaxhighlight>


If your gamemode is going to load custom maps, you should add handlers for
Se la tua gamemode dovrà caricare mappe personalizzate, dovranno essere presenti gli ''event handlers'' per
* onGamemodeMapStart
* onGamemodeMapStart
* onGamemodeMapStop (if any unloading is necessary)
* onGamemodeMapStop (se necessario)
These are fired when a map for your gamemode is started or stopped, and pass the map resource as a parameter.
Questi eventi vengono chiamati quando una mappa per la tua gamemode viene avviata o chiusa, e passano la ''reource'' della mappa come paramentro.
Within the handler function for these events you can extract all info you need from the resource's map files and configuration files.
All'interno della funzione legata a questi eventi potrai ottenere tutte le informazioni che ti servono dai file della mappa.


====Example====
====Esempio====
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function startCtfMap( startedMap ) -- startedMap contains a reference to the resource of the map
function startCtfMap( startedMap ) -- startedMap è la mappa appena avviata
     local mapRoot = getResourceRootElement( startedMap )        -- get the root node of the started map
     local mapRoot = getResourceRootElement( startedMap )        -- ottiene il nodo di root della mappa avviata
     local flagElements = getElementsByType ( "flag" , mapRoot ) -- get all flags in the map and store them in a table
     local flagElements = getElementsByType ( "flag" , mapRoot ) -- ottiene tutte le bandiere della mappa e le salva in una tabella
     -- go on loading information like in the example above
     -- continua a caricare informazioni come sopra


     -- spawn players etc.
     -- spawna i players etc.


end
end
Line 89: Line 88:
</syntaxhighlight>
</syntaxhighlight>


===Making maps compatible===
===Rendere le mappe compatibili===
Maps are separate resources. This is done so no editing of the gamemode resource is ever necessary in order to create a custom map, and also allows you to pack map-specific scripts/config files with them.
Le mappe sono ''resource'' separate. Questo è stato fatto perché creare una nuova mappa non implichi nessuna modifica nella gamemode, e viceversa.


To make a map compatible with your gamemode, open its resource's meta.xml and tag it as well: the "type" attribute must be set to "map", and the "gamemodes" attribute must be a comma-separated list (no spaces) of gamemode resource names that the map works with.
Per rendere una mappa compatibile con la tua gamemode, apri il suo file meta.xml e modificalo così: l'attributo "type" dev'essere settato a "map", e l'attributo"gamemodes" dev'essere una lista senza spazi, in cui gli elementi sono i nomi delle gamemode con cui la mappa funziona, separati da virgole.
<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
<!--map's meta.xml-->
<!--meta.xml della mappa-->
<meta>
<meta>
     <info type="map" gamemodes="cowcatapult,assault,tdm"/>
     <info type="map" gamemodes="cowcatapult,assault,tdm"/>
Line 100: Line 99:
</syntaxhighlight>
</syntaxhighlight>


Once you have everything set up, admins will use these two commands to start/stop gamemodes:
Quando tutto è pronto, gli admin potranno usare questi due comandi per avviare/fermare le gamemode:
/gamemode gamemodeName [mapName] (optional parameter allows picking an initial map, defaults to none)
*/gamemode nomeGamemode [nomeMappa] (nomeMappa è opzionale: puoi selezionare una mappa con cui iniziare la gamemode, di default questo parametro è vuoto)
/changemap mapName [gamemodeName] (optional parameter specifies the gamemode to start the map with, defaults to the current one)
*/changemap nomeMappa [nomeGamemode] (nomeGamemode è opzionale: seleziona la gamemode da avviare con la mappa, di default è quella corrente)


[[Map manager]] exports a few more access functions which you don't have to use, but may be useful.
Il [[IT/Map manager|Map manager]] esporta qualche altra funzione che in questo esempio non serve, ma che potrebbe essere utile.


==What else should you do==
==Cos'altro dovresti fare==
There are several other resources that gamemodes should use/be compliant with.
Ci sono alcune altre ''risorse'' che dovresti usare nel creare la tua mode, o almeno conoscere.


===Helpmanager===
===Helpmanager===
The helpmanager is ought to be the standard interface for players when they need help. If you use the helpmanager to display your gamemode's help, every player that used helpmanager before (e.g. in other gamemodes) will immediately know how to get there. It also displays help for different resources running resources in one window, if necessary.
L''''[[Resource:IT/Help manager|Help manager]]''' dovrebbe essere l'interfaccia standard per i giocatori che hanno bisogno di aiuto. Se usi l'Help manager per mostrare il testo d'aiuto della tua mode, tutti i giocatori che lo hanno già usato in altre gamemodes sapranno immediatamente come usufruirne. Esso mostra anche un aiuto per le diverse ''risorse'' attive divise per schede in una sola finestra, se necessario.


There are basicially two ways to use the helpmanager:
Ci sono due modi per usare l'Help manager, in breve:
* Provide a simple text that explains how to use your gamemode
* Mostrare un semplice testo che spieghi come usare la gamemode.
* Request a GUI element from the helpmanager that will be displayed in its own tab in the helpmanager window and lets you add any GUI elements to it. This is the recommended way for gamemodes that need to display more complex information that needs its own GUI.
* Mostrare informazioni più complesse sotto forma di GUI.


Read the helpmanager page for details on how to do it.
Leggi la [[Resource:IT/Help manager|pagina dell'Help manager]] per dettagli su come farlo.


===Scoreboard===
===Scoreboard===
Scoreboard displays players and teams currently ingame. You add custom columns to it to provide map specific information. For example the column 'points' in the 'ctf' gamemode could represent the player's points gained through kills or captures. As usual, see the scoreboard help page for more information.
La '''[[Resource:IT/Scoreboard|Scoreboard]]''' mostra i giocatori e i [[IT/Elemento/Team|team]] attualmente in gioco. Puoi aggiungere delle colonne personalizzate per dare informazioni aggiuntive sulla tua mappa. Per esempio la colonna ''punti'' nella gamemode ''capture the flag'' può rappresentare il numero di catture della bandiera o il numero di kill di un giocatore.


===Map cycler===
===Map cycler===
The map cycler controls what gamemodes and maps are played on a server. You can specifiy for example how many times in a row a map will be played until it switches to the next. To achieve this, you need to tell the map cycler when your gamemode finished (e.g. when a round ends).
Il '''Map Cycler''' controlla quali mappe e gamemodes sono in gioco sul server. Puoi specificare ad esempio quante volte una gamemode verrà rigiocata prima che si passi alla prossima; per far ciò, devi dire al map cycler quando la tua gamemode finisce (ad es. quando finisce un round).


[[en:Writing gamemodes]]
[[en:Writing Gamemodes]]
[[ru:Writing Gamemodes]]

Latest revision as of 11:41, 11 June 2023

« Torna alla Pagina principale italiana .

Questa guida cerca di definire a grandi linee le regole per scrivere una gamemode ben fatta. Se hai appena iniziato a programmare per MTA, vorrai probabilmente controllare prima gli altri tutorial che troverai nella Pagina principale.

Introduzione

Una gamemode è una risorsa che, una volta avviata, domina l'intero gameplay, dicendo ai giocatori cosa fare, creando oggetti, definendo come i giocatori possono vincere o accumulare punti eccetera eccetera. Alcuni esempi sono le gamemodes Race o Deathmatch.

Cosa si intende per gamemode "ben fatta"?

Per essere semplici, una gamemode "ben fatta" è una gamemode che utilizza appieno le potenzialità delle mappe (.map) di MTA; vale a dire che la gamemode non contiene elementi specifici delle mappe(pickups, oggetti, spawns, veicoli eccetera)hardcodati al loro interno. Questi elementi vanno invece inseriti nelle mappe di MTA(.map) che verranno poi caricate dagli scripts. In questo modo possono essere caricate mappe diverse per la stessa gamemode, o è anche possibile creare delle mappe grazie al map editor di MTA. Un ovvio esempio di una gamemode "ben fatta" è MTA:Race: permette ai giocatori di caricare mappe personalizzate(i file .map). Non c'è bisogno di modificare la gamemode stessa per cambiare gli spawnpoints, i veicoli, eccetera.

Files mappa

Tecnicamente, i file mappa non sono altro che documenti XML con estensione .map; definiscono le basi di gioco di una o più gamemodes, anche se non possono cambiare le "regole del gioco", essendo queste definite dalla gamemode(.lua).

Ogni elemento nel gioco corrisponde ad un nodo nel file .map. C'è una sintassi predefinita per elementi quali oggetti, veicoli eccetera; comunque, per elementi "speciali" delle tue gamemodes, dovrai creare tu una sintassi apposita.

Esempio

Per il nostro esempio, prendiamo in esame la gamemode Capture the Flag. Una mappa per questa gamemode deve sostanzialmente definire gli spawnpoints dei giocatori e la posizione delle bandiere, ed eventualmente la presenza di altri oggetti come i veicoli o i pickups. Un file .map molto semplificato apparirebbe così:

<map>
    <spawnpoint id="spawnpoint1" posX="1959.5487060547" posY="-1714.4613037109" posZ="877.25219726563" rot="63.350006103516" model="0"/>
    <pickup id="Armor 1" posX="1911.083984375" posY="-1658.8798828125" posZ="885.40216064453" type="armor" health="50" respawn="60000"/>
    <flag posX="1959.5487060547" posY="-1714.4613037109" posZ="877.25219726563" team="blue" />
    ...
</map>

Qui possiamo vedere due elementi di MTA: uno spawnpoint ed un pickup. Ancora più importante, questa mappa ha un nodo chiamato flag che definisce la posizione ed il colore della bandiera. Gli spawnpoints ed i pickups possono essere gestiti da risorse esterne, ma gli elementi personalizzati devono essere processati dalle gamemodes.

Insomma, vogliamo che i giocatori possano creare le proprie mappe senza aver bisogno dello script LUA.

Esempio: come ottenere le informazioni dal file .map

Come detto prima, la tua mode ha bisogno di ritrovare gli elementi personalizzati definiti in un file .map e processarli. Questo è abbastanza facile, come è dimostrato qui sotto.

-- crea una tabella con tutti gli elementi di tipo flag
local flagElements = getElementsByType ( "flag" )
-- crea un ciclo per ogni elemento che abbiamo trovato
for key, value in pairs(flagElements) do
	-- ottiene le info di quell'elemento
	local posX = getElementData ( value, "posX" )
	local posY = getElementData ( value, "posY" )
	local posZ = getElementData ( value, "posZ" )
	local team = getElementData ( value, "team" )
	-- crea un oggetto a seconda della posizione della bandiera (flag)
	createObject ( 1337, posX, posY, posZ )
	-- scrive in chat il team per cui abbiamo creato una base
	outputChatBox ( "Base creata per il team ".. team .."!" )
end

La funzione getElementsByType restituisce una tabella contenente tutti gli elementi di un dato tipo (il tipo corrisponde al nome del nodo [nell'esempio "flag"] nel file .map). Questo funziona sia per i tipi personalizzati sia per quelli di default di MTA (come "vehicle" o "player"). getElementData è usato per ritrovare gli attributi impostati nell'XML. In questi semplice esempio, un oggetto è creato nella posizione della bandiera e un messaggio viene inviato in cheatbox. In realtà, bisognerà fare ovviamente del lavoro in più durante il caricamento della mappa, come in questo caso creare delle forme di collisione per determinare quando un player cattura la bandiera.

Il map manager

Dopo aver letto la sezione di sopra dovrebbe essere chiaro che una gamemode consiste di due parti:

  • La resource della gamemode, che resta sempre uguale
  • Molte resource delle mappe, che forniscono alla gamemode informazioni legate alla mappa

Ora, al posto di scrivere uno script che carichi la mappa per ogni gamemode, il Map manager fornisce funzioni per caricare le gamemodes e le mappe. Semplicemente, quando digiti il comando giusto (per esempio 'gamemode ctf ctf-italy') avvierà le due resource 'ctf' e 'ctf-italy', chiamando anche l'evento 'onGamemodeMapStart' per avvertire la resource 'ctf' che una mappa è stata caricata. La resource 'ctf' può quindi accedere alle informazioni contenute in 'ctf-italy' e iniziare a spawnare i players, etc.

Come usare il map manager

Per usare questa feature, la tua gamemode deve essere taggata di conseguenza. In maniera più specifica, dovremo impostare, nel meta.xml, l'attributo "type" della tag <info> a "gamemode". Inoltre, possiamo impostare per l'attributo "name" un nome più 'familiare' (come "Capture the flag") che verrà mostrato nel server browser al posto del nome della resource.

<!-- meta.xml della gamemode "cowcatapult" -->
<meta>
    <info type="gamemode" name="Cow catapulting 2.0"/>
</meta>

Se la tua gamemode dovrà caricare mappe personalizzate, dovranno essere presenti gli event handlers per

  • onGamemodeMapStart
  • onGamemodeMapStop (se necessario)

Questi eventi vengono chiamati quando una mappa per la tua gamemode viene avviata o chiusa, e passano la reource della mappa come paramentro. All'interno della funzione legata a questi eventi potrai ottenere tutte le informazioni che ti servono dai file della mappa.

Esempio

function startCtfMap( startedMap ) -- startedMap è la mappa appena avviata
    local mapRoot = getResourceRootElement( startedMap )        -- ottiene il nodo di root della mappa avviata
    local flagElements = getElementsByType ( "flag" , mapRoot ) -- ottiene tutte le bandiere della mappa e le salva in una tabella
    -- continua a caricare informazioni come sopra

    -- spawna i players etc.

end

addEventHandler("onGamemodeMapStart", getRootElement(), startCtfMap)

Rendere le mappe compatibili

Le mappe sono resource separate. Questo è stato fatto perché creare una nuova mappa non implichi nessuna modifica nella gamemode, e viceversa.

Per rendere una mappa compatibile con la tua gamemode, apri il suo file meta.xml e modificalo così: l'attributo "type" dev'essere settato a "map", e l'attributo"gamemodes" dev'essere una lista senza spazi, in cui gli elementi sono i nomi delle gamemode con cui la mappa funziona, separati da virgole.

<!--meta.xml della mappa-->
<meta>
    <info type="map" gamemodes="cowcatapult,assault,tdm"/>
</meta>

Quando tutto è pronto, gli admin potranno usare questi due comandi per avviare/fermare le gamemode:

  • /gamemode nomeGamemode [nomeMappa] (nomeMappa è opzionale: puoi selezionare una mappa con cui iniziare la gamemode, di default questo parametro è vuoto)
  • /changemap nomeMappa [nomeGamemode] (nomeGamemode è opzionale: seleziona la gamemode da avviare con la mappa, di default è quella corrente)

Il Map manager esporta qualche altra funzione che in questo esempio non serve, ma che potrebbe essere utile.

Cos'altro dovresti fare

Ci sono alcune altre risorse che dovresti usare nel creare la tua mode, o almeno conoscere.

Helpmanager

L'Help manager dovrebbe essere l'interfaccia standard per i giocatori che hanno bisogno di aiuto. Se usi l'Help manager per mostrare il testo d'aiuto della tua mode, tutti i giocatori che lo hanno già usato in altre gamemodes sapranno immediatamente come usufruirne. Esso mostra anche un aiuto per le diverse risorse attive divise per schede in una sola finestra, se necessario.

Ci sono due modi per usare l'Help manager, in breve:

  • Mostrare un semplice testo che spieghi come usare la gamemode.
  • Mostrare informazioni più complesse sotto forma di GUI.

Leggi la pagina dell'Help manager per dettagli su come farlo.

Scoreboard

La Scoreboard mostra i giocatori e i team attualmente in gioco. Puoi aggiungere delle colonne personalizzate per dare informazioni aggiuntive sulla tua mappa. Per esempio la colonna punti nella gamemode capture the flag può rappresentare il numero di catture della bandiera o il numero di kill di un giocatore.

Map cycler

Il Map Cycler controlla quali mappe e gamemodes sono in gioco sul server. Puoi specificare ad esempio quante volte una gamemode verrà rigiocata prima che si passi alla prossima; per far ciò, devi dire al map cycler quando la tua gamemode finisce (ad es. quando finisce un round).