PDA

View Full Version : [562]2kbarrows on - Objects



2kbarrows
October 9th, 2010, 00:21
Ok, well on this tutorial i'm going to show you guys how to get a few objects working, OK?
Ok so why don't you go ahead and open Object1PacketHandler.java, AKA Source>SRC>RS2HD(Emily if your using emilys source)>Packethandler...
Table of Contents
1.The Basics
2.Getting Advanced
3.Walktos
4.Double sided doors
5.Items
6.Animations and AddXP

1-Basic

case 5264:
player.tele(3654, 3519, 0);
break;
Thats a basic code, now to explain..

case 5264:
The bold code is the object that you are coding, in this case i coded a ladder...


player.tele(3654, 3519, 0);
Thats the ladder effect, which is a teleport..

break;
Which obviously ends the case, remember that you NEED a break to finish the case...
2-Starting to get advanced
Now for som more advanced stuff:

if(player.getSkills().getLevel(16) < 70) {
player.sm("You need at least level 70 of Agility to jump down.");
return;
}
That makes it so that people with agility under 70 they can't tele..

if(player.getSkills().getLevel(16) < 70) {
16 is the skill, Agility, and 70 is the level now the < is less than, so lets read the whole code...
If player has agility less than 70...Get it?

player.sm("You need at least level 70 of Agility to jump down.");
return;
}
Ok so the first line is player.send message(blah blah blah) AKA it sends that player the message...
Return is the code in which if the player has 70 agility or more its returns to origrinal code...

3-Walko
What is a walkto?
It is a code in which a player walks through a door/object...

player.WalkTo().GoTo(player, 2657, 3525);
Now here is how it works player walks to coord 2657, 3525.
Thats basicly it!
4.Double Sided Doors

