ParadiseX
Would you like to react to this message? Create an account in a few clicks or log in to continue.

ParadiseX

The greatest Runescape private Server.
 
HomePortalSearchLatest imagesRegisterLog inMedia

 

 How To Make Genie Lamps!

Go down 
AuthorMessage
DaviD

DaviD


Posts : 19
Join date : 2010-01-02

How To Make Genie Lamps! Empty
PostSubject: How To Make Genie Lamps!   How To Make Genie Lamps! Icon_minitimeSun Jan 03, 2010 12:58 pm

Alright, so I see many people have different methods of the genie lamp. Theyre all great, but they dont have the genie spawn, and include the dialogue and such. So I wrote my own tutorial on it.

Files Modified: Client.java
Server Source: Devolution 7
Difficulty: 3/10
Purpose: Adding Genie lamps

Ok, so first off, we need to have the genie spawn beside the player at a random time. I actually chose the genie to appear randomly when a user levels up in a magic skill. If you want, feel free to change it.

Now were going to add the random event were, when you level up, its a 1 out of 10 chance a genie will spawn beside the player.
Declare this method,

Code:
public void SummonNewNPC(int npcID) {
server.npcHandler.newSummonedNPC(npcID, absX, absY-1, heightLevel, absX-1, absY-1, absX+1, absY-1, 1, server.npcHandler.GetNpcListHP(npcID), false, playerId);
summonedNPCS++;
actionTimer = 20;
}
What this does is it spawns a NPC beside a player, with the correct heightLevel, coordinates and player. Hence,
Code:
server.npcHandler.newSummonedNPC(npcID, absX, absY-1, heightLevel, absX-1, absY-1, absX+1, absY-1, 1, server.npcHandler.GetNpcListHP(npcID), false, playerId);


Alright so search for,

Code:

public void levelup

This is the level up method, this part is responsible for the interface when you level up it shows what you leveled up in and what level your at. Pretty straight forward.
Now in the method look for,

Code:
case 6:
// Magic
sendFrame164(6211);
sendFrame126("Congratulations, you just advanced a magic level!",
6212);
sendFrame126("Your magic level is now " + playerLevel[6] + ".",
6213);
sendMessage("Congratulations, you just advanced a magic level.");
NpcDialogueSend = true;
break;
Let me explain;

Code:

sendFrame164(6211);
This is the interface when you level up. Which is the little box in the chat screen.

Code:
sendFrame126("Congratulations, you just advanced a magic level!",
6212);
sendFrame126("Your magic level is now " + playerLevel[6] + ".",
6213);
sendMessage("Congratulations, you just advanced a magic level.");


This is pretty straight forward, simple text shown on the screen.

Ok lets get to what we have to add here..
So under the NPC dialogue,
Code:
NpcDialogueSend = true;
Add the random event,
Code:
if (misc.random(10) == 1) {
SummonNewNPC(409);
}

Code:
if (misc.random(10) == 1) {

What this does, is when you levelup anything in the blocks happen in a 1 in 10 chance.

Code:
SummonNewNPC(409);

Remember that small method we added named SummonNewNPC? Well this is the small code which gets the information from the method and uses it here. Im having trouble explaining today, leave me alone!
So, you may ask why I put 409 in the brackets. Well thats the NPC ID for the genie, and as you can see in the method we added earlier,

Code:

public void SummonNewNPC(int npcID) {
int npcID means we place the NPC ID in those brackets.

So now we have to add the genie lamps to actually work. I used this from a tutorial here, so it will look familiar.

So now were going to add the lamps use. In,
Code:
public boolean CheckForSkillUse4
were going to place the packet for the lamp.


Under the switch statement,
Code:
switch (Item) {
Add the genie lamp,
Code:
case 2528:
showInterface(2808);
sendMessage("You rub the lamp.");
sendQuest("Choose the stat you would like to increase!", 2810);
break;

This,
Code:
showInterface(2808);
is the interface shown with the menu of skills to level up with.

Under,
Code:
case 14067:
Adds the packets for the buttons in the genie lamp menu. Or,
Code:
showInterface(2808);

Before you move on make sure you declare,
Code:
public int gL = 0;
So under case 14067 I want you to add,
Code:
case 10252:
sendQuest("Attack", 2810);
gL = 1;
break;


case 10253:
sendQuest("Strength", 2810);
gL = 2;
break;

case 10254:
sendQuest("Ranged", 2810);
gL = 3;
break;

case 10255:
sendQuest("Magic", 2810);
gL = 4;
break;

case 11000:
sendQuest("Defence", 2810);
gL = 5;
break;

case 11001:
sendQuest("Hitpoints", 2810);
gL = 6;
break;

case 11002:
sendQuest("Prayer", 2810);
gL = 7;
break;

case 11003:
sendQuest("Agility", 2810);
gL = 8;
break;

case 11004:
sendQuest("Herblore", 2810);
gL = 9;
break;

case 11005:
sendQuest("Thieving", 2810);
gL = 10;
break;

case 11006:
sendQuest("Crafting", 2810);
gL = 11;
break;

case 11007:
sendQuest("Runecrafting", 2810);
gL = 12;
break;

case 47002:
sendQuest("Slayer", 2810);
gL = 13;
break;

case 54090:
sendQuest("Farming", 2810);
gL = 14;
break;

case 11008:
sendQuest("Mining", 2810);
gL = 15;
break;

case 11009:
sendQuest("Smithing", 2810);
gL = 16;
break;

case 11010:
sendQuest("Fishing", 2810);
gL = 17;
break;

case 11011:
sendQuest("Cooking", 2810);
gL = 18;
break;

case 11012:
sendQuest("Firemaking", 2810);
gL = 19;
break;

case 11013:
sendQuest("Woodcutting", 2810);
gL = 20;
break;

case 11014:
sendQuest("Fletching", 2810);
gL = 21;
break;

case 11015://confirm button
if(gL == 1) {
addSkillXP((2000*playerLevel[0]), 0);
sendMessage("You were granted Attack experience!");
RemoveAllWindows();
deleteItem(2528, GetItemSlot(2528), 1);
}
else if(gL == 2) {
addSkillXP((2000*playerLevel[2]), 2);
sendMessage("You were granted Strength experience!");
RemoveAllWindows();
deleteItem(2528, GetItemSlot(2528), 1);
}
else if(gL == 3) {
addSkillXP((2000*playerLevel[4]), 4);
sendMessage("You were granted Ranged experience!");
RemoveAllWindows();
deleteItem(2528, GetItemSlot(2528), 1);
}
else if(gL == 4) {
addSkillXP((2000*playerLevel[6]), 6);
sendMessage("You were granted Magic experience!");
RemoveAllWindows();
deleteItem(2528, GetItemSlot(2528), 1);
}
else if(gL == 5) {
addSkillXP((2000*playerLevel[1]), 1);
sendMessage("You were granted Defense experience!");
RemoveAllWindows();
deleteItem(2528, GetItemSlot(2528), 1);
}
else if(gL == 6) {
addSkillXP((2000*playerLevel[3]), 3);
sendMessage("You were granted Hitpoints experience!");
RemoveAllWindows();
deleteItem(2528, GetItemSlot(2528), 1);
}
else if(gL == 7) {
addSkillXP((2000*playerLevel[5]), 5);
sendMessage("You were granted prayer experience!");
RemoveAllWindows();
deleteItem(2528, GetItemSlot(2528), 1);
}
else if(gL == Cool {
addSkillXP((2000*playerLevel[16]), 16);
sendMessage("You were granted Agility experience!");
RemoveAllWindows();
deleteItem(2528, GetItemSlot(2528), 1);
}
else if(gL == 9) {
addSkillXP((2000*playerLevel[15]), 15);
sendMessage("You were granted Herblore experience!");
RemoveAllWindows();
deleteItem(2528, GetItemSlot(2528), 1);
}
else if(gL == 10) {
addSkillXP((2000*playerLevel[17]), 17);
sendMessage("You were granted Thieving experience!");
RemoveAllWindows();
deleteItem(2528, GetItemSlot(2528), 1);
}
else if(gL == 11) {
addSkillXP((2000*playerLevel[12]), 12);
sendMessage("You were granted Crafting experience!");
RemoveAllWindows();
deleteItem(2528, GetItemSlot(2528), 1);
}
else if(gL == 12) {
addSkillXP((2000*playerLevel[20]), 20);
sendMessage("You were granted Runecrafting experience!");
RemoveAllWindows();
deleteItem(2528, GetItemSlot(2528), 1);
}
else if(gL == 13) {
addSkillXP((2000*playerLevel[18]), 18);
sendMessage("You were granted Slayer experience!");
RemoveAllWindows();
deleteItem(2528, GetItemSlot(2528), 1);
}
else if(gL == 14) {
addSkillXP((2000*playerLevel[19]), 19);
sendMessage("You were granted Farming experience!");
RemoveAllWindows();
deleteItem(2528, GetItemSlot(2528), 1);
}
else if(gL == 15) {
addSkillXP((2000*playerLevel[14]), 14);
sendMessage("You were granted Mining experience!");
RemoveAllWindows();
deleteItem(2528, GetItemSlot(2528), 1);
}
else if(gL == 16) {
addSkillXP((2000*playerLevel[13]), 13);
sendMessage("You were granted Smithing experience!");
RemoveAllWindows();
deleteItem(2528, GetItemSlot(2528), 1);
}
else if(gL == 17) {
addSkillXP((2000*playerLevel[10]), 10);
sendMessage("You were granted Fishing experience!");
RemoveAllWindows();
deleteItem(2528, GetItemSlot(2528), 1);
}
else if(gL == 18) {
addSkillXP((2000*playerLevel[7]), 7);
sendMessage("You were granted Cooking experience!");
RemoveAllWindows();
deleteItem(2528, GetItemSlot(2528), 1);
}
else if(gL == 19) {
addSkillXP((2000*playerLevel[11]), 11);
sendMessage("You were granted Firemaking experience!");
RemoveAllWindows();
deleteItem(2528, GetItemSlot(2528), 1);
}
else if(gL == 20) {
addSkillXP((2000*playerLevel[8]), Cool;
sendMessage("You were granted Woodcutting experience!");
RemoveAllWindows();
deleteItem(2528, GetItemSlot(2528), 1);
}
else if(gL == 21) {
addSkillXP((2000*playerLevel[9]), 9);
sendMessage("You were granted Fletching experience!");
RemoveAllWindows();
deleteItem(2528, GetItemSlot(2528), 1);
} else {
sendMessage("Pick a stat to advance before clicking confirm.");
}
break;

Ok, now im going to explain all that,
Code:
case 10252:
Is trhe packet ID for the button. Now after that double colon the button will have commands.

Code:
sendQuest("Attack", 2810);
Simple text, showing the skill.


Code:
gL = 1;
gL is the skill number. Theres 21 skills here so 1 represents the first skill, attack.

Code:
break;
The break statement ends the packet.

This all applies to the other skills too.

Lets move on next,
Code:
case 11015://confirm button
This is the packet for the buttons of each skill.

Code:
if(gL == 1) {
This is the if statement, if the player selected "Attack" then anything inside that if statement would occur. gL means the first skill, attack, and so on.

Code:
addSkillXP((2000*playerLevel[0]), 0);
This gives the user 2000 experience once they clikc on a certain button. Since this is gL 1 (Attack) then the user obtaines experience because of,
Code:
(2000*playerLevel[0])
Code:
RemoveAllWindows();
Once the button is pressed the window/interface closes.

Code:
deleteItem(2528, GetItemSlot(2528), 1);
Once the window closes, the lamp dissappears.


Now for the final part, adding the dialogue.

Now head into,
Code:
public void UpdateNPCChat()
And scroll down to the bottom. Go to the last packet in the method. Im going to use case 11 as my dialogue packet in this tutorial.

After case 10 or the last packet, add,
Code:
case 11:
sendFrame200(4883, 591);
sendFrame126(GetNpcName(NpcTalkTo), 409);
sendFrame126("Greetings traveler, take this mystical gift..", 4885);
sendFrame75(NpcTalkTo, 409);
sendFrame164(4882);
NpcDialogueSend = true;
addItem(2528, 1);
break;

Everything in there is simple text in the chatbox, or dialogue chat. The only difference is the addItem. Once you talk with the genie, you receive a lamp. Its only a simple dialogue.

Now to add it for clicking the NPC. Search for your first click NPC packet, or case 155.
And above,
Code:
if (NPCID == 316) {
/* Net From Net & Bait - Any Sea */
if ((IsItemInBag(303) == true) && (actionTimer == 0)) {
startFishing(316);
} else {
sendMessage("You need a " + getItemName(303)
+ " to fish here.");
}

Or whatever you have, add,
Code:
if(NPCID == 409){
skillX = server.npcHandler.npcs[NPCSlot].absX;
skillY = server.npcHandler.npcs[NPCSlot].absY;
NpcWanneTalk = 11;
}

Code:
if(NPCID == 409){

The NPCID is pretty straight forward. We placed 409 because its the genies ID, and everything inside that if statement is for the genie.

Code:
NpcWanneTalk = 11;

This is the packet ID for the dialogue. Remember that case 11 we added earlier? This is were the case label goes, in this case its 11.

-DaviD If You Will Have Any Probs Add My MSN crazyfaze2000@.hotmail.com
Back to top Go down
https://paradisex.forumotion.net
 
How To Make Genie Lamps!
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
ParadiseX :: Announcements-
Jump to: