Gnome - Successes

From CoffeeMud Wiki
Revision as of 18:45, 27 October 2014 by Bozimmerman (talk | contribs) (Created page with ' Allupdated to refelct version 5.1.5 =Keeping my Java Seperate= When I started coding I had a number of problems getting my custom java to work so I thought it might be worth do…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Allupdated to refelct version 5.1.5

Keeping my Java Seperate

When I started coding I had a number of problems getting my custom java to work so I thought it might be worth documenting what I did to get things functioning.

    • Solution

I keep all of my java in a seperate folder, in fact the java files that I edit are outside of the coffee mud structure and I use a batch file to copy them into the structure and compile them, the following is the batch file I use.

  c:\windows\system32\xcopy "C:\temp\Coffee_MUD\CoffeeMud(Custom)" "C:\temp\Coffee_MUD  CoffeeMud" /k /s /f /y /i /r

  SET Java_Home=C:\Sun\J2EE\jdk
  set CLASSPATH=.;%Java_Home%\lib\dt.jar;%Java_Home%\lib\tools.jar;.\lib\js.jar;.\lib\jzlib.jar
  SET JAVACPATH=%Java_Home%\bin\javac -g -nowarn -deprecation

  %JAVACPATH% -g -deprecation Custom/Abilities/Properties/*.java
  %JAVACPATH% -g -deprecation Custom/Behaviors/*.java
  %JAVACPATH% -g -deprecation Custom/CharClasses/*.java
  %JAVACPATH% -g -deprecation Custom/Commands/*.java
  %JAVACPATH% -g -deprecation Custom/Items/Basic/*.java
  %JAVACPATH% -g -deprecation Custom/Races/*.java
  %JAVACPATH% -g -deprecation Custom/Commands/*.java

For reference, under the "C:\temp\CoffeeMud(Custom)" folder I have a folder called Custom plus under that I have seperate sub folders for the Behaviours, CharClassess and Races, I will add others as need. I also have a folder called resources with associated help and text sub folders for the help files etc. that need to go into the mirror areas inthe main coffeemud structure.

The next problem I had was the headers of the Java files, the instructions said that I should not "package" the files but when I took the package line out I got all sorts of erros and when I left it in, the files could not be loaded. I solved this by replacing the "Package" command with an import commant as the following headers from a race indicate.

Custom Race file header

  import com.planet_ink.coffee_mud.core.interfaces.*;
  import com.planet_ink.coffee_mud.core.*;
  import com.planet_ink.coffee_mud.Abilities.interfaces.*;
  import com.planet_ink.coffee_mud.Areas.interfaces.*;
  import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
  import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
  import com.planet_ink.coffee_mud.Commands.interfaces.*;
  import com.planet_ink.coffee_mud.Common.interfaces.*;
  import com.planet_ink.coffee_mud.Exits.interfaces.*;
  import com.planet_ink.coffee_mud.Items.interfaces.*;
  import com.planet_ink.coffee_mud.Locales.interfaces.*;
  import com.planet_ink.coffee_mud.MOBS.interfaces.*;
  import com.planet_ink.coffee_mud.Races.interfaces.*;
  import com.planet_ink.coffee_mud.Races.*;

  import java.util.*;

I do not know whether this is the correct way to do things but it works.


The goblin class race I am working on is intended to be relatively week and thus I have used statements like those in the file to modify the stats e.g.


This is meant to reduce the normal maximum strength by 2 and the rolled strength by 3, initially I though this was working but a couple of issues indicate it is not i.e.

1) the totals of the stats when creating a character is incorrect (seebelow), still totalling the default 70 and 108.

  Your current stats are:
  Strength : 8 /16
  Intelligence : 13/16
  Dexterity : 10/16
  Wisdom : 5 /16
  Constitution : 9 /17
  Charisma : 6 /14
  TOTAL POINTS : 70/108

2) When as an archon I do a Modify user charName the listing would show the unadjusted stats (e.g. strengh would be 11 rather than 8) - see following extract.

  5. Race: 'GoblinPC'.
  6. Class: 'Goblin_base_class(1) '.
  7. Stats: S:11 I:16 D:13 C:11 CH:11 W:14

3) When a comparison is done in the classes to see if the character has adequate stats, the comparison is done on the unadjusted stat (i.e. 11 strength rather than the 8).

Should I be using a call using the setBaseStats method instead of setStats and does this mean that the other races that have modified stats are also incorrect ?

    • Solution (Partial)

The following is the the responce from Bo

You are correct -- regardless of the racial settings, your characters stats will still reach the total -- this is to "even the playing field" regardless of the race chosen.

You are also correct that the baseCharStats() is the object to modify. charStats() is the players stats after EVERYTHING has had a chance to modify it, including temporary effects.

Regarding Benny's comment -- I wondered that at first two, but then I remembered the original D&D game, where Elves were both a race and a class, and ditto for dwarves and halflings. I imagine you are doing something similar.

Sub-class Level Entry Test

I have a working base goblin class which all goblins join (although i need to stop them joining other classes at present). I have a number of other sub classes (Shaman, Witch Doctor and Wolf Rider) of the main goblin class that the goblins can then join.

Firstly, what I want to do is set one of the etry conditions of the sub class to that being the level the goblin is in the base goblin class (i.e. goblin must be 2nd level in the base goblin class to then join the Shaman or Witch doctor class, or 4th level to join the wolf rider sub class).

Secondly, once a goblin has joined a sub class, they are then not allowed to change again.

For the first of the above, I have looked thought the routine and found the getClassLevel and looked at how this is used in the mage class to allocate skills to mob mages (i.e. "int level=mob.charStats().getClassLevel(this);"), but I need a bit of a pointer on how to use it for a player and reference the top level class. For the second, I am assuming that in each of my classes (main class and sub classes) I need to put a check in for the other classes but I do not know what call to make.

    • Solution

This needs to be read in conjunction with the question on stats as it needs to take into account the difference between CharStat and BaseStat. The following is from my Goblin Witch Doctor character class.

  public String statQualifications(){return "Intelligence 15+";}
  public boolean qualifiesForThisClass(MOB mob, boolean quiet)
        mob.tell("You need at least a 15 Intelligence to become a Goblin Witch Doctor.");
      return false;
        mob.tell("You are already multiclassed.");
      return false;
        mob.tell("You must be 2nd level to join this class.");
      return false;
    return super.qualifiesForThisClass(mob,quiet);

Class Level Naming

This is likely to be a silly quesation, but I have not been able to work out how to use the class name to level functionality. I am still on the coding of my goblins, and I wish to put some names in at various leves (i.e. Minor Goblin, Mogar, Kumar, Katar at say level 0, 4,6,8). I have my basic character class coded with "Minor Goblin" as the default "name()" and am looking to use the documented constuct:

  public String name(int classLevel){return name();}

The Programming Guide says to "simply check the classLevel and return a diferent sting". I figure that I substitute the name() part for the string I want (e.g. "Mogar") but I am not sure how to check the level, do I need to use several if constucts or is there a much simpler way.

    • Solution

The following is the code now in my Goblin character class.

  public String name(){return "Normal Goblin";}
  public String name(int classLevel) {
  if(classLevel<5) return "Normal Goblin";
  if(classLevel<7) return "Mogar";
  if(classLevel<9) return "Kumar";
  if(classLevel<11) return "Katar";
  else return "tba";}

Incorrect Race Description

Following crating a Goblin race, in the web page description of the Goblin race is a description as below (also appears during character creation), I have not entered this info and suspect that I am picking up some Goblin MOD settings. How do I change this?

  Ability : Goblin Drip
  Parameters :
  Example :
  Lowers con a little, and strength by a LOT. Does minute damage
    • Solution

There was two causes to this, firstly I had used the name of a race that already existed, and secondly I needed to creat a proper help file entry. I thus change the race name to "GoblinPC" and added help file called "Gnomes_help.ini" in the "\CoffeeMud\resources\help" folder.

Shape shift

For my Goblin Wolf Riders I want to give them them the druid "shape shift" ability but limit it so that they are automatically allocated the wolf cub choice. I have created the following line the character class and need to test it. Failing this I may have to write my own "shape shift" ability.


I am also looking to do something sililar with the "Ranger Enemy" ability so that I can make Elves and Dwarfs enermis of the Goblins.

    • Solution

Rather than using the parameter "K-9", the Shape Shift ability is expecting a number, the numbers are as follows:

No Form No Form
0 Rodent 1 Feline
2 K-9 3 Bird
4 Snake 5 Bear
6 Insect 7 Monkey
8 Bovine

Thus my line of code needs to read as follows:


Lots of "n" Appearing in Room Descriptions

I have an intresting problem, my room descriptions are aquiring "n" at the begining of paragraphs. The following is an example room description that has been affected.

  "Welcome to Gnomes MUDdy Puddle.  This is simply a test MUD while I
  get the hang of designing rooms and develop a Goblin dungeon.  You are
  welcome to use this area to learn about MUD's yourself.  If you are
  totally new to MUD?s
  look out for the Training area.
  nnnYou do need to be aware that this room contains useful supplies for
  the beginner, plus danger in the form of Skeleton.

In this case you can see I have "nnn" appearing in several places. The appearence of the n's seems to be related to room editing but may also be linked to restarting the mud. Does any one have any ideas as to what is going on ?

    • Solution

Solved by Steve Tindle

I found the solution!

It is a bug in the FakeDB Backend.

See: Lines 198 to 215.

In function getRecord, it finds \\ and \n in the data from the database field. What happens is that, although it reads ahead another char ( '\' to 'n' ), it does not add one to the file location variable ('sub') to skip the next character ('n'). This causes the following to be translated:

In DB: This is a test room with\nlinebreaks and such.\n\nAnother line.

Should be: This is a test room with linebreaks and such.

Another line.

Mistranslated as: This is a test room with nlinebreaks and such n

nAnother line.

The same problem exists with '\\'. Bo, could you confirm my findings? The unified diff is below. Changeset on my copy is at

For others, can be downloaded from: Extract the ZIP file and copy everything under vendor/coffeemud/4.7.12-np1/com/planet_ink/fakedb to the com/planet_ink/fakedb directory under your CoffeeMUD installation. The classes have already been recompiled.

Also resolved in version 4.7.13