Thread: [667/704] All my Snippets/Tutorials here.

Page 1 of 5 123 ... LastLast
Results 1 to 10 of 45
  1. #1 [667/704] All my Snippets/Tutorials here. 
    Banned

    Join Date
    Mar 2010
    Posts
    1,096
    Thanks given
    214
    Thanks received
    117
    Rep Power
    0
    I'm going to be posting my previous tutorials on 667/704 and snippets on this page. Will be updated DAILY. Unless, emergencies. So, stay tuned on this page every day for a new snippet/tutorial.


    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~

    Simple Thieving Stall System

    So, many people don't know how to do this, and it's one of the most basic thing's. Don't flame, this is for the people who don't know what they're doing and want a economic server.

    Goto ObjectHandler.java and search for the id "17010" without Parenthesis.

    Under ("LunarAltar") add this


    Code:
    				else if (id == 4277)
    					player.sendMessage("You successfully thieve from the stall"); //message can change
    					player.addStopDelay(4); //delay so it don't auto thieve rapidly & people autoclick
    					player.getInventory().addItem(995, 1270); //The amount of GP it gives.
                                            player.setNextAnimation(new Animation(881));
    					player.getSkills().addXp(17, 100); //the exp multiplyer that it gives.
    This, will give around 1M Exp, if you didn't add this to the snippet I gave.

    If you didn't already fix your exp rate's goto Skills.java & add this under...

    exp *=1.025;


    Code:
    		if (skill != PRAYER&& skill != THIEVING)
    			exp *= 200;
    This, will shorten the exp, and make it smaller for prayer & thieving.

    Now spawn the object 4277, anywhere in the destinations you want. Then there ya go. A simple base for your thieving stalls

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~
    Glacors'

    This will teach you how to make cheap, yet simple Glacors.

    Make new class file Glacor.java in Npcs.others

    Add this in there

    Code:
    package com.rs.game.npc.others;
    
    import java.util.List;
    import java.util.concurrent.TimeUnit;
    
    import com.rs.cores.CoresManager;
    import com.rs.game.Animation;
    import com.rs.game.Entity;
    import com.rs.game.Graphics;
    import com.rs.game.Hit;
    import com.rs.game.Hit.HitLook;
    import com.rs.game.World;
    import com.rs.game.WorldTile;
    import com.rs.game.npc.NPC;
    import com.rs.game.npc.combat.NPCCombatDefinitions;
    import com.rs.game.player.Player;
    import com.rs.game.tasks.WorldTask;
    import com.rs.game.tasks.WorldTasksManager;
    import com.rs.utils.Utils;
    
    @SuppressWarnings("serial")
    public final class Glacor extends NPC {
    
    	private boolean[] demonPrayer;
    	private int fixedCombatType;
    	private int[] cachedDamage;
    	private int shieldTimer;
    	private int fixedAmount;
    	private int prayerTimer;
    
    	public Glacor(int id, WorldTile tile, int mapAreaNameHash,
    			boolean canBeAttackFromOutOfArea, boolean spawned) {
    		super(id, tile, mapAreaNameHash, canBeAttackFromOutOfArea, spawned);
    		demonPrayer = new boolean[3];
    		cachedDamage = new int[3];
    		shieldTimer = 0;
    		switchPrayers(0);
    	}
    
    	public void switchPrayers(int type) {
    		resetPrayerTimer();
    	}
    
    	private void resetPrayerTimer() {
    		prayerTimer = 16;
    	}
    
    	@Override
    	public void processNPC() {
    		super.processNPC();
    		if (isDead())
    			return;
    		if (Utils.getRandom(40) <= 2)
    			sendRandomProjectile();
    		if (getCombat().process()) {// no point in processing
    				for (int i = 0; i < cachedDamage.length; i++) {
    					if (cachedDamage[i] >= 310) {
    						cachedDamage = new int[3];
    					}
    				}
    			}
    			for (int i = 0; i < cachedDamage.length; i++) {
    				if (cachedDamage[i] >= 310) {
    					cachedDamage = new int[3];
    				}
    			}
    		}
    
    	@Override
    	public void handleIngoingHit(final Hit hit) {
    		int type = 0;
    		super.handleIngoingHit(hit);
    		if (hit.getSource() instanceof Player) {// Armadyl Battlestaff
    			Player player = (Player) hit.getSource();
    			if ((player.getEquipment().getWeaponId() == 21777 || player
    					.getEquipment().getWeaponId() == 2104)
    					&& hit.getLook() == HitLook.MAGIC_DAMAGE
    					&& hit.getDamage() > 0) {
    				shieldTimer = 120;
    				player.getPackets().sendGameMessage(
    						"This Monster is Weekened by your weapon.");
    			}
    		}
    		if (hit.getLook() == HitLook.MAGIC_DAMAGE) {
    			if (demonPrayer[0]) {
    				hit.setDamage(0);
    			} else {
    				cachedDamage[0] += hit.getDamage();
    			}
    		} else if (hit.getLook() == HitLook.MELEE_DAMAGE) {
    			type = 1;
    			if (demonPrayer[1]) {
    				hit.setDamage(0);
    			} else {
    				cachedDamage[1] += hit.getDamage();
    			}
    		} else if (hit.getLook() == HitLook.RANGE_DAMAGE) {
    			type = 2;
    			if (demonPrayer[2]) {
    				hit.setDamage(0);
    			} else {
    				cachedDamage[2] += hit.getDamage();
    			}
    		} else if (hit.getLook() == HitLook.MISSED) {
    			cachedDamage[type] += 20;
    		} else {
    			cachedDamage[Utils.getRandom(2)] += 20;// random
    		}
    	}
    
    	@Override
    	public void sendDeath(Entity source) {
    		final NPCCombatDefinitions defs = getCombatDefinitions();
    		resetWalkSteps();
    		getCombat().removeTarget();
    		setNextAnimation(null);
    		shieldTimer = 0;
    		WorldTasksManager.schedule(new WorldTask() {
    			int loop;
    
    			@Override
    			public void run() {
    				if (loop == 0) {
    					setNextAnimation(new Animation(defs.getDeathEmote()));
    				} else if (loop >= defs.getDeathDelay()) {
    					drop();
    					reset();
    					setLocation(getRespawnTile());
    					finish();
    					setRespawnTask();
    					stop();
    				}
    				loop++;
    			}
    		}, 0, 1);
    	}
    
    	private void sendRandomProjectile() {
    		WorldTile tile = new WorldTile(getX() + Utils.random(7), getY()
    				+ Utils.random(7), getPlane());
    		setNextAnimation(new Animation(412));
    		World.sendProjectile(this, tile, 1887, 34, 16, 40, 35, 16, 0);
    		for (int regionId : getMapRegionsIds()) {
    			List<Integer> playerIndexes = World.getRegion(regionId)
    					.getPlayerIndexes();
    			if (playerIndexes != null) {
    				for (int npcIndex : playerIndexes) {
    					Player player = World.getPlayers().get(npcIndex);
    					if (player == null || player.isDead()
    							|| player.hasFinished() || !player.isRunning()
    							|| !player.withinDistance(tile, 3))
    						continue;
    					player.getPackets().sendGameMessage(
    							"The monster's magical attack splashes on you.");
    					player.applyHit(new Hit(this, 281, HitLook.MAGIC_DAMAGE, 1));
    				}
    			}
    		}
    	}
    
    	@Override
    	public void setRespawnTask() {
    		if (!hasFinished()) {
    			reset();
    			setLocation(getRespawnTile());
    			finish();
    		}
    		final NPC npc = this;
    		CoresManager.slowExecutor.schedule(new Runnable() {
    			@Override
    			public void run() {
    				setFinished(false);
    				World.addNPC(npc);
    				npc.setLastRegionId(0);
    				World.updateEntityRegion(npc);
    				loadMapRegions();
    				checkMultiArea();
    				shieldTimer = 0;
    				fixedCombatType = 0;
    				fixedAmount = 0;
    			}
    		}, getCombatDefinitions().getRespawnDelay() * 600,
    				TimeUnit.MILLISECONDS);
    	} //Your re-spawn time on them.
    
    	public static boolean atTD(WorldTile tile) {
    		if ((tile.getX() >= 2560 && tile.getX() <= 2630)
    				&& (tile.getY() >= 5710 && tile.getY() <= 5753))
    			return true;
    		return false;
    	}
    
    	public int getFixedCombatType() {
    		return fixedCombatType;
    	}
    
    	public void setFixedCombatType(int fixedCombatType) {
    		this.fixedCombatType = fixedCombatType;
    	}
    
    	public int getFixedAmount() {
    		return fixedAmount;
    	}
    
    	public void setFixedAmount(int fixedAmount) {
    		this.fixedAmount = fixedAmount;
    	}
    
    }

    Now world.java

    Search for Tormented
    It's the one far under the Import...

    add this


    Code:
    		else if (id == 14301)
    			n = new Glacor(id, tile, mapAreaNameHash,
    					canBeAttackFromOutOfArea, spawned);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~
    Making NPCS Talk/Teleport
    Okay, most people should know how to do this, so I'm going to give you the basic's.

    NPC's name: Ozan
    ID - 7888

    Make a new class

    Here's my class so you can test..

    Name: Ozan

    Place -> Dialogues

    Code:
    package com.rs.game.player.dialogues;
    
    import com.rs.game.WorldTile;
    
    public final class Ozan extends Dialogue {
    
    	@Override
    	public void start() {
    		sendDialogue(SEND_3_TEXT_INFO,
    				"Hello! I'll take you to lumbridge",
    				"Lumbridge is a basic small city",
    				"It's mostly country, so you better watch out if your from the city.");
    	}
    
    	@Override
    	public void run(int interfaceId, int componentId) {
    		if (stage == -1) {
    			stage = 0;
    			sendDialogue(SEND_2_OPTIONS,
    					"Do you want me to teleport you to Lumbridge?",
    					"Yes please", "Stay here.");
    		} else if (stage == 0) {
    			if (componentId == 1) {
    				player.setNextWorldTile(new WorldTile(3122, 3122, 0));
    				player.getControlerManager().startControler("ZGDControler");
    			}
    			end();
    		}
    
    	}
    
    	@Override
    	public void finish() {
    		// TODO Auto-generated method stub
    
    	}
    
    }
    Add this to NPCHandler.java

    Code:
    				if (npc.getId() == 7888)
    					player.getDialogueManager().startDialogue("Ozan",
    							npc.getId());
    You should know where to put this or... /Fp

    Add this to DialogueHandler.java

    Code:
    			Class<Dialogue> value43 = (Class<Dialogue>) Class
    					.forName(Ozan.class.getCanonicalName());
    			handledDialogues.put("Ozan", value43);
    Then done, compile & run.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~
    Making object's teleport/talk to you

    Someone asked on my tutorial about how to make NPC's do this, it's basically the same thing just different class...

    In ObjectHandler.java
    add this

    Code:
    						  } else {
    					  if (id == 1)
    						  player.getDialogueManager().startDialogue("Crate");
    				  }
    						  break;
    In dialoguehandler.java add this

    Code:
    			Class<Dialogue> value61 = (Class<Dialogue>) Class
    					.forName(Crate.class.getCanonicalName());
    			handledDialogues.put("Crate", value61);
    then after the "Nothing interesting happens" the "break;" part add another "}" Without parenthesis.

    And Make a new class in Dialogues name it "Crate.java"

    Okay, add this to it...

    Code:
    package com.rs.game.player.dialogues;
    
    import com.rs.game.WorldTile;
    
    public class Crate extends Dialogue {
    
    	@Override
    	public void start() {
    		sendDialogue(SEND_2_OPTIONS, "Oh, Would you like to go to Glacors?",
    				"Yes, please, I'd love to go.", "No thanks"); //Change options maybe?
    	}
    
    	public void run(int interfaceId, int componentId) {
    		if (interfaceId == SEND_2_OPTIONS && componentId == 1) {
    			player.setNextWorldTile(new WorldTile(4188, 5720, 0)); //Coordinates you can change
    				sendDialogue(SEND_2_TEXT_CHAT, "",
    						"*The Magic crate teleport's you.", //You can change txt
    						"You feel powerful, as you teleport!");
    			}
    		}
    
    	@Override
    	public void finish() {
    
    	}
    
    }
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~
    Changing the max exp from 15,000,000 to 200,000,000

    Okay, so if you don't know how to do this you should read more tutorial's and just search in your source. So, Most people still got the max xp as 15,000,000 on Matrix. So Goto Skills.java , you see
    "MAXIMUM_EXP" change the exp to 200,000,000 without ",'
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Simple PvP System

    Okay, so many people don't know how to do this and it's simple

    This will make it so if someone kill's someone else the killer will get token's to spend in shop...


    Path:

    (Your source) -> Src blah blah Game - player - player.java search for (killer) under that add

    Code:
    						killer.inventory.addItem(12852, 1);
    There, now someone get's a token when they kill someone now time for shop...

    This is not a tutorial on how to make a shop, so I'll give you the code to make it the shop currency 12852....

    51 12852 false - token's shop - 20072 10 19784 10 //Change the 51 to your shop number you want it as.

    I didn't give you the full work as if you killed someone once already you don't gain tokens, figure that out on your own.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    This will allow potion's in wilderness.

    Wilderness.java...

    Add this code in

    Code:
    	@Override
    	public boolean handleItemOption1(Player playerr, int slotId, int itemId,
    			Item item) {
    		if (itemId != item.getId())
    			return false;
    		switch (itemId) {
    		case -1: //Noobs
    			return false;
    		}
    		return true;
    	}
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
    Adding Flask's so you don't have to!

    Pots.java

    Should be simple where to add in there lol...

    Code:
    
    		OVERLOAD_FLASK(new int[] { 23531, 23532, 23533, 23534, 23535, 23536 }, 
    				Effects.OVERLOAD),
    
    		SUPER_RESTORE_FLASK(new int[] { 23399, 23401, 23403, 23405, 23407, 23409 },
    				Effects.SUPER_RESTORE),
    
    		SUPER_STR_FLASK(new int[] { 23279, 23281, 23283, 23285, 23287, 23289 },
    				Effects.SUPER_STR_POTION),
    
    		SUPER_ATT_FLASK(new int[] { 23255, 23257, 23259, 23261, 23263, 23265 },
    				Effects.SUPER_ATT_POTION),
    
    		SARADOMIN_BREW_FLASK(new int[] { 23351, 23353, 23355, 23357, 23359, 23361 },
    				Effects.SARADOMIN_BREW),
    Yes, easy, but help's some if they're lazy
     


  2. #2  
    Banned

    Join Date
    Mar 2010
    Posts
    1,096
    Thanks given
    214
    Thanks received
    117
    Rep Power
    0
    Okay, I already came up with a new snippet:

    Making Dagannoth king's area Multi

    Goto World.java and search "Multi" Should be the second search you'll see plenty of codes look like this

    "|| (destX" Etc

    Soo Under //godwar's one put this

    Code:
    || (destX >= 2901 && destX <= 2922 && destY >= 4439 && destY <= 4461) // Dagannoth Kings
     

  3. #3  
    Banned
    Join Date
    Mar 2012
    Posts
    123
    Thanks given
    64
    Thanks received
    4
    Rep Power
    0
    gj,edit your post instead .
     

  4. #4  
    Banned

    Join Date
    Mar 2010
    Posts
    1,096
    Thanks given
    214
    Thanks received
    117
    Rep Power
    0
    Okay,
    Edit: Also made Thieving stall do a animation
     

  5. #5  
    Developer

    Join Date
    Jun 2009
    Posts
    793
    Thanks given
    26
    Thanks received
    67
    Rep Power
    11
    Why would you add the thieving in there and not the thieving class?

    Code:
    Stalls(int objectId, int level, int[] item, int amount, double seconds, double experience, int replaceObject) {
    Like...

    Code:
    CustomSTALL(STALLID, LEVELREQ, new int[] { ItemToGive, ItemToGive, ItemToGive, ItemToGive }, Amount, Seconds, Experiance, STALLREPLACEID);
    Want something done? Private message me, but have something to offer.
     

  6. Thankful user:


  7. #6  
    Banned

    Join Date
    Mar 2010
    Posts
    1,096
    Thanks given
    214
    Thanks received
    117
    Rep Power
    0
    Well, I have a class for pickpocketing && Stalls. This is for people who don't know how to operate that.
     

  8. #7  
    Developer

    Join Date
    Jun 2009
    Posts
    793
    Thanks given
    26
    Thanks received
    67
    Rep Power
    11
    It's simple, better to do it this way than add it in this.

    Code:
    CustomSTALL(STALLID, LEVELREQ, new int[] { ItemToGive, ItemToGive, ItemToGive, ItemToGive }, Amount, Seconds, Experiance, STALLREPLACEID);
    Edit: Have you unpacked the NpcSpawns?
    Want something done? Private message me, but have something to offer.
     

  9. Thankful user:


  10. #8  
    Banned

    Join Date
    Mar 2010
    Posts
    1,096
    Thanks given
    214
    Thanks received
    117
    Rep Power
    0
    Quote Originally Posted by JavaGuru View Post
    It's simple, better to do it this way than add it in this.

    Code:
    CustomSTALL(STALLID, LEVELREQ, new int[] { ItemToGive, ItemToGive, ItemToGive, ItemToGive }, Amount, Seconds, Experiance, STALLREPLACEID);
    Edit: Have you unpacked the NpcSpawns?
    yeah
     

  11. #9  
    Registered Member
    Join Date
    Apr 2012
    Posts
    85
    Thanks given
    13
    Thanks received
    8
    Rep Power
    11
    Wow, Not bad, actually helped me a bit.
    Thanks
     

  12. #10  
    Registered Member
    Join Date
    Nov 2011
    Posts
    63
    Thanks given
    4
    Thanks received
    16
    Rep Power
    69
    Is it just me, or do i fail to see any REAL Tutorials in here, instead of just a bunch of Snippets that take 5 seconds?
     

  13. Thankful user:


Page 1 of 5 123 ... LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Azure/Runesource Tutorials/Snippets List
    By Akeid in forum Tutorials
    Replies: 37
    Last Post: 01-03-2013, 07:27 AM
  2. !Mass Tutorials! (667/704) [READ]
    By Free.Graphic.Designer in forum Tutorials
    Replies: 18
    Last Post: 04-05-2012, 04:40 PM
  3. Runespark 667/704 - Soon 667/709
    By 23286027318020 in forum Advertise
    Replies: 23
    Last Post: 03-11-2012, 01:28 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •