Thread: [Dementhium 639] Npc Dicing *Updated*

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1 [Dementhium 639] Npc Dicing *Updated* 
    Registered Member wildking72's Avatar
    Join Date
    Sep 2011
    Age
    27
    Posts
    506
    Thanks given
    62
    Thanks received
    36
    Rep Power
    11
    Give possitive feedback please. If I explained something wrong just correct me.
    There isn't really anything to explain in Dialogue.
    NOTE: You need to get the StackBag snippet by Jilic-Matt

    Go into DialogueManager.java
    this is in src/org/dementhium/content

    First import this
    Code:
    import java.util.Random;
    Search for
    Code:
    switch (id) {
    Under this if you are every wanting an npc to start a dialogue you need to put the case as the npc id

    Under that add
    Code:
    			case 2998: //Gambler
    				sendDialogue(player, HAPPY_TALKING, 2998, 12000, "My bag of cash contains " + player.getStackBag() + " coins.", "Wanna play me for it?");
    				return true;
    This is the Gambler (2998). The number 12000 is the case number it will go to. HAPPY_TALKING is obviously the emotion the npc or you will be showing. Changing 2998 (not the case) will let the player talk.
    I'll show some more emotions at the bottom but you should be able to find them at the very bottom of DialogueManager.java. The player.getStackBag is getting the StackBag method from player.java and sending it into this file.

    Next search for
    Code:
    switch (stage) {
    Under that add
    Code:
    		case 12000:
    		sendOptionDialogue(player, new int[]{12001, -1}, "Alright", "Nah, I'm good");
    			return true;
    This is sending 2 options with 2 arrarys.
    The arrays are 12001 and -1. If the number is -1 than you want it to stop after you click continue if the number is anything else it will go to that case number. Like 12001 is the first option ("Alright") going into case 12001.

    Now under that add
    Code:
    		case 12001:
    		if (!player.getInventory().contains(995)) {
    		sendDialogue(player, MEAN_FACE, 2998, -1, "You need some money to play me!");
    		} else {
    		sendDialogue(player, HAPPY_TALKING, -1, 12002, "Alright.");
    		}
    			return true;
    This is saying if you don't have and coins in your inventory than you won't play
    If statements are like cause and effect. If you don't have this than you will be playing without gambling really
    This "!" in front of this if statement means not or doesn't. You can remove this and figure out what your gonna do next
    Code:
    if (!player.getInventory().contains(995)) {
    Under that add this
    Code:
    		case 12002:
    			World.getWorld().getNpcs().getById(2998).animate(Animation.create(11900, 0));
    			World.getWorld().getNpcs().getById(2998).graphics(Graphic.create(2075, 0));
    			sendDisplayBox(player, 12003, "Rolling...");
    			player.animate(Animation.create(11900, 0));
    			player.graphics(Graphic.create(2075, 0));
    			return true;
    		case 12003:
    		Random dice = new Random();
    		
    		int roll = 0;
    		int npcRoll = 0;
    		
    		for (int counter = 1; counter <= 1; counter++) {
    			roll = 1 + dice.nextInt(100);
    			npcRoll = 1 + dice.nextInt(100);
    
    		if (npcRoll < roll) {
    			sendDialogue(player, WHAT_THE_CRAP, -1, 12004, "Ha loser! I rolled " + roll + " and you got " + npcRoll.);
    		} else if (npcRoll == roll) {
    			sendDialogue(player, MEAN_FACE, 2998, -1, "Shit! How did we tie with " + npcRoll);
    		} else if (npcRoll > roll) {
    			sendDialogue(player, MEAN_FACE, -1, 12005, "Fuck! How did you get " + npcRoll + "?! I only got " + roll + "?!");
    		}
    	}
    			return true;
    his is a for loop. The 1 + dice.nextInt(100); is using the numbers 1 - 100.
    The int counter = 1; counter <= 1; is making it so it will only put out 1 number. The counter++ is incrementing 1.
    I can't really explain anything else about that, so go learn it yourself.
    Code:
    for (int counter = 1; counter <= 1; counter++) {
    			roll = 1 + dice.nextInt(100);
    			npcRoll = 1 + dice.nextInt(100);
    After all that add this
    Code:
    		case 12004:
    			sendDisplayBox(player, -1, "You recieved " + player.getStackBag() + " from the Gambler.");
    			player.getInventory().addItem(StackBag.STORED_STACK, player.getStackBag());
    			return true;
    		case 12005:
    			sendDisplayBox(player, -1, "You lost all of your cash to the Gambler");
    			player.addToBag();
    			return true;
    This is getting the STORED_STACK item from from StackBag.java and giving it to the player. It will give all the coins put into the stackbag.
    Code:
    player.getInventory().addItem(StackBag.STORED_STACK, player.getStackBag());
    Post errors
    The only thing I won't help you with is getting the stackbag through the whole server.
    Like everyone can see the deposits of the lost cash inside his stackbag
    Reply With Quote  
     

  2. #2  
    DystopiaPS

    Bells's Avatar
    Join Date
    Dec 2008
    Age
    27
    Posts
    3,788
    Thanks given
    600
    Thanks received
    1,449
    Rep Power
    4098
    Nice one, thanks.
    Reply With Quote  
     

  3. Thankful users:


  4. #3  
    Registered Member `Basher's Avatar
    Join Date
    May 2011
    Posts
    447
    Thanks given
    136
    Thanks received
    40
    Rep Power
    23
    Cool
    Cheese
    Reply With Quote  
     

  5. Thankful user:


  6. #4  
    Registered Member wildking72's Avatar
    Join Date
    Sep 2011
    Age
    27
    Posts
    506
    Thanks given
    62
    Thanks received
    36
    Rep Power
    11
    Quote Originally Posted by Plos View Post
    Cool
    Thanks. Dude your sig is awesome. I don't even notice "the" 2 times

    @Bells Love it when people say thanks and nice
    Reply With Quote  
     

  7. #5  
    Registered Member wildking72's Avatar
    Join Date
    Sep 2011
    Age
    27
    Posts
    506
    Thanks given
    62
    Thanks received
    36
    Rep Power
    11
    I think I might make it like duel arena stake
    Like if you put that item into the stake and lose than it goes into a bag of his.
    I might use that stackbag thing that Jilic-Matt converted to Dementhium
    Reply With Quote  
     

  8. #6  
    Registered Member
    Santaher0's Avatar
    Join Date
    Sep 2008
    Posts
    2,033
    Thanks given
    324
    Thanks received
    49
    Rep Power
    1282
    Pretty good job on explaining actually, never really saw that many people putting effort in explaining their code that much in detail.
    Good job!
    - Support my project ArkScape

    - Santaher0's MusicBot

    - Santaher0's MovieBot
    Reply With Quote  
     

  9. Thankful user:


  10. #7  
    Member [Dementhium 639] Npc Dicing *Updated* Market Banned

    thesharp's Avatar
    Join Date
    Dec 2010
    Age
    32
    Posts
    1,118
    Thanks given
    311
    Thanks received
    140
    Rep Power
    312
    Here are the graphic and animation ids for the roll
    Code:
      World.getWorld().getNpcs().getById(2998).animate(Animation.create(11900, 0));
                        World.getWorld().getNpcs().getById(2998).graphics(Graphic.create(2075, 0));


    Reply With Quote  
     

  11. Thankful user:


  12. #8  
    Registered Member wildking72's Avatar
    Join Date
    Sep 2011
    Age
    27
    Posts
    506
    Thanks given
    62
    Thanks received
    36
    Rep Power
    11
    Quote Originally Posted by thesharp View Post
    Here are the graphic and animation ids for the roll
    Code:
      World.getWorld().getNpcs().getById(2998).animate(Animation.create(11900, 0));
                        World.getWorld().getNpcs().getById(2998).graphics(Graphic.create(2075, 0));
    Thanks I didn't even think about the npcs even showing their rolling animations
    Reply With Quote  
     

  13. #9  
    Member [Dementhium 639] Npc Dicing *Updated* Market Banned

    thesharp's Avatar
    Join Date
    Dec 2010
    Age
    32
    Posts
    1,118
    Thanks given
    311
    Thanks received
    140
    Rep Power
    312
    Quote Originally Posted by wildking72 View Post
    Thanks I didn't even think about the npcs even showing their rolling animations
    np, I added a complete dicing system on extinction


    Reply With Quote  
     

  14. #10  
    Registered Member wildking72's Avatar
    Join Date
    Sep 2011
    Age
    27
    Posts
    506
    Thanks given
    62
    Thanks received
    36
    Rep Power
    11
    Quote Originally Posted by thesharp View Post
    np, I added a complete dicing system on extinction
    Awesome But you have "I will not playing you at the moment" for the gamber
    Take off "ing"
    Reply With Quote  
     

  15. Thankful user:


Page 1 of 2 12 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. Dicing for Dementhium >_>
    By 'Mystic Flow in forum Snippets
    Replies: 11
    Last Post: 02-21-2012, 09:28 AM
  2. New Way of Dicing
    By Rune13 in forum Chat
    Replies: 4
    Last Post: 12-02-2011, 08:07 PM
  3. Replies: 4
    Last Post: 12-01-2011, 07:27 PM
  4. dicing for dementhium
    By pleasehi in forum Snippets
    Replies: 11
    Last Post: 11-04-2011, 01:49 AM
  5. Dicing..
    By Godzkiller in forum Chat
    Replies: 3
    Last Post: 08-26-2011, 03:52 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •