HowToAddMapsServerStendhal: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
imported>Kymara fix one way portal code - it's now in mapstuff/portal not just portal |
imported>Kymara →Adding Portals: new section make it pretty later |
||
| Line 136: | Line 136: | ||
Finally the stairs portals also automate the creation of stairs between two areas. It is very important that the portals ( both ends ) are exactly on the same position but on different levels. Position means absolute position. Also, due to current implementation, be careful '''not''' to place omni-directional stair portals at the same exact location between adjacent levels if they're not meant to be linked, as they might inadvertantly be linked. Directional stairs are safer and only link with the level they go toward. |
Finally the stairs portals also automate the creation of stairs between two areas. It is very important that the portals ( both ends ) are exactly on the same position but on different levels. Position means absolute position. Also, due to current implementation, be careful '''not''' to place omni-directional stair portals at the same exact location between adjacent levels if they're not meant to be linked, as they might inadvertantly be linked. Directional stairs are safer and only link with the level they go toward. |
||
=== Condition and Action Portals === |
|||
Portals are being refactored to allow combinations of conditions and actions in a very similar way to NPCs. In fact, you can use the same conditions and actions. |
|||
The full list is found in http://arianne.cvs.sourceforge.net/arianne/stendhal/src/games/stendhal/server/entity/npc/action and http://arianne.cvs.sourceforge.net/arianne/stendhal/src/games/stendhal/server/entity/npc/condition |
|||
A portal which you can put a Condition and / or action to is called a ConditionAndActionPortal. You don't have to set both a condition and an action. |
|||
Implement them like this: |
|||
<portal x="64" y="117" ref="entrance"> |
|||
<destination zone="-1_semos_chasm_n" ref="exit" /> |
|||
<implementation class-name="games.stendhal.server.entity.mapstuff.portal.ConditionAndActionPortal"> |
|||
<parameter name="condition">new PlayerHasItemWithHimCondition("special magical thingy", 10)</parameter> |
|||
<parameter name="action">new DropItemAction("special magical thingy", 10)</parameter> |
|||
<parameter name="rejected">You need 10 of the special magical thingies.</parameter> |
|||
</implementation> |
|||
</portal> |
|||
You can use NotConditions: |
|||
<portal x="65" y="13" ref="entrance"> |
|||
<destination zone="-1_semos_chasm_w" ref="exit" /> |
|||
<implementation class-name="games.stendhal.server.entity.mapstuff.portal.ConditionAndActionPortal"> |
|||
<parameter name="condition">new NotCondition(new PlayerHasPetOrSheepCondition())</parameter> |
|||
<parameter name="rejected">To get into the evil chasm you must bring a sacrificial animal</parameter> |
|||
</implementation> |
|||
</portal> |
|||
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. |
|||
<portal x="37" y="16" ref="example1"> |
|||
<destination zone="int_semos_zone" ref="choice_floor_1" /> |
|||
<implementation class-name="games.stendhal.server.entity.mapstuff.portal.ConditionAndActionPortal"> |
|||
<parameter name="condition">new AndCondition([new NotCondition(new PlayerHasItemWithHimCondition("claymore")) , new LevelLessThanCondition(100)])</parameter> |
|||
<parameter name="action">new MultipleActions([new IncreaseXPAction(100), new EquipItemAction("claymore")])</parameter> |
|||
</implementation> |
|||
</portal> |
|||
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. |
|||
== Adding NPCs == |
== Adding NPCs == |
||