HowToAddMapsServerStendhal: Difference between revisions
Content deleted Content added
imported>Oslsachem |
imported>Chad3f |
||
Line 20:
= Create a map file=
If you need to do custom zone configuration that is not possible via the "zones.xml" file (such as adding NPC's), for each zone, create one or more new Java source file(s) at '''src/games/stendhal/server/maps/<area>/<location>/<level>_<entity>.java'''. The directory path after '''maps/''' would be the same as your '''.tmx''' file uses. Ideally this would be one file per independant entity created (so they can be enabled/diabled separately).
Open the file and make sure that it looks like this:
<pre>
package games.stendhal.server.maps.myarea.mylocation;
import
import games.stendhal.server.StendhalRPZone;
import games.stendhal.server.maps.ZoneConfigurator;
public class
/**
* Configure a zone.
{▼
* @param zone The zone to be configured.
* @param attributes Configuration attributes.
*/
public void configureZone(StendhalRPZone zone, Map<String, String> attributes) {
// Add/configure entity to "zone", using optional configuration "attributes"
}
</pre>
To enable a zone in the server, edit the file "data/conf/zones.xml" and add an entry (in the appropriete top-down/left-right/level order), giving it the zone name and converted map filename to use:
<pre>
<zone name="int_myarea_mylocation" file="int_myarea_mylocation.xstend"/>
</pre>
If you have custom configuration code, add appropriete "<configurator>" entries in your "<zone>" element, using the fully qualified package/class name of your java classes:
<pre>
<zone name="int_myarea_mylocation" file="int_myarea_mylocation.xstend">
<configurator class-name="games.stendhal.server.maps.myarea.mylocation.IL0_MyZone"/>
</zone>
</pre>
Now once it is added, test the result by starting server.
| |||