- Joined
- Oct 25, 2008
- Messages
- 1,372
- Reaction score
- 604
[USELESSCRAP]This is the Pee System I coded for BlitzMS. I'm releasing it because there is no reason to keep code to myself. People could use this as a base to make their own timed systems.
Explanation: What this does is after a certain amount of time, (you choose) everyone online randomly gets a certain amount of pee. As you gain pee, your body talks to you and tells you if it's good or not. If you hold it in for too long, your bladder will explode and you'll die. To pee, you use @pee in one of the spas in Showa Town or whatever map you want. One last tip, set the time really high so people won't have to use the bathroom as often.
Add these in MapleCharacter.java
Add this under LoadCharFromDB
Add this under getDefault
Add these to savetoDB
Add this in ChannelServer.java
Add this in your player commands file.
Some extra GM commands. Add this if you want.
Make a file called PeeSystem.js and put it in your event scripts. Paste this in:
Add this to your world properties, or serverconstants.
Run this: Edit table name to your table name.
That's pretty much it. Here are some screens:
Body messages:
Using the bathroom:
NOT using the bathroom:
[/USELESSCRAP]
Explanation: What this does is after a certain amount of time, (you choose) everyone online randomly gets a certain amount of pee. As you gain pee, your body talks to you and tells you if it's good or not. If you hold it in for too long, your bladder will explode and you'll die. To pee, you use @pee in one of the spas in Showa Town or whatever map you want. One last tip, set the time really high so people won't have to use the bathroom as often.
Add these in MapleCharacter.java
Code:
private int pee;
Add this under LoadCharFromDB
Code:
ret.pee = rs.getInt("pee");
Add this under getDefault
Code:
ret.pee = 0;
Add these to savetoDB
Code:
pee = ?,
Code:
ps.setInt(X, pee);
Code:
public int getPee() {
return pee;
}
Code:
public void addPee() {
int peez = rand(5,15);
pee += peez;
peeEffects();
}
Code:
public void setPee(int pee) {
this.pee = pee;
peeEffects();
}
Code:
public void peeEffects() {
if (getPee() >= 100) {
setHp(0, false);
updateSingleStat(MapleStat.HP, hp);
client.getSession().write(MaplePacketCreator.serverNotice(6, "[Notice]: " + getName() + " has died because they didn't pee."));
client.getPlayer().dropMessage("Your bladder has exploded thus your pee has been let out the hard way.");
client.getPlayer().dropMessage("The doctors have repaired your bladder and expect a full recovery.");
client.getPlayer().dropMessage("[Doctor]: Next time, just pee dude.");
setPee(0);
} else if (getPee() >= 90) {
setHp((getHp()/10), false);
updateSingleStat(MapleStat.HP, hp);
client.getPlayer().dropMessage("[Body]: Dude! I'm getting pretty full here! Go to the Bathroom PLEASE!");
} else if (getPee() >= 80) {
setHp((getHp()/5), false);
updateSingleStat(MapleStat.HP, hp);
client.getPlayer().dropMessage("[Body]: Woah, that one hurt. Why are you forcing this in?");
} else if (getPee() >= 70) {
setHp((getHp()/2), false);
updateSingleStat(MapleStat.HP, hp);
client.getPlayer().dropMessage("[Body]: I'm starting to feel some pressure.");
} else if (getPee() >= 60) {
client.getPlayer().dropMessage("[Body]: Feeling about half way full.");
} else if (getPee() >= 40) {
client.getPlayer().dropMessage("[Body]: I feel great! It must have been your mom.");
} else if (getPee() >= 20) {
client.getPlayer().dropMessage("[Body]: You sure know how to keep the tank empty!");
} else if (getPee() >= 1) {
client.getPlayer().dropMessage("[Body]: Nice and dry. Just how I like it.");
}
}
Add this in ChannelServer.java
Code:
public void peeAll() {
for (MapleCharacter chr : players.getAllCharacters()) {
chr.addPee();
}
}
Add this in your player commands file.
Code:
} else if (splitted[0].equals("@pee")) {
if (c.getPlayer().getPee() <= 69) {
mc.dropMessage("[Body]: I'm not really in the mood to pee. Please try again later.");
} else if (c.getPlayer().getMapId() != 809000201 && c.getPlayer().getMapId() != 809000101) {
mc.dropMessage("[Body]: Are you crazy! I'm not peeing in public. Go to the Showa Town Spa to pee!");
} else {
mc.dropMessage("[Body]: Wow thanks! I feel so much better!");
c.getPlayer().setPee(0);
c.getChannelServer().broadcastPacket(MaplePacketCreator.serverNotice(6, "[Notice]: " + c.getPlayer().getName() + " has just pee'd!"));
}
Some extra GM commands. Add this if you want.
Code:
} else if (splitted[0].equalsIgnoreCase("!checkpee")) {
mc.dropMessage("You have " + c.getPlayer().getPee() + " pee.");
Code:
} else if (splitted[0].equalsIgnoreCase("!setpee")) {
int x = Integer.parseInt(splitted[1]);
player.setPee(x);
mc.dropMessage("You have set your pee to " + c.getPlayer().getPee() + ".");
Make a file called PeeSystem.js and put it in your event scripts. Paste this in:
Code:
var setupTask;
function init() {
scheduleNew();
}
function scheduleNew() {
var cal = java.util.Calendar.getInstance();
cal.set(java.util.Calendar.HOUR, 0);
cal.set(java.util.Calendar.MINUTE, 10);
cal.set(java.util.Calendar.SECOND, 0);
var nextTime = cal.getTimeInMillis();
while (nextTime <= java.lang.System.currentTimeMillis()) {
nextTime += 1200*600; //default is 1000x600 is 10 mins
}
setupTask = em.scheduleAtTimestamp("start", nextTime);
}
function cancelSchedule() {
setupTask.cancel(true);
}
function start() {
scheduleNew();
em.getChannelServer().peeAll();
var iter = em.getInstances().iterator();
while (iter.hasNext()) {
var eim = iter.next();
}
}
Add this to your world properties, or serverconstants.
Code:
,PeeSystem
Run this: Edit table name to your table name.
Code:
ALTER TABLE `TABLENAME`.`characters` MODIFY COLUMN `id` INT(11) DEFAULT NULL AUTO_INCREMENT,
ADD COLUMN `pee` INT(11) NOT NULL DEFAULT 0 AFTER `guildrank`;
That's pretty much it. Here are some screens:
Body messages:
Using the bathroom:
NOT using the bathroom:
[/USELESSCRAP]