Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Map Spawn, NPC Maler, Exp Bar

Newbie Spellweaver
Joined
Nov 29, 2012
Messages
11
Reaction score
0
Hello,my name is Maxi, i am a new member of ragezone forum, and i am from argentina, glat to you met you all. :D

A few days ago i discovered this site, and love it, because i am a big fan of pokemon and i very interesting in upload a server of pokenet for my and my friends :D

I have installed the server guide, thanks of the wonderful guide of DefaulT, and i have read all the topics of the forum, yes very vicious i know, but was very fun ;)

but now, Sorry to bother you all, but i have 3 requesting and i hope you can help me;

1) When i edit a map or the spawn rate of a pokemon, i must edit, the client map or the sever map or both?

2) I saw the post, of Default where he posted a NPC maker, but the links are offline, can someone reuploap in another server, because, i like to create many npc on spanish.

3) I am very interesting in create a exp bar for pokemon experience like the existing in pokemonium, is this in the server side? is hard? can anibody help to code it?

Sorry to bother you, but i am very happy with the server and the forum, and i would like to create a fun sever for my an my brother and friends.

For all of this, thanks in advance, i hope i can help you too anytime :thumbup1:

Greetings

Maxi
 
Joined
Jul 29, 2012
Messages
527
Reaction score
71
Hey there, welcome to RaGEZONE!
1)I think you must edit both, I'm not sure exactly
2)I'll look into it, read my edits on this post
3)Will be both server and client, you'd have to edit the interface(which can get annoying) for battles, or wherever you wish to put the exp bar, then a few calculations to find % and then do the loading bar stuff to fill in the %.

--edit
2)
No need for any of the links to work, the links he has provided are only images to prove what it does.
You'll only need this part of the tutorial:
In Server>org.pokenet.server.backend.entity>NonPlayChar.java

Your going to find something like this:
Code:
/* If this NPC is a sprite selection npc */
			if(m_name.equalsIgnoreCase("Spriter")) {
				p.setSpriting(true);
				TcpProtocolHandler.writeMessage(p.getTcpSession(), new SpriteSelectMessage());
				return;
			}

Essentially it checks, if the name equals "Spriter" and if it does, then it knows to show the SpriteSelectMessage.

The sprite select message code is located at Client>org.pokenet.client.ui.frames>SpriteChooserDialog.java

and looks something like this;
Code:
package org.pokenet.client.ui.frames;

import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

import mdes.slick.sui.Button;
import mdes.slick.sui.Frame;
import mdes.slick.sui.Label;
import mdes.slick.sui.event.ActionEvent;
import mdes.slick.sui.event.ActionListener;

import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.gui.GUIContext;
import org.pokenet.client.GameClient;
import org.pokenet.client.backend.FileLoader;
import org.pokenet.client.ui.base.ConfirmationDialog;
import org.pokenet.client.ui.base.ListBox;

public class SpriteChooserDialog extends Frame {
	protected ListBox m_spriteList;
	protected Label m_spriteDisplay;
	protected String m_mustLoadSprite;
	private List<String> m_sprites;
	private InputStream m_stream;
	private String m_respath;

	public SpriteChooserDialog() {
		getContentPane().setX(getContentPane().getX() - 1);
		getContentPane().setY(getContentPane().getY() + 1);
		m_sprites = new ArrayList<String>();
		m_respath = System.getProperty("res.path");
		if(m_respath==null)
			m_respath="";
		for (int i = 1; i <= 218; i++) {
			m_sprites.add(String.valueOf(i));
		}
		/*
		 * Handle blocked sprites
		 */
		
		try {
			InputStream in;
			in = FileLoader.loadFile(m_respath+"res/characters/sprites.txt");
			Scanner s = new Scanner(in);
			while(s.hasNextLine()) {
				m_sprites.remove(s.nextLine());
			}
			s.close();
			
			m_spriteDisplay = new Label();
			m_spriteDisplay.setSize(124, 204);
			m_spriteDisplay.setLocation(105, 20);
			getContentPane().add(m_spriteDisplay);

			m_spriteList = new ListBox(m_sprites, false) {
				@Override
				protected void itemClicked(String itemName, int idx) {
					super.itemClicked(itemName, idx);
					m_mustLoadSprite = m_respath+"res/characters/" + itemName + ".png";
				}
			};
			m_spriteList.setSize(105, 317);
			getContentPane().add(m_spriteList);

			setTitle("Please choose your character..");
			getCloseButton().setVisible(false);
			setSize(265, 340);
			setResizable(false);
			setDraggable(false);
			setVisible(true);
			initUse();
		} catch (FileNotFoundException e) {
			//No sprites to handle. 
		}
		
	}

	public void initUse() {
		final SpriteChooserDialog thisDialog = this;

		Button use = new Button("Use new sprite!");
		use.pack();
		use.setLocation(130, 245);
		getContentPane().add(use);

		Button cancel = new Button("Cancel");
		cancel.pack();
		cancel.setLocation(130, 280);
		getContentPane().add(cancel);

		cancel.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				GameClient.getInstance().getDisplay().remove(thisDialog);
			}
		});

		use.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				GameClient.getInstance().getDisplay().remove(thisDialog);

				final ConfirmationDialog confirm = new ConfirmationDialog("Are you sure you want to change sprites?\nIt'll cost you P500!");
				confirm.addYesListener(new ActionListener() {
					public void actionPerformed(ActionEvent e) {
						confirm.setVisible(false);
						GameClient.getInstance().getDisplay().remove(confirm);

						GameClient.getInstance().getPacketGenerator().writeTcpMessage(
								"S" + m_spriteList.getSelectedName());
					}
				});
				confirm.addNoListener(new ActionListener() {
					public void actionPerformed(ActionEvent e) {
						confirm.setVisible(false);
						GameClient.getInstance().getDisplay().remove(confirm);
					}
				});

				GameClient.getInstance().getDisplay().add(confirm);
			}
		});
	}

	public int getChoice() {
		return m_spriteList.getSelectedIndex();
	}

	@Override
	public void render(GUIContext container, Graphics g) {
		super.render(container, g);
		if (m_mustLoadSprite != null) {
			try {
				m_stream = FileLoader.loadFile(m_mustLoadSprite);
				m_spriteDisplay.setImage(new Image(m_stream, m_mustLoadSprite, false));
			} catch (SlickException e) {
				e.printStackTrace();
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
			m_mustLoadSprite = null;
		}
	}
}

Here you can change the way the gui looks and the text that will be displayed on the gui.

If you look at Server>org.pokenet.server.network>TcpProtocalHandler.java

You will see;
Code:
else if(p.isSpriting()) {
					//Sprite changing
					int sprite = Integer.parseInt(message.substring(1));
					/* Ensure the user buys a visible sprite */
					if(sprite > 0 && !GameServer.getServiceManager().
							getSpriteList().getUnbuyableSprites().contains(sprite)) {
						if(p.getMoney() >= 500) {
							p.setMoney(p.getMoney() - 500);
							p.updateClientMoney();
							p.setSprite(sprite);
							p.setSpriting(false);
						}
					}
				}

Here u can change how much he will charge the user to change the sprite.


Now that the mechanics are explained, lets actually add this npc!

So open the map editor to the map that you want to add it to, im just going to use the Pallet town since its the easiest, now choose a spot you want to put the npc, hover over the spot and get the coordinates for it which are in the bottom left corner of the map editor.

Im going to use coordinates 9,9

Now open your Server>Res>Npc folder, and open the text file coordinating to your map. (mine was 3.1 for pallet town.)

In the first line of the text file add something like this:
Code:
[npc]
Spriter
down
164
9
9
NULL
0
-1
6
false
false
false
[/npc]

However, change the numbers 9 9 to be your coordinates you chose on your map. and 164 to what ever you want him to look like.

There you go. Easy peasy, enjoy!
 
Back
Top