try this
Purpose: To add a minigame to get godswords
UPDATE! Change the codes you used with the key-on-chest, and the codes in item2.java, also follow step 6. I have updated it so that you now get either a shard, or a hilt from the chest, and then you put the hilts and shards together to make a godsword!
Difficulty: 3/10
Assumed Knowledge: None
Server Base: Testscape
Classes Modified: client.java, item.cfg, npc.cfg, autospawn.cfg, item2.java, npchandler.java
Procedure
Step 1: Open up client.java and put the following code in with your item-on-object codes.
Code:
else if(useItemID == 3450 && atObjectID == 4126)
{
sendMessage("You got an Armadyl hilt!");
deleteItem(3450,getItemSlot(3450), 1);
addItem(15337, 1);
teleportToX = 2845;
teleportToY = 4832;
}
else if(useItemID == 3451 && atObjectID == 4126)
{
sendMessage("You got a Bandos hilt!");
deleteItem(3451,getItemSlot(3451), 1);
addItem(15338, 1);
teleportToX = 2845;
teleportToY = 4832;
}
else if(useItemID == 3452 && atObjectID == 4126)
{
sendMessage("You got a Saradomin hilt!");
deleteItem(3452,getItemSlot(3452), 1);
addItem(15339, 1);
teleportToX = 2845;
teleportToY = 4832;
}
else if(useItemID == 3453 && atObjectID == 4126)
{
sendMessage("You got a Zamorak hilt!");
deleteItem(3453,getItemSlot(3453), 1);
addItem(15340, 1);
teleportToX = 2845;
teleportToY = 4832;
}
else if(useItemID == 3454 && atObjectID == 4126)
{
sendMessage("You got a godsword shard 1!");
deleteItem(3454,getItemSlot(3454), 1);
addItem(15341, 1);
teleportToX = 2845;
teleportToY = 4832;
}
else if(useItemID == 3455 && atObjectID == 4126)
{
sendMessage("You got a godsword shard 2!");
deleteItem(3455,getItemSlot(3455), 1);
addItem(15342, 1);
teleportToX = 2845;
teleportToY = 4832;
}
else if(useItemID == 3456 && atObjectID == 4126)
{
sendMessage("You got a godsword shard 3!");
deleteItem(3456,getItemSlot(3456), 1);
addItem(15343, 1);
teleportToX = 2845;
teleportToY = 4832;
}Now add this with your commands
Code:
if (command.startsWith("swordgame")) {
teleportToX = 2845;
teleportToY = 4832;
sendMessage("Welcome godsword mini game, kill the monsters to advance rounds");
}Finally, add this to your global objects
Code:
makeGlobalObject(2465, 4817, 4126, 0, 10);//silver chest
Step 2: Now open up autospawn.cfg and add this at the bottom
Code:
spawn = 1021 2844 4830 0 0 0 0 0 1 Air elemental
spawn = 1020 2658 4837 0 0 0 0 0 1 Earth elemental
spawn = 1022 2716 4832 0 0 0 0 0 1 Water elemental
spawn = 1019 2585 4834 0 0 0 0 0 1 Fire elemental
spawn = 3200 2464 4821 0 0 0 0 0 1 Chaos elemental
Step 3: Now open up item.cfg and add this at the bottom(If you don't already have godswords as an item in your server)
Code:
item = 15333 Armadyl_Godsword A_beautiful,_heavy_sword. 30000 30000 30000 0 132 80 0 0 0 0 0 0 0 500 8
item = 15334 Bandos_Godsword A_brutally_heavy_sword. 30000 30000 30000 0 132 80 0 0 0 0 0 0 0 500 8
item = 15335 Saradomin_Godsword A_gracious,_heavy_sword. 30000 30000 30000 0 132 80 0 0 0 0 0 0 0 500 8
item = 15336 Zamorak_Godsword A_terrifying,_heavy_sword. 30000 30000 30000 0 132 80 0 0 0 0 0 0 0 500 8
Step 4: Open up item2.java and add this anywhere
Code:
public static int Silvchest[] = {3450,3451,3452,3453,3454,3455,3456};
public static int randomSilvchest()
{
return Silvchest[(int)(Math.random()*Silvchest.length)];
}
Step 5: Open up NPCHandler.java and add this in with the monster drops
Code:
}
if(npcs[NPCID].npcType == 1021)
{
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.teleportToX = 2660;
ppl.teleportToY = 4839;
}
if(npcs[NPCID].npcType == 1020)
{
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.teleportToX = 2713; // Change coordinates
ppl.teleportToY = 4836; // Change coordinates
}
if(npcs[NPCID].npcType == 1022)
{
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.teleportToX = 2584; // Change coordinates
ppl.teleportToY = 4836; // Change coordinates
}
if(npcs[NPCID].npcType == 1019)
{
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.teleportToX = 2464; // Change coordinates
ppl.teleportToY = 4834; // Change coordinates
}That makes you teleport every time you kill the elemental
Also add this in the same area
Code:
else if(npcs[NPCID].npcType == 3200)//Chaos elemental
{
ItemHandler.addItem(Item2.randomSilvchest(), npcs[NPCID].absX, npcs[NPCID].absY, 1, GetNpcKiller(NPCID), false);
}
Step 6: UPDATE! Add this with your item-to-item codes
Code:
if (itemUsed == 15341 && useWith == 15342) { //Shard 1 with shard 2
deleteItem(15341, getItemSlot(15341), 1);
deleteItem(15342, getItemSlot(15342), 1);
addItem(15329, 1);
}
if (itemUsed == 15342 && useWith == 15341) { //Shard 2 with shard 1
deleteItem(15341, getItemSlot(15341), 1);
deleteItem(15342, getItemSlot(15342), 1);
addItem(15329, 1);
}
if (itemUsed == 15329 && useWith == 15343) { //Shards 1+2 with shard 3
deleteItem(15329, getItemSlot(15329), 1);
deleteItem(15343, getItemSlot(15343), 1);
addItem(15331, 1);
}
if (itemUsed == 15343 && useWith == 15329) { //Shard 3 with shards 1+2
deleteItem(15329, getItemSlot(15329), 1);
deleteItem(15343, getItemSlot(15343), 1);
addItem(15331, 1);
}
if (itemUsed == 15331 && useWith == 15337) { //Blade with Armadyl hilt
deleteItem(15331, getItemSlot(15331), 1);
deleteItem(15337, getItemSlot(15337), 1);
addItem(15333, 1);
}
if (itemUsed == 15331 && useWith == 15338) { //Blade with Bandos hilt
deleteItem(15331, getItemSlot(15331), 1);
deleteItem(15338, getItemSlot(15338), 1);
addItem(15334, 1);
}
if (itemUsed == 15331 && useWith == 15339) { //Blade with Saradomin hilt
deleteItem(15331, getItemSlot(15331), 1);
deleteItem(15339, getItemSlot(15339), 1);
addItem(15335, 1);
}
if (itemUsed == 15331 && useWith == 15340) { //Blade with Zamorak hilt
deleteItem(15331, getItemSlot(15331), 1);
deleteItem(15340, getItemSlot(15340), 1);
addItem(15336, 1);
}How it works: You type the command to get to the air altar
You kill all the elementals, and when you get the key from the chaos elemental, you use it with the chest for a random godsword, and you will be teleported back to the beginning. Remember to go into NPC.cfg and make sure that all the elementals have HP