Thread: Add magic easier and faster!

Page 1 of 4 123 ... LastLast
Results 1 to 10 of 39
  1. #1 Add magic (fast!) 
    Bloodraider
    Guest
    ANNOUNCEMENT: I am currently working on 100% magic. This void does NOT work exactly like it does in runscape for every spell. I'll be making 100% magic; and then releasing once I finish. You can use this for now; but it's not 100%


    Description: Well; this isn't exactly a tutorial; but I got bored and decided to write a void to reduce the space magic spells take in your server.

    Difficulty: 1

    Assumed Knowledge: There is nothing you need to know before doing this.

    Tested Server: Cleaned V4 - SHOULD work on all

    Files/Classes Modified:
    Client.Java

    Procedure

    Part One: Combat Spells
    Step 1: Add this void to client.java ABOVE
    Code:
    process() {
    Code:
    public void castTheSpell(int req, int xp, int r1, int a1, int r2, int a2, int r3, int a3, int r4, int a4, int ba, int ra, int anim, int gfx) {
    	int EnemyX2 = PlayerHandler.players[AttackingOn].absX;
    	int EnemyY2 = PlayerHandler.players[AttackingOn].absY;
    	if (playerLevel[6] > req) {
    		if((!playerHasItemAmount(r1, a1)) || (!playerHasItemAmount(r2, a2)) || (!playerHasItemAmount(r3, a3)) || (!playerHasItemAmount(r4, a4))) {
    			sendMessage("You do not have the required runes to cast this spell.");	
    		}
    		if((playerHasItemAmount(r1, a1)) && (playerHasItemAmount(r2, a2)) && (playerHasItemAmount(r3, a3)) && (playerHasItemAmount(r4, a4))) {
    			hitDiff = ba + misc.random(ra);
    			setAnimation(anim);
    			addSkillXP(xp, 6);
    			deleteItem(r1, getItemSlot(r1), a1);
    			deleteItem(r2, getItemSlot(r2), a2);
    			deleteItem(r3, getItemSlot(r3), a3);
    			deleteItem(r4, getItemSlot(r4), a4);
    			stillgfx(gfx, EnemyY2, EnemyX2);
    		}
    } else {
    	sendMessage("You need a magic level of " +req+ " to use this spell");
    }
    }
    Step 2: Now go to where your magic spells are located at. You should see something similar to the void I just gave you. Use the information from the spells you already have to re-write the spells using the void.

    Explanation: The new void reduces the size of your spell a lot. Deleting a ton of lines but you may be slightly confused on what to do. Here's an explanation of everything.

    Code:
    req: The level required to cast the spell
    xp: The base experience gained for casting the spell (without hit exp)
    r1: The first rune type needed to cast the spell
    a1: The amount of the first rune needed to cast the spell
    r2: The second rune type needed to cast the spell
    a2: The amount of the second rune needed to cast the spell
    r3: The third type of rune needed to cast the spell
    a3: The amount of the third rune needed to cast the spell
    r4: The fourth type of rune needed to cast the spell
    a4: The amount of the fourth type of rune needed to cast the spell
    ba: The minimum (base) amount of damage done in a spell
    ra: The varying damage added to the base of the spell
    anim: The animation your character will do when you cast the spell
    gfx: The gfx that appears on your enemy (barrage cube for example)
    Example: Heres an example using ice barrage
    Code:
    if(magicID == 12891) { castTheSpell(94, 250, 560, 4, 565, 2, 555, 6, -1, 0, 5, 25, 1979, 369); } //Ice Barrage
    Note: If a rune is not needed; Set the ID to -1. And the amount to 0.

    Credits: Me: Whoever made the original spell design.



    Part Two: Teleport Spells
    Step 1:Add this void above
    Code:
    process() {
    Code:
    public void castTheTele(int req, int xp, int gfx, int x, int y, int hl, int r1, int a1, int r2, int a2, int r3, int a3) {
    	if (playerLevel[6] >= req) {
    		if((!playerHasItemAmount(r1, a1)) || (!playerHasItemAmount(r2, a2)) || (!playerHasItemAmount(r3, a3))) {
    			sendMessage("You do not have the required runes to cast this spell.");
    		}
    		if((playerHasItemAmount(r1, a1)) && (playerHasItemAmount(r2, a2)) && (playerHasItemAmount(r3, a3))) {
    			addSkillXP(xp, 6);
    			teleportToX = x;
    			teleportToY = y;
    			heightLevel = hl;
    			deleteItem(r1, getItemSlot(r1), a1);
    			deleteItem(r2, getItemSlot(r2), a2);
    			deleteItem(r3, getItemSlot(r3), a3);
    			stillgfx(gfx, absX, absY); //308 = Regular -- 392 = Ancients
    		}
    	}
    	sendMessage("You need a magic level of " +req+ " to cast this spell.");
    }
    Step 2: Teleport spells are found in case 185 (I believe) Add the spells in there.

    Explanation:This, like the combat spells, significantly reduces the amount of coding needed to make a spell. Here's an explanation of what everything does.

    Code:
    req: The magic level needed to cast the spell
    xp: The experience gained when you cast the spell
    gfx: The gfx when you teleport. (Like the purple cube for ancients)
    x: The X coordinate you get teleported to
    y: The Y coordinate you get teleported to
    hl: The hight level you get teleported to (in most cases; this is 0)
    r1: The first rune type needed to cast the spell
    a1: The amount of the first rune needed to cast the spell
    r2: The second rune type needed to cast the spell
    a2: The amount of the second rune needed to cast the spell
    r3: The third type of rune needed to cast the spell
    a3: The amount of the third rune needed to cast the spell
    Example: Here's an example using the falador teleport.
    Code:
    case 4146: castTheTele(37, 150, 308, 2965, 3379, 0, 555, 1, 556, 3, 563, 1); break; //Falador Teleport
    Note: If a third rune is not needed; Set the ID to -1. And the amount to 0.

    Credit: Me... I guess
    Last edited by Bloodraider; 06-22-2008 at 02:16 AM. Reason: Double posting is not allowed!
     

  2. #2  
    Registered Member

    Join Date
    Jan 2008
    Age
    28
    Posts
    1,380
    Thanks given
    76
    Thanks received
    384
    Rep Power
    962
    Pretty cool i'll rep for this
     

  3. #3  
    I LOVE CHEESE


    Join Date
    Oct 2007
    Age
    26
    Posts
    1,153
    Thanks given
    7
    Thanks received
    8
    Rep Power
    104
    nice gj on this u could make 1 for modern spell or ones that use projectile


     

  4. #4  
    Officially Retired


    Join Date
    Oct 2007
    Age
    27
    Posts
    5,456
    Thanks given
    558
    Thanks received
    122
    Rep Power
    1364
    pretty good
     

  5. #5  
    Bloodraider
    Guest
    Thanks for comments.

    I'm going to start 100% magic now (w/ projectiles and everything) I finished about 20 spells already. takes up the space that one does
     

  6. #6  
    I LOVE CHEESE


    Join Date
    Oct 2007
    Age
    26
    Posts
    1,153
    Thanks given
    7
    Thanks received
    8
    Rep Power
    104
    rep+ though lol ill start adding all non-projectile spell now 8godspells and some ancients )


     

  7. #7  
    Bloodraider
    Guest
    Quote Originally Posted by ♣Man0l0♣ View Post
    rep+ though lol ill start adding all non-projectile spell now 8godspells and some ancients )
    Alright I've just started 100% lol. I got all spell Id's setup. and I'm about 20% done w/ ancients already. 100% coming soon
     

  8. #8  
    I LOVE CHEESE


    Join Date
    Oct 2007
    Age
    26
    Posts
    1,153
    Thanks given
    7
    Thanks received
    8
    Rep Power
    104
    would u mind pming a list will all spell ids ? plz ? just repped u soz i did forgot to rep u before


     

  9. #9  
    Bloodraider
    Guest
    Quote Originally Posted by ♣Man0l0♣ View Post
    would u mind pming a list will all spell ids ? plz ? just repped u soz i did forgot to rep u before
    I need them too I'm just using cleaned v4 and it prints the spell ID when you use it =\ lol.
     

  10. #10  
    I LOVE CHEESE


    Join Date
    Oct 2007
    Age
    26
    Posts
    1,153
    Thanks given
    7
    Thanks received
    8
    Rep Power
    104
    lol ill do the same


     

Page 1 of 4 123 ... LastLast

Thread Information
Users Browsing this Thread

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


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •