Jump to content
wildking72

Using Dementhium [639]

Recommended Posts

[CENTER][B][SIZE=2]Sources[/SIZE][/B]
[URL="http://www.mediafire.com/?u3v647ccx2dduvy"]Eclipse Server[/URL]
[URL="http://www.mediafire.com/?xwhr99iyj52sfgo"]Eclipse Client[/URL]

[URL="http://www.mediafire.com/?q4mwda0naxec3hq"]Dementhium Server[/URL]
[URL="http://www.mediafire.com/?zlbom2rqxv94u95"]Dementhium Client[/URL]

[B]Compiling[/B]

[B]New jdks[/B]
[URL="http://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exe"]jdk 32bit[/URL]
[URL="http://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exe"]jdk 64bit[/URL]

Add this into your compiler.bat in your Server. This is because just using *.java will not work anymore or never did.
[CODE]@echo off
echo Compiling
"C:/Program Files/Java/jdk1.7.#/bin/javac.exe" -d bin -cp lib/*; -sourcepath src src/org/dementhium/*.java src/org/dementhium/net/*.java src/org/dementhium/content/misc/*.java src/org/dementhium/model/*.java src/org/dementhium/model/player/*.java
echo Complete
pause[/CODE]



[B]Changing Client IP[/B]
Change the IP in the Run.bat to 127.0.0.1 or to your host ip, or go into RunClient.java and search for an ip

[B]Commands[/B]
src/org/dementhium/content

[CENTER]How to give it a teleport
[CODE]player.teleport(XX, YY, ZZ);[/CODE]

XX = X axiz
YY = Y axis
ZZ = Height

How to make it send a message
[CODE]player.sendMessage("Message here");[/CODE]

How to make it give an item
[CODE]player.getInventory().addItem(ID, AMOUNT);[/CODE]

How to make it for only a certain player
[CODE]if (player.getUsername().equalsIgnoreCase("USERNAME"))[/CODE]

How to make it give experience
[CODE]player.getSkills().addExperience(Skills.SKILLNAME, EXP);[/CODE]

SKILLNAME = This must be in caps
EXP = experience amount you want it to give

How to give it a requirement
[CODE]if (player.getSkills().getLevel(Skills.SKILLNAME) >= LVL) {[/CODE]

LVL = Skill level needed

How to give it an animation
[CODE]player.animate(Animation.create(645));[/CODE]

Where to add it under if you want it for a moderator
[CODE]public static void modCommands(final Player player, String[] command) {[/CODE]

Where to add it under if you want it for an admin
[CODE]public static void adminCommands(final Player player, String[] command) {[/CODE]

[B]Player Rights[/B]
0 = Donator
1 = Moderator
2 = Admin
Anything after that = Hidden Moderator/Admin (No crown)

[B]Promoting[/B]
Go to src/org/dementhium/net

Open ActionSender.java

Search for
[CODE]player.getAppearance().resetAppearence();[/CODE]

You should see something like this
[CODE]if (player.getUsername().equalsIgnoreCase(""))
player.getDefinition().setRights(2);[/CODE]

In between the quotation marks add your username

[B]Changing Starter[/B]
Go to src/org/dementhium/content

Open Cutscene.java

Search for
[CODE]if(!player.hasStarter()){[/CODE]

You will see stuff like this
[CODE]player.getInventory().getContainer().add(new Item(ID, AMOUNT));[/CODE]

[B]Change Welcome Message[/B]
Go to src/org/dementhium/net

Open ActionSender.java

Search for
[CODE]sendMessage(player, "[/CODE]

You will find
[CODE]sendMessage(player, "Welcome to");[/CODE]

Do whatever there

[B]Removing/Adding Objects[/B]
Go to src/org/dementhium/model/map

Open ObjectManager.java

Search for
[CODE]public static void init() {[/CODE]

You will see some object codes already there (maybe)

This is how to add one
[CODE]ObjectManager.addCustomObject(ID, XX, YY, ZZ, type, DIR, false);[/CODE]
Keep it false

ID = Object id
XX = X axis
YY = Y axis
ZZ = Height
DIR = Direction it's facing


[B]NPC Spawn[/B]
Go to data/npcs

Open npcspawns.txt

[CODE]ID XX YY ZZ DIR false[/CODE]
You can change false to true if you want it to walk around randomly

[B]NPC Options[/B]
Go to src/org/dementhium/net/packethandlers/NpcOption.java

Make an NPC do something for the first option
Search for
[CODE]private void option1(final Player player, Message in) {[/CODE]

Under that look for
[CODE]switch (id) {[/CODE]

Under there add your npc id as your case (I will give you actions at the bottom of NpcOption place)

Make an npc do something for the second option
Search for
[CODE]private void option2(final Player player, Message packet) {[/CODE]

Under that look for
[CODE]switch (npc.getId()) {[/CODE]

Make an npc do something for the third option
Search for
[CODE]private void option3(final Player player, Message packet) {[/CODE]
Under that look for
[CODE]switch (id) {[/CODE]

Some actions people would usually use under the npc cases

Opening a shop
[CODE]World.getWorld().getShopManager().openShop(player, yourshopid);[/CODE]

Making player teleport (2 types)
[CODE]player.setAttribute("teleportDestination", Position.create(XXXX, YYYY, ZZ));[/CODE]
[CODE]player.teleport(XXXX, YYYY, ZZ);[/CODE]

Make it a right requirement
[CODE]if (player.getRights() == #) {[/CODE]
# = player rights you want it for

Make it a skill requirement (same as commands)

Make it bank Equipment
[CODE]player.getBank().bankEquip();[/CODE]

Make it restore your prayer
[CODE]player.getSkills().restorePray(99);[/CODE]

Make it has inventory space requirements
[CODE]if (player.getInventory().getContainer().getFreeSlots() == ##) {[/CODE]
## = How many free spaces you want the player to have


[B]Changing Home[/B]
Go to src/org/dementhium/model

Open Mob.java

Search for
[CODE]public static final Location DEFAULT[/CODE]

There is your coordinates for home

[B]Dialogue[/B]
Go to src/org/dementhium/content

Open DialogueManager.java

To make an npc start a dialogue search for
[CODE]switch (id) {[/CODE]

Make a case
[CODE]case ####:[/CODE]

#### = Case number

Under the case add a dialogue
[CODE]sendDialogue(player, EMOTION, ID, ##, "Message here");[/CODE]

## = case number it will go to next
id = NPC id
EMOTION = the emotion you want it to use
Here are some emotions
[CODE]REALLY_SAD, SAD, DEPRESSED, WORRIED, SCARED, MEAN_FACE, MEAN_HEAD_BANG, EVIL, WHAT_THE_CRAP, CALM, CALM_TALK, TOUGH, SNOBBY, SNOBBY_HEAD_MOVE, CONFUSED, DRUNK_HAPPY_TIRED, TALKING_ALOT, HAPPY_TALKING, BAD_ASS, THINKING, COOL_YES, LAUGH_EXCITED, SECRELTY_TALKING , REALLY_HAPPY[/CODE]

Example of using the emotion in the case
[CODE]sendDialogue(player, DRUNK_HAPPY_TIRED, id, 22, "Message");[/CODE]

Example of a full case
[CODE] case 586:
sendDialogue(player, TALKING_ALOT, id, 254, "Fancy a gander at me two handers?");
return true;[/CODE]
Use return true; if it is going to another case or return false; if you want it to end there

[video=youtube_share;Emwm_TpUAnM]http://youtu.be/Emwm_TpUAnM[/video]


[B]Easy Portal System[/B]
Go to src/org/dementhium/content/DialogueManager.java

Search for
[CODE]switch (id) {[/CODE]

Under that add
[CODE]case 8019:
sendDialogue(player, HAPPY_TALKING, 8019, 20072, "Where would you like to go?");
return true;[/CODE]

Then search for
[CODE]switch (stage) {[/CODE]

Under that add
[CODE]case 20072:
sendOptionDialogue(player, new int[]{20073, 20074, 20075, 20076}, "Varrock", "Edgeville", "Lumbridge", "Falador");
return true;
case 20073:
player.setAttribute("teleportDestination", Position.create(3087, 3493, 0));
return true;
case 20074:
player.setAttribute("teleportDestination", Position.create(3087, 3493, 0));
return true;
case 20075:
player.setAttribute("teleportDestination", Position.create(3087, 3493, 0));
return true;
case 20076:
player.setAttribute("teleportDestination", Position.create(3087, 3493, 0));
return true;[/CODE]

Now go to data/npcs/npcspawns.txt
and add your npc spawn for 8019
[CODE]8019 XXXX YYYY 0 0 false[/CODE]

I would change false to true if you like seeing portals move around

Note: the portal system makes the portal (npc 8019) give you options where you want to go

You can change the name of the teleports and the coordinates after Position.create

Tell me what I need to add

[COLOR="#FF0000"][B]I will not help anyone if you pm me. Just post your errors on this topic.[/B][/COLOR][/CENTER] Edited by wildking72

Share this post


Link to post
Share on other sites
Nice for beginners, but not needed. This is all common sense. Good job though.

Share this post


Link to post
Share on other sites
When I run the server it loads some stuff but then it stops working and says exception in thread "Main" java.lang.nodeffounderror: org/dementhium/model/map/objectmanager$2

How do I fix this??? please reply. :/

Share this post


Link to post
Share on other sites
The Boolean in npcspawns isn't for attackable, it's for if the npc walks around randomly or not.

Share this post


Link to post
Share on other sites
*removed* Edited by wildking72

Share this post


Link to post
Share on other sites
*removed* Edited by wildking72

Share this post


Link to post
Share on other sites
Uhh... I load client and I changed the ip of run locallhost - copy to 0.0.0.0 and start the actual server then the client it stays at 1% loading

Share this post


Link to post
Share on other sites
Free Rs mems pin 1 moth to anyone that gets this working for me

Share this post


Link to post
Share on other sites
I just posted on help section...
and you have to have the server running all the way before starting the client

Share this post


Link to post
Share on other sites
not bad as it can be helpful to people, i suggest dont delete it due to the effort you put in and that it could be used a lot. thanks!

Share this post


Link to post
Share on other sites

×