HowToAddMapsServerStendhal: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
imported>Kymara
Adding Portals: new section make it pretty later
imported>Kymara
made prettier
Line 109: Line 109:
Portals are created by adding a entries to your zone in '''zones.xml'''. For example creating a portal to an internal building entrance which is at 1 12 inside the building (and the outer entrance to go in is at 10 15) might look like:
Portals are created by adding a entries to your zone in '''zones.xml'''. For example creating a portal to an internal building entrance which is at 1 12 inside the building (and the outer entrance to go in is at 10 15) might look like:


<source lang="xml">
<pre>
<zone name="int_myarea_mylocation" file="interiors/myarea/mylocation.tmx">
<zone name="int_myarea_mylocation" file="interiors/myarea/mylocation.tmx">
<portal x="1" y="12" ref="entrance">
<portal x="1" y="12" ref="entrance">
Line 121: Line 121:
</portal>
</portal>
</zone>
</zone>
</pre>
</source>


The '''ref''' attribute of a portal should be a name unique to the zone it is in (and meaningful). This value has a corresponding reference via the '''<destination>''' ref name. You are responsible for correctly assigning the ref names of each portal.
The '''ref''' attribute of a portal should be a name unique to the zone it is in (and meaningful). This value has a corresponding reference via the '''<destination>''' ref name. You are responsible for correctly assigning the ref names of each portal.
Line 127: Line 127:
A one way portal is a portal that only exists as endpoint, so none can use the portal to move back to the origin. For one way portals, there is no '''<destination>''' sub-element, as they don't go anywhere. Also, you need to provide a non-default implementation:
A one way portal is a portal that only exists as endpoint, so none can use the portal to move back to the origin. For one way portals, there is no '''<destination>''' sub-element, as they don't go anywhere. Also, you need to provide a non-default implementation:


<source lang="xml">
<pre>
<portal x="11" y="44" ref="my_exit">
<portal x="11" y="44" ref="my_exit">
<implementation class-name="games.stendhal.server.entity.mapstuff.portal.OneWayPortalDestination"/>
<implementation class-name="games.stendhal.server.entity.mapstuff.portal.OneWayPortalDestination"/>
</portal>
</portal>
</pre>
</source>


The House door portal is a special type of portal that automatically creates all the portals and areas needed to add a house to that zone with its entrance on point where the portal is.
The House door portal is a special type of portal that automatically creates all the portals and areas needed to add a house to that zone with its entrance on point where the portal is.
Line 145: Line 145:
Implement them like this:
Implement them like this:


<source lang="xml">
<portal x="64" y="117" ref="entrance">
<portal x="64" y="117" ref="entrance">
<destination zone="-1_semos_chasm_n" ref="exit" />
<destination zone="-1_semos_chasm_n" ref="exit" />
Line 153: Line 154:
</implementation>
</implementation>
</portal>
</portal>
</source>


You can use NotConditions:
You can use NotConditions:


<source lang="xml">
<portal x="65" y="13" ref="entrance">
<portal x="65" y="13" ref="entrance">
<destination zone="-1_semos_chasm_w" ref="exit" />
<destination zone="-1_semos_chasm_w" ref="exit" />
Line 163: Line 166:
</implementation>
</implementation>
</portal>
</portal>
</source>


You can do more than one action by using MultipleActions and list the actions for it, and combine Conditions with an AndCondition, listing the conditions for it.
You can do more than one action by using MultipleActions and list the actions for it, and combine Conditions with an AndCondition, listing the conditions for it.
The syntax is slightly different than with NPCs, please note these extra [ ] surrounding the list. This is due to a bug in groovy.
The syntax is slightly different than with NPCs, please note these extra [ ] surrounding the list. This is due to a bug in groovy.


<source lang="xml">
<portal x="37" y="16" ref="example1">
<portal x="37" y="16" ref="example1">
<destination zone="int_semos_zone" ref="choice_floor_1" />
<destination zone="int_semos_zone" ref="choice_floor_1" />
Line 174: Line 179:
</implementation>
</implementation>
</portal>
</portal>
</source>



The destination settings and references are all as normal. You can still set other attributes like a reject message and hidden from minimap, as in some of the examples above.
The destination settings and references are all as normal. You can still set other attributes like a reject message and hidden from minimap, as in some of the examples above.