-
Notifications
You must be signed in to change notification settings - Fork 42
Adding a feature: Climbing
This is a tutorial on how we could implement a climbing mechanic into RockMUD.
The wish-list for this feature is as follows:
- We need a consistent api to handle all climbing needs.
- Rooms that require climbing can be reached without the skill; however, a 'climb' check needs to be passed. Failure results in a wait state addition (time penalty).
- In one of our example rooms a 'critical failure' (when the player does not have the climb skill) should result in a fall resulting in death.
Lets jump right in.
###Prefance: Obtaining a Climb Skill### At this moment the climb skill is obtained via 'say yes' when in the starting training academy room. You can deconstruct that work to understand how to add a dynamic skill to a game entity -- but basically you just add a skill object to the entities skills array.
Character.addSkill(entity, skillObj);You can build an on-the-fly skill object if you feel confident enough, but the ideal way is to grab a skill from an entity that already has it. So for the sake of completion:
var skillObj = Character.getSkill(trainerMob, 'climb');
Character.addSkill(entity, skillObj);###Goal One: Ensuring we can easily process room-to-room movement with a climb requirement### Luckily this is a pretty easy thing to implement -- we can use the base movement events available to rooms. In this case onEnter and beforeEnter.
NOTE: There are a couple of convenience properties on room objects that enable wait-state and movement increment without the need for scripting. They are waitMod and moveMod respectively.
First lets add a new room to an area. In this example we'll use the Mud School -- midgaard_academy.