if(player.getLocation().getX() == COORD HERE && player.getLocation().getY() == COORD Y HERE && player.getLocation().getZ() == HIGHT HERE) {
player.tele(3675, 9887, 1);
} else if(player.getLocation().getX() == COORD HERE && player.getLocation().getY() == COORD HERE && player.getLocation().getZ() == HIGHT HERE) {
player.tele(3683, 9888, 0);
Ok so this teleports you from both sides(not exactly because this isn't a door but you can understand)
So first

if(player.getLocation().getX() == COORD HERE
if player is it coord *add coord here*...Thats it cause it ain't the whole thing...That is for COORD X

&& player.getLocation().getY() == COORD Y HERE
And if player is at *coord here*...Thats for COORD Y

&& player.getLocation().getZ() == HIGHT HERE) {
And player is at hight *hight here*...So thats it...
NOW:

player.tele(3675, 9887, 1);
Thats the teleport..
Now at the rest of the code its like "else if player gets coord *blah blah blah*"
I think you can figure it out...
5.Items

player.getInventory().addItem(3214, 1);

player.getInventory().deleteItem(7936, 28);
Now those are item add and item delete but do i really need to read it to you?
The numbers i highlighted is the item code and the number next to it is the quantity...

if (!player.getInventory().contains(7936, 1)) {
player.sm("<col=000000>You need a pure essence to start runecrafting!.<col=000000>");
That's a start on runecrafting basicly what it says is, if players inventory doesent have *item here* at *this quantity* cancel action....

6.Animations and AddXP


player.animate(791);


player.getSkills().addXp(20, 3000);
Ok so the first one i feel that i don't need to explain...
The second one is like this, Player add xp to Skill number 20 and add 3000 xp...
So the first number is the number code and the second is XP...

Thats basicly it guys!
Also:
Tips
Never forget to add the ; at the end of each statement
Never forget breaks at the end of each case
Cases ALWAYS have the same number as the object you are coding
Always remember to add comments to mark what you are coding such as Runecrafting

/*
* Runecrafting
*/
If you are going to use signposts use this:

player.getActionSender().sendInterface(174);
player.getActionSender().sendString("wada", 174, 1);
Just change the wada to what you are doing....

Steve
October 9th, 2010, 00:39
Some of this your just teaching people basic java, which a lot of people in this community could use. So Good Job.

kevin
October 9th, 2010, 03:50
this tutorial.. made me nerdgasm..

pk master
October 9th, 2010, 07:38
you would realse this. let people figre this stuff out by them selfs yeh

Stacx
October 9th, 2010, 08:28
How can you fail in conventions in such small pieces of code.

kyljys
October 9th, 2010, 08:58
I hate things about 562 protocol that u cant range well, cant hyprid..and all 562 servers r same, shops glitches evrytime and u need reload client coz of tht..shittiest protocol i think

pk master
October 9th, 2010, 09:02
I hate things about 562 protocol that u cant range well, cant hyprid..and all 562 servers r same, shops glitches evrytime and u need reload client coz of tht..shittiest protocol i think

you can hybrid on good servers shops are fixed on good servers and you dont need to reload client. kid u fail you dont know nothing

Jon
October 9th, 2010, 09:04
you can hybrid on good servers shops are fixed on good servers and you dont need to reload client. kid u fail you dont know nothing

He knows enough, all current 562 servers have the invisable item glitch in the shop which makes you have to restart the client, really shops need rewriting >_<

2kbarrows
October 9th, 2010, 12:02
How can you fail in conventions in such small pieces of code.

Ok so this was an example... Some of these stuff here is just a portal and some are walktos...
@kylijys What did you say?I cant understand... And nerds like you that think 500+ sucks... You can do anything on 562s as long as you know how to program

@The Flaming Nerds
This thread is to teach people how to make objects and improve 562s some people don't even know how to make a teleport.

@Nice Comments
Thanks just helpin the community...

P.S. I just noticed that there was like 2 or 3 nice comments the rest is useless spam and flame...

you would realse this. let people figre this stuff out by them selfs yeh


this tutorial.. made me nerdgasm..

Some of this your just teaching people basic java, which a lot of people in this community could use. So Good Job.
Not sure if the first two count but ok!

Jon
October 9th, 2010, 12:04
Ok so this was an example... Some of these stuff here is just a portal and some are walktos...
@kylijys What did you say?I cant understand... And nerds like you that think 500+ sucks... You can do anything on 562s as long as you know how to program

@The Flaming Nerds
This thread is to teach people how to make objects and improve 562s some people don't even know how to make a teleport.

@Nice Comments
Thanks just helpin the community...

P.S. I just noticed that there was like 2 or 3 nice comments the rest is useless spam and flame...



Not sure if the first two count but ok!

Some people probly don't know how to make a method, oh wait that's you. :troll:

Niator
October 9th, 2010, 12:08
This tut would help out some new pl for sure. Maybe try to explain how to add so a timer starts when u click an object? Or show how to make events?

2kbarrows
October 9th, 2010, 12:09
Some people probly don't know how to make a method, oh wait that's you. :troll:

How is that me?
Stop trollin with me, oh and if you dare flame/troll with me for gods sake use proper english...
Now why dont you shut your damn mouth and make a better tutorial then mine, then you can flame on this thread....

Jon
October 9th, 2010, 12:12
How is that me?
Stop trollin with me, oh and if you dare flame/troll with me for gods sake use proper english...
Now why dont you shut your damn mouth and make a better tutorial then mine, then you can flame on this thread....

I don't do tutorials I do snippets. Snippets take more skills. Oh and that was 100% English probly is an English word. >_<

2kbarrows
October 9th, 2010, 12:16
I don't do tutorials I do snippets. Snippets take more skills. Oh and that was 100% English probly is an English word. >_<

Hmmm, how do snippets take more skill?
Their easier to make
They are generaly codes such as Full Fletching
And last time i checked >_< isn't a word...LoL?

Jon
October 9th, 2010, 12:19
Hmmm, how do snippets take more skill?
Their easier to make
They are generaly codes such as Full Fletching
And last time i checked >_< isn't a word...LoL?

>_< is a facial expression..

Niator
October 9th, 2010, 12:22
Hmmm, how do snippets take more skill?
Their easier to make
They are generaly codes such as Full Fletching
And last time i checked >_< isn't a word...LoL?


>_< is a facial expression..

I laik dat both use tha >_< guy :)

Wombat
October 9th, 2010, 12:34
Nice tut, 2k.

David
October 9th, 2010, 12:49
Nice tut, keep up tha good workz

kyljys
October 9th, 2010, 17:15
you can hybrid on good servers shops are fixed on good servers and you dont need to reload client. kid u fail you dont know nothing

Oh..i fail now? whos kid here..hmm..lets look at ur name "pk master" woah! only 10yr olds use names like that, gj and now go to school and listen ur teacher pls.

zar0s
October 9th, 2010, 17:25
Oh..i fail now? whos kid here..hmm..lets look at ur name "pk master" woah! only 10yr olds use names like that, gj and now go to school and listen ur teacher pls.
what about your name?
:s

Ficho
October 9th, 2010, 17:29
Wow, bunch of nerds, dont relize this tut is for begginers -.- nice explaining mate :)

kyljys
October 9th, 2010, 21:51
what about your name?
:s

well my name atleast mean something, it means something in finnish and btw remove ur sign its soo ugly..

420
October 9th, 2010, 22:05
So, how many 562 object tutorials are there now? o.o

2kbarrows
October 9th, 2010, 23:34
So, how many 562 object tutorials are there now? o.o

None like this... This is explaining how to make em work most of object tutorials are for spawning them.

crezzy
October 10th, 2010, 12:39
I hate things about 562 protocol that u cant range well, cant hyprid..and all 562 servers r same, shops glitches evrytime and u need reload client coz of tht..shittiest protocol i think

Lol good ones you can.