This is a follow up to my VirtualServ system. This time, it allows guild members into a closed map or group of maps. You decide!
What this does:
Code:
Creates a guild home for the player automatically. Seriously, it's uber sweet. No more NPC editing for you after this, unless of course you want to throw in functions of your own, which after I'm finished with this project, you most likely won't need to do.
Changelog:
Code:
Version 1.0.0 - Lios. Initial creation
V. 1.0.1 - Lios. Minor bugfix
V. 1.0.2 - Lios. Added Screen Shots
To-Do:
Code:
--+Add functions to the guild home NPC.
How to:
First, create a file in your event server called multiworld.js.
In that file, put the following code:
Code:
/*
* This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License version 3
as published by the Free Software Foundation. You may not use, modify
or distribute this program under any other version of the
GNU Affero General Public License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
-- Odin JavaScript --------------------------------------------------------------------------------
Guild Homes
-- By ---------------------------------------------------------------------------------------------
Lios of Storybox
-- Version Info -----------------------------------------------------------------------------------
1.0 - First Version by Lios
---------------------------------------------------------------------------------------------------
**/
var exitMap;
var minPlayers = 1;
function init() {
instanceId = 1;
}
function setup() {
exitMap = em.getChannelServer().getMapFactory().getMap(910000000); // <exit> to FM
var eim = em.newInstance("GuildHome");
return eim;
}
function playerEntry(eim, player) {
if(em.getInstance("GuildHome" + player.getGuildId()) == null){
var ghm = em.newInstance("GuildHome" + player.getGuildId());
}else{
var ghm = em.getInstance("GuildHome" + player.getGuildId());
}
var map = ghm.getMapInstance(809050015); //You may change this to any map you would like.
player.changeMap(map, map.getPortal(0));
}
function playerDisconnected(eim, player) {
playerExit(eim, player);
}
function playerExit(eim, player) {
eim.unregisterPlayer(player);
player.changeMap(exitMap, exitMap.getPortal(0));
}
// For offline players
function removePlayer(eim, player) {
eim.unregisterPlayer(player);
player.getMap().removePlayer(player);
player.setMap(exitMap);
}
You can find this line:
var map = ghm.getMapInstance(809050015); //You may change this to any map you would like.
And switch out the map ID with any other map you wish. I suggest LMPQ if you don't have it working, or perhaps any of the following ID's:
Code:
920011200 -- OPQ End map
925100700 -- PiratePQ end map
Close that and save that. Next, add multiworld to the event load in world properties. This should be obvious to figure it out.
After that, decide which NPC you want to be your warper and place this script into it:
Code:
var em;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
} else {
if (status >= 0 && mode == 0) {
cm.sendOk("Ok, feel free to hang around!");
cm.dispose();
return;
}
if (mode == 1)
status++;
else
status--;
if (status == 0) {
cm.sendNext("Dear lord, help me! I've been enslaved here and they made me warp people to their guild home!");
}else if(status == 1){
cm.sendNext("Oh well... I guess I'll do just that. Let's see if you have a guild home...");
}else if(status == 2){
if(cm.getPlayer().getGuildId() > 0){
cm.sendYesNo("It looks like you have one! Would you like to go there?");
}else{
cm.sendOk("You have to be in a guild to go there! Sorry!");
cm.dispose();
}
}else if(status == 3){
em = cm.getEventManager("multiworld");
if(em == null){
cm.sendOk("Something went wrong...");
cm.dispose();
}else{
em.getIv().invokeFunction("setup", null);
var eim = em.getInstance("GuildHome");
if(eim == null){
cm.sendOk("Something went wrong!");
cm.dispose()
}else{
eim.registerPlayer(cm.getChar());
cm.dispose();
}
}
}
}
}
Next, check your guild home map? Are there any NPC's? If so, have them use this script:
Code:
var status = 0;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
} else {
if (mode == 0) {
cm.sendOk("Alright, see you next time.");
cm.dispose();
return;
}
status++;
if (status == 0) {
cm.sendYesNo("Would you like to leave the guild home?");
}else if(status == 1) {
var em = cm.getEventManager("multiworld");
var eim = em.getInstance("GuildHome" + cm.getPlayer().getGuildId())
eim.removePlayer(cm.getChar());
cm.dispose();
}
}
}
If you don't have an NPC on that map, why don't you add one? I'll include a link to a guide on how to do just that soon.
After that, restart your server and you should be finished!
Now, some tips!
Code:
--+ Choose a guild home Map with no portals, or an NPC that warps you out. Otherwise, players could leave and train there on their own.
--+ It's best to make your teleporter, if you have one, do a check to make sure the player is not in a guild home map! Otherwise, the players would be in a world of their own.
--+ You can do some editing of the maps to make the home more friendly to players!
If you have any suggestions/questions/comments, please do make them!
Just a note, this, along with most of my releases, are Storybox originals. If you plan to use them in a repack, please give credit to "Lios of Storybox"
Screen Shots:
Thank you for using this release!
Also, please post if you're planning to use this for your server. I like to know where my releases are going and if they're popular ;) <3