Thread: Stall stealing my own way...

Results 1 to 8 of 8
  1. #1 Stall stealing my own way... 
    Donator

    tj007razor's Avatar
    Join Date
    Feb 2007
    Posts
    895
    Thanks given
    2
    Thanks received
    9
    Rep Power
    210
    Make what you want with it...

    I used custom GFX but you get the point.
    Code:
    	// tj007razor: stall stealing
    	public void stealStall(int itemAdd, int amountAdd, int multXP, int req, int gfx, String SM) {
    		if (actionTimer == 0) {
    			if (playerLevel[17] >= req) {
    				sendMessage("You attempt to steal from the stall...");
    				int chance = 3;
    				if (playerLevel[17] >= 12) chance = server.random.nextInt((int)(playerLevel[17]/4))+1;
    				if (server.random.nextInt(chance) == 1) {
    					sendMessage("...and you spring the trap!");
    					gfx100(76);
    					setAnimation(3170);
    					hitDiff = server.random.nextInt(10);
    					updateRequired = true;
    					hitUpdateRequired = true;
    				}else{
    					if (gfx > 0) gfx100(gfx);
    					addItem(itemAdd, amountAdd);
    					setAnimation(881);
    					sendMessage(SM);
    					addSkillXP((multXP*playerLevel[17]), 17);
    					actionTimer = 8;
    				}
    			}else{
    				sendMessage("You need " + req + "+ theiving to steal from this stall!");
    			}
    			actionTimer = 8;
    		}
    	}
    	// end stall stealing
    As an example of how to use it:
    Code:
    case 4874: // crafting stall
    	stealStall(995, 25000, 100, 0, 0, "...and steal some money.");
    break;
    If you don't have random declared in the server class, you can change them to misc.random or just add it.
    add the import
    Code:
    import java.util.Random;
    then the actual random object:
    Code:
    public static Random random = new Random(System.currentTimeMillis()); // personally think this is a better random system then misc.random(a.k.a Math.random)
    in the server class of course.

    Pics:


    [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ] | [Only registered and activated users can see links. ] | [Only registered and activated users can see links. ]
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Sep 2008
    Posts
    328
    Thanks given
    32
    Thanks received
    8
    Rep Power
    146
    Rofl nice! mts
    Reply With Quote  
     

  3. #3  
    Banned

    Join Date
    Mar 2008
    Posts
    2,595
    Thanks given
    128
    Thanks received
    191
    Rep Power
    0
    Nice, you should make one that gives random items (like a seed stall doesn't just give one type of seed)
    Reply With Quote  
     

  4. #4  
    Donator

    tj007razor's Avatar
    Join Date
    Feb 2007
    Posts
    895
    Thanks given
    2
    Thanks received
    9
    Rep Power
    210
    Quote Originally Posted by filth jr View Post
    Nice, you should make one that gives random items (like a seed stall doesn't just give one type of seed)
    I have one, I just didn't feel like posting it as this is just meant as an idea.

    [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ] | [Only registered and activated users can see links. ] | [Only registered and activated users can see links. ]
    Reply With Quote  
     

  5. #5  
    Registered Member

    Join Date
    Aug 2007
    Posts
    2,395
    Thanks given
    2
    Thanks received
    63
    Rep Power
    558
    Well done, but use longs instead of ints to prevent massing trough the actionTimer
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  6. #6  
    Donator

    tj007razor's Avatar
    Join Date
    Feb 2007
    Posts
    895
    Thanks given
    2
    Thanks received
    9
    Rep Power
    210
    Quote Originally Posted by Jonas++ View Post
    Well done, but use longs instead of ints to prevent massing trough the actionTimer
    If you fixed processing, it is impossible to mass through the actionTimer.

    [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ] | [Only registered and activated users can see links. ] | [Only registered and activated users can see links. ]
    Reply With Quote  
     

  7. #7  
    Registered Member

    Join Date
    Jun 2007
    Posts
    759
    Thanks given
    1
    Thanks received
    20
    Rep Power
    226
    Code:
    stealStall(995, 25000, 100, 0, 0, "...and steal some money.");
    995 = cash
    25000 = the money given
    100 = xp

    what are the zero's for?
    Reply With Quote  
     

  8. #8  
    Donator

    tj007razor's Avatar
    Join Date
    Feb 2007
    Posts
    895
    Thanks given
    2
    Thanks received
    9
    Rep Power
    210
    the level requirement and GFX to do, 0 means none.

    [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ] | [Only registered and activated users can see links. ] | [Only registered and activated users can see links. ]
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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

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