Thread: How To Make Your Own MiniGame! (and more at the bottom!)

Results 1 to 3 of 3
  1. #1 How To Make Your Own MiniGame! (and more at the bottom!) 
    42
    42 is offline
    Banned

    Join Date
    Feb 2008
    Age
    26
    Posts
    999
    Thanks given
    1
    Thanks received
    11
    Rep Power
    0
    Files Modified: client.java, autospawn.cfg, and npchandler.java
    Difficutly: 5/10

    I am not gonna give you a code I am just going to teach you how it is done!

    Well First if you want to make one with NPC's you would have to add the NPC.
    This Would Be Done By Adding A Code Similar To This in your autospawn.cfg
    1. What this does is it makes the monster spawn on the x and y coords

    Code:
    spawn = NpcId	Xcoord	YCoord	0	0	0	0	0	2	Monster name(for notes)
    2. Now You would have a monster spawning in where ever.
    Now you might want to add a teleport after you kill the monster.
    First You would search something like this in your npchandler.java

    Code:
    public void MonsterDropItem(int NPCID)
    2 and a half. Under that you might see something like this. (can be used for drops)
    Code:
    if(npcs[NPCID].npcType == npcid) {
    ItemHandler.addItem(drops, npcs[NPCID].absX, npcs[NPCID].absY, 1, GetNpcKiller(NPCID), false);
    }
    3. Under that you would want to add something like this.
    This teleports you to the next area once you kill the monster

    Code:
    if(npcs[NPCID].npcType == NPC ID) //Notes
    {
    int Player = npcs[NPCID].StartKilling;
    client ppl = (client) server.playerHandler.players[Player];
    ppl.sendMessage("Put Whatever here");
    ppl.teleportToX = xcoord of place you want to tele to; 
    ppl.teleportToY = ycoord of place you want to tele to;
    }
    4. For this part you need to add a globalobject.
    This will be done in client.java
    Here's what you will need to add

    Code:
            makeGlobalObject(xcoord, y coord, item id, facing, 10); // notes
    5. Now is where you add your reward.
    you would add this in your client.java with the rest of your cases.
    this give you a reward for doing something

    Code:
    case object id(globalobject): // Notes
    {
    sendMessage("You grab your (item)");
    sendMessage("you get strangely teleported");
    addItem(item, amount);
    teleportToX = xcoord tele at end;
    teleportToY = ycoord tele at end;
    PlayerHandler.messageToAll = playerName+ " has just got there (item here)";
    heightLevel = 0;
    startAnimation(862);
    }
    break;
    6. Here is the another thing,
    this will make the monsters attack you
    we need to go back to npchandler.java
    search

    Code:
    if (server.playerHandler.players[Player].IsDead == true) {
    Scroll down and you will see something like this
    Code:
                                                    } else if (npcs[NPCID].npcType == 18) {
    							npcs[NPCID].animNumber = 451; //Al-K'harid Warrior Attack
                                                            hitDiff = 4 + misc.random(2);
    Under all of that you need to add something like this.
    Code:
    						} else if (npcs[NPCID].npcType == npcid) {
                                                            npcs[NPCID].animNumber = (emote number) //notes
                                                            hitDiff = 4 + misc.random(7);
    7. Last thing you need a command to get to the place
    Code:
    			else if(command.startsWith("name of command")) {//notes
    				teleportToX = xcoord;
    				teleportToY = ycoord;
    				sendMessage("minigame");
    				sendMessage("whatever");
    			}


    [size=14pt]I ADMIT THIS IS NOT THAT NOOB FRIENDLY, HOWEVER IT DOES TEACH YOU HOW TO DO SOMETHING!
    If this break any rules I am terribly sorry
    [/size]



    Here Are some extra guides to help you if you want more editing. How to fix problems, etc...


    Guide 1:

    Difficulty: 1\10

    [size=14pt]First lets start out on how to add drops to monsters.[/size]

    First things first. Find NPChandler.java and Item2.java in your server folder.

    Inside your Item2.java you'll see ints that look like this:


    Code:
    public static int rat[] = {5698,1305,3105,1725,1704,1323,1153,1115,1067,1081,1157,1119,1069,1083};
    
        public static int randomrat()
        {
        	return rat[(int)(Math.random()*rat.length)];
        }

    This is very simple. Inside the { } are the ID's of the items in order of being dropped first to last.

    If I wanted to make a new monster drop items, maybe like a goblin drop partyhats I would make something like this:

    Code:
    
    public static int Goblin[] = {1038,1040,1042,1044};
    
        public static int randomGoblin()
        {
        	return Goblin[(int)(Math.random()*Goblin.length)];
        }

    I would put that underneath any other public static int right below the last }

    The Item2.java specifies which items are going to be dropped by probability

    Now for part 2, Go into NPChandler.java

    This is where we specify the ID of the monster.

    You should see something similar to this:

    Code:
    
    if(npcs[NPCID].npcType == NPCID) {
    ItemHandler.addItem(Item2.randomGoblin(), npcs[NPCID].absX, npcs[NPCID].absY, 1, GetNpcKiller(NPCID), false);
    }

    That would be the second part to complete the Item2.java so the NPC actually drops the items.

    So lets summarize this back up.

    NPCHandler.java specifies the NPC's ID

    The Item2.java Specifies the items being dropped by probability
    Guide 2: Setting safe zones

    Difficulty 4\10

    (Just read it, and read it. It will make sense)

    First we open up Client.java

    Press in Ctrl + f and then type in


    Code:
    
    public boolean nonWild() {
    This is where we specify the areas that are nonwild.
    How we do this is with X and Y Co-ordinates.

    It works in a square (I mean that literally)
    Here, I drew out a picture in a paint to emphasize what I am saying.


    What we do first is, get a piece of paper, draw a square or rectangle.
    Go to the bottom left corner of the building first.Write down the X and Y Co-ordinates.

    Then go to the top right corner of the building. Get the X and Y Co-Ordinates of that corner.



    In the Picture, you can clearly see where the X and Y Co-ordinates go.

    Just in case it's unclear, I'll write it out for you.

    Key:
    BotLeftX = Bottom left hand corner X Co-ordinate
    BotLeftY = Bottom left hand corner Y Co-ordinate

    TopRightX = Top Right hand corner X Co-ordinate
    TopRightY = Top Right hand corner Y Co-ordinate

    ||(absX >=BotLeftX && absX <= TopRightX && absY >= BotLeftY && absY <=TopRightY ) ||

    That's it for safe zones.

    Guide 3: Item bonuses, Item prices, Item names.
    Difficulty 1\10

    First open Item.cfg in your server folder.

    Youll see something like this:


    Code:
    
    item = 15156	Dark_Bow		A_Dark_Bow.		4000000	4000000	4000000	0	0	0	120	91	0	0	0	0	0	86	0
    To add a new item just copy a line and paste it at the end.
    Change item = 15156 to the new item ID.

    Heres an example:


    Code:
    
    item = 15336	Zamorak_Godsword		A_Godsword.		4000000	4000000	4000000	0	132	0	0	0	0	0	0	0	0	132	0
    This too is very simple and easy to understand.
    item = 15336 is the ID of the Zamorak Godsword
    The second part Zamorak_Godsword is the Name it has in the tab where you can toggle accurate slash or defensive.

    A_Godsword is the examine information.

    By adding this, it will no longer say NON EXISTING ITEM, on the second trade window.

    Okay lets get back to the actual code.

    The numbers 4000000 are the amount of gold it will cost to buy it from a shop or the amount of gold you will receive if you high alch the item.

    The next 12 numbers are the bonuses.

    The bonuses start on the left side with stab bonus down to range bonus.
    Then it goes to the other side and starts with the defense bonus of stab down to the defense bonus of range. So far there are 10 bonuses covered.

    The last 2 are Strength and Prayer. Strength comes first then Prayer on the right side.

    As you can see in the Zamorak Godsword, the slash bonus is 132 and the strength bonus is 130


    Code:
    
    item = 15336	Zamorak_Godsword		A_Godsword.		4000000	4000000	4000000	0	132	0	0	0	0	0	0	0	0	130	0
    That's it for Item.cfg

    Guide 4: Item.java and Item4.java (depending upon if you have added an item4.java from Tico135's tutorial)

    This is where we specify where the equip able items into their correct equipment spots.

    This is very simple as well.

    You will see

    Code:
    
    public static int capes[] = {

    This makes it so if you put a cape inside of the { }
    the cape will equip in the cape equipment spot.

    This is the same for all of them.

    There are a few things you should know as well.

    If the Item is a platebody you will put it in public static int platebody[] = as well as public static int body[] =

    This will terminate the glitch of your sleeves showing through the platebody.

    Now onto Helmets. For all helmets and hats you will put it into public static int hats[] =

    This is where it changes, if the item is a fullhelm you will put it into public static int fullhelm[] = as well as public int hats[] =

    This is the same for fullmasks.



    Guide 5: Explaining areas will you will not lose any items if you die.
    Classes modified: Client.java
    Difficulty 2\10 (just follow instructions)

    This works the same as making nonwild. So heres the Key again:

    Key:
    BotLeftX = Bottom left hand corner X Co-ordinate
    BotLeftY = Bottom left hand corner Y Co-ordinate

    TopRightX = Top Right hand corner X Co-ordinate
    TopRightY = Top Right hand corner Y Co-ordinate

    Let's start off declaring the boolean.

    Code:
    
    public boolean funPk() {
    	if(absX >= BotLeftX && TopRightx<= 2431 && absY >= BotLeftY && absY <= TopRightY)
    	return true;
    	else
    		return false;
    }

    That's only the first part.
    Now inside your client.java again,
    Search for

    Code:
    
    public void youdied()

    You will see something similar to this (Mine may look a tad bit different)

    Code:
    
    public void youdied()
    		{
    for(int r=0; r<playerEquipment.length; r++) {
    	try {
    		int item = playerEquipment[r];
    		if((item > 0) && (item < 20000)) {
    			remove(item, r);
    		}
    	} catch(Exception e) { sendMessage("ERROR: Removing Equipment"); }
    }
    for(int rr=0; rr<playerItems.length; rr++) {
    	try {
    		if(playerItems[rr] > 0 && playerItems[rr] < 20000) {
    			//createItem(currentX,currentY,playerItems[rr]-1);
    			ItemHandler.addItem(playerItems[rr]-1, absX, absY, playerItemsN[rr], KillerId, false);
                            //createGroundItem(playerItems[rr]-1, absX, absY, playerItemsN[i]);
    			deleteItem(playerItems[rr]-1, getItemSlot(playerItems[rr]-1), playerItemsN[rr]); 
    		}
    	} catch(Exception e) {  }
    }
    removeAllItems();
    for(int r=0; r<playerEquipment.length; r++) {
    	try {
    		int item = playerEquipment[r];
    		if((item > 0) && (item < 20000)) {
    			remove(item, r);
    		}
    	} catch(Exception e) { sendMessage("ERROR: Removing Equipment"); }
    }
    for(int rr=0; rr<playerItems.length; rr++) {
    	try {
    		if(playerItems[rr] > 0 && playerItems[rr] < 20000) {
    			//createItem(currentX,currentY,playerItems[rr]-1);
    			ItemHandler.addItem(playerItems[rr]-1, absX, absY, playerItemsN[rr], KillerId, false);
                            //createGroundItem(playerItems[rr]-1, absX, absY, playerItemsN[i]);
    			deleteItem(playerItems[rr]-1, getItemSlot(playerItems[rr]-1), playerItemsN[rr]); 
    		}
    	} catch(Exception e) {  }
    }
    Just below the Last } of
    Code:
    
    public void youdied()
    		{
    for(int r=0; r<playerEquipment.length; r++) {
    	try {
    		int item = playerEquipment[r];
    		if((item > 0) && (item < 20000)) {
    			remove(item, r);
    		}
    	} catch(Exception e) { sendMessage("ERROR: Removing Equipment"); }
    }
    Add this:

    Code:
    if(funPk()) {
    		teleportToX = X-Coord;
    		teleportToY = X-Coord;
    		heightLevel = 0;
    		//pEmote = 15;
    		//pWalk = 13;
    		sendMessage("Oh dear you died!");
    		hitDiff = 0;	
    		updateRequired = true; 
                    appearanceUpdateRequired = true;
    	       } else if(!funPk()) {

    Note: Where I have labeled X-Coord and Y-Coord you must change those to the point where you wish to respawn.

    This is what mine looks like. (Also, make sure you add a } at the end of the whole void)


    Code:
    
    public void youdied()
    		{
    for(int r=0; r<playerEquipment.length; r++) {
    	try {
    		int item = playerEquipment[r];
    		if((item > 0) && (item < 20000)) {
    			remove(item, r);
    		}
    	} catch(Exception e) { sendMessage("ERROR: Removing Equipment"); }
    }if(funPk()) {
    		teleportToX = 2611;
    		teleportToY = 3092;
    		heightLevel = 0;
    		//pEmote = 15;
    		//pWalk = 13;
    		sendMessage("Oh dear you died!");
    		hitDiff = 0;	
    		updateRequired = true; appearanceUpdateRequired = true;
    	} else if(!funPk()) {
    for(int rr=0; rr<playerItems.length; rr++) {
    	try {
    		if(playerItems[rr] > 0 && playerItems[rr] < 20000) {
    			//createItem(currentX,currentY,playerItems[rr]-1);
    			ItemHandler.addItem(playerItems[rr]-1, absX, absY, playerItemsN[rr], KillerId, false);
                            //createGroundItem(playerItems[rr]-1, absX, absY, playerItemsN[i]);
    			deleteItem(playerItems[rr]-1, getItemSlot(playerItems[rr]-1), playerItemsN[rr]); 
    		}
    	} catch(Exception e) {  }
    }
    removeAllItems();
    for(int r=0; r<playerEquipment.length; r++) {
    	try {
    		int item = playerEquipment[r];
    		if((item > 0) && (item < 20000)) {
    			remove(item, r);
    		}
    	} catch(Exception e) { sendMessage("ERROR: Removing Equipment"); }
    }
    for(int rr=0; rr<playerItems.length; rr++) {
    	try {
    		if(playerItems[rr] > 0 && playerItems[rr] < 20000) {
    			//createItem(currentX,currentY,playerItems[rr]-1);
    			ItemHandler.addItem(playerItems[rr]-1, absX, absY, playerItemsN[rr], KillerId, false);
                            //createGroundItem(playerItems[rr]-1, absX, absY, playerItemsN[i]);
    			deleteItem(playerItems[rr]-1, getItemSlot(playerItems[rr]-1), playerItemsN[rr]); 
    		}
    	} catch(Exception e) {  }
    }
    removeAllItems();
    			teleportToX = X-Coord;
    			teleportToY = Y-Coord;
    			//pEmote = 15;
    			//pWalk = 13;
    			sendMessage("Oh dear you died!");
    			hitDiff = 0;	
    			updateRequired = true; appearanceUpdateRequired = true;
    		}
    }
    Thanks,
    MrMoney
     

  2. #2  
    Registered Member

    Join Date
    Dec 2006
    Age
    27
    Posts
    1,508
    Thanks given
    5
    Thanks received
    0
    Rep Power
    141
    Ooh, nice job. Pictures please?
    I don't play RuneScape anymore
     

  3. #3  
    42
    42 is offline
    Banned

    Join Date
    Feb 2008
    Age
    26
    Posts
    999
    Thanks given
    1
    Thanks received
    11
    Rep Power
    0
    Quote Originally Posted by Liam View Post
    Ooh, nice job. Pictures please?
    I can't really post pictures.
    This makes any minigame you choose it to make.
    So if you want to make a minigame with it and post your pictures that would be nice.
     


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
  •