Thread: Best Dialogue System{3x better than yours}

Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1 Best Dialogue System{3x better than yours} 
    Registered Member
    wizzyt21's Avatar
    Join Date
    Aug 2007
    Posts
    1,167
    Thanks given
    49
    Thanks received
    12
    Rep Power
    156
    Integrigating your server with my Cheezscape pk Revamped dialogue system..
    To add:
    First, go into process, find and delete:
    Code:
    		if (NpcWanneTalk == 2)
    		{ // Bank Booth
    			if (GoodDistance2(absX, absY, skillX, skillY, 1) == true)
    			{
    				NpcDialogue = 1;
    				NpcTalkTo = GetNPCID(skillX, (skillY - 1));
    				NpcWanneTalk = 0;
    			}
    		}
    		else if (NpcWanneTalk > 0)
    		{
    			if (GoodDistance2(absX, absY, skillX, skillY, 1) == true)
    			{
    				NpcDialogue = NpcWanneTalk;
    				NpcTalkTo = GetNPCID(skillX, skillY);
    				NpcWanneTalk = 0;
    			}
    		}
    		
    		if (NpcDialogue > 0 && NpcDialogueSend == false)
    		{
    			/* W/E IN HERE */
    		}
    And once you have deleted that, add this into process:
    Code:
    		if (conversationId > 0 && inDialogue) dialogueUpdate();
    Simple.
    Now, create a new class, call it Dialogue, then add this to it:
    Code:
    /**
     * Possibly another smart class =)
     * @author momosherilly
     * Handles dialogues and dialogue clicks..
     */
    public class Dialogue
    {
    	public int pId = 0;
    	public Dialogue(int pId)
    	{
    		this.pId = pId;
    	}
    	public void optionSelect(int actionButtonId)
    	{
    		client p = (client) server.playerHandler.players[pId];
    		switch (actionButtonId)
    		{
    			case 9157 :/* Two options - 1/2 */
    				switch (p.conversationId)
    				{
    					case 2 :
    						p.startDialogue(3, p.talkId);
    					break;
    				}
    			break;
    			case 9158 :/* Two options - 2/2 */
    				switch (p.conversationId)
    				{
    					case 2 :
    						p.startDialogue(4, p.talkId);
    					break;
    				}
    			break;
    		}
    	}
    	public void dialogueClick(int conversationId, int dialogueId)
    	{
    		client p = (client) server.playerHandler.players[pId];
    		if (!p.GoodDistance(p.absX, p.absY, p.packetClickX, p.packetClickY, 1)) return;
    		switch (conversationId)
    		{
    			case 1 :
    				/* Calls for the next dialogue */
    				nextDialogue();
    			break;
    			/*
    			 * If anything is not set on top, then close dialogue.. Give creds to momo!
    			 */
    			default :
    				stopDialogue();
    		}
    	}
    	public void startDialogue(int conversationId, int x, int y)
    	{
    		client p = (client) server.playerHandler.players[pId];
    		switch (conversationId)
    		{
    			/*
    			 * Testing..
    			 */
    			case 1 :
    				p.NTalk1Momo("Haa - Haa- Haa! Hello "+p.playerName, 606);
    			break;
    			case 2 :
    				p.POption2Momo("Hello..", "Goodbye..");
    			break;
    			case 3 :
    				p.PTalk1Momo("Hello..",  592);
    			break;
    			case 4 :
    				p.PTalk1Momo("Haa - Haa - Haa! Good bye.", 592);
    			break;
    		}
    	}
    	public void nextDialogue()
    	{
    		client p = (client) server.playerHandler.players[pId];
    		p.conversationId++;
    		p.dialogueUpdate();
    		return;
    	}
    	public void stopDialogue()
    	{
    		client p = (client) server.playerHandler.players[pId];
    		p.conversationId = -1;
    		p.talkId = -1;
    		p.talkingToNPC = -1;
    		p.inDialogue = false;
    		p.removeScreens();
    		return;
    	}
    }
    Now, add this into client:
    Code:
    	public int talkId = 0;
    	public void removeScreens()
    	{
    		outStream.createFrame(219);
    		flushOutStream();
    	}
    	public void startDialogue(int convoId, int talkingId)
    	{
    		conversationId = convoId;
    		dialogueId = 1;
    		talkId = talkingId;
    		inDialogue = true;
    		dialogueUpdate();
    	}
    	public void PTalk1Momo(String text, int anim)
    	{ // Player talk
    		// You don't need for now, playerName = misc.fixCase(playerName);
    		sendFrame200(969, anim);
    		sendFrame126(playerName.replaceAll("_", " "), 970);
    		sendFrame126(text, 971);
    		sendFrame185(969);
    		sendFrame164(968);
    	}
    	public void NTalk1Momo(String text, int anim)
    	{ // NPC talk
    		sendFrame200(4883, anim);
    		sendFrame126(GetNpcName(talkId).replaceAll("_", " "), 4884);
    		sendFrame126(text, 4885);
    		sendFrame75(talkId, 4883);
    		sendFrame164(4882);
    	}
    	public void POption2Momo(String text, String text2)
    	{ // Player 2 options
    		sendFrame126(text, 2461);
    		sendFrame126(text2, 2462);
    		sendFrame164(2459);
    	}
    	public void dialogueUpdate()
    	{
    		/* 
    		 * Created by momosherilly..
    		 */
    		new Dialogue(playerId).startDialogue(conversationId, skillX, skillY);
    		inDialogue = false;
    		
    	}
    Then add this into Player:
    Code:
    	public int conversationId = 0;
    	public int talkingToNPC = 0;
    	public boolean inDialogue = false;
    	public int dialogueId = 0;
    Now find:
    Code:
    parseIncomingPackets()
    and replace statement switch 40, to this:
    Code:
    			/*
    			 * Handled AGAIN now WAY MORE CLEANER DIALOGUE SYSTEM -BY MOMOSHERILLY <(^.^)>
    			 */
    			case 40 :
    				new Dialogue(playerId).dialogueClick(conversationId, dialogueId);
    			break;
    Now go edit action buttons(case 185), and replace these statement switches(if you have them):
    Code:
    					case 9157 :
    					case 9158 :
    						new Dialogue(playerId).optionSelect(actionButtonId);
    					break;
    Now find:
    Code:
    // walk on command
    and add this under it:
    Code:
    					/*
    					 * NEW DIALOGUE BASE BY MOMOSHERILLY!
    					 */
    					if (conversationId > 0)
    					{
    						conversationId = 0;
    						talkingToNPC = 0;
    						talkId = 0;
    						inDialogue = false;
    						removeScreens();
    					}
    To use:
    Just use:
    Code:
    skillX = server.npcHandler.npcs[NPCSlot].absX;
    skillY = server.npcHandler.npcs[NPCSlot].absY;
    startDialogue(## CONVERSATION ID ##, THE NPC);
    Any errors, anything missing, if it doesn't seem to work, or you need help, post!

    Oh, example(BANKERS){Add this in case 155 - search for parseIncomingPackets()}:
    Code:
    if(NPCID >= 494 && NPCID <= 495) startDialogue(1, NPCID);
    Last edited by wizzyt21; 11-27-2008 at 08:27 AM. Reason: Double posting is not allowed!
    YOU JUST GOT KNOCKED THE F*CK UP.
     

  2. #2  
    Banned

    Join Date
    Oct 2007
    Posts
    1,406
    Thanks given
    37
    Thanks received
    79
    Rep Power
    0
    i am going to test this out hope it works very well.
     

  3. #3  
    Registered Member

    Join Date
    Jun 2007
    Posts
    2,237
    Thanks given
    267
    Thanks received
    411
    Rep Power
    1283
    Code:
    public void stopDialogue()
    	{
    		client p = (client) server.playerHandler.players[pId];
    		p.conversationId = -1;
    		p.talkId = -1;
    		p.talkingToNPC = -1;
    		p.inDialogue = false;
    		p.removeScreens();
    		return;
    	}
    Why are you using return at the end of the method?

    Code:
    if(NPCID >= 494 && NPCID <= 495)
    Code:
    if(NPCID == 494 && NPCID == 495)
    Don't worry, Be happy.
     

  4. #4  
    Registered Member

    Join Date
    Jan 2008
    Age
    28
    Posts
    1,380
    Thanks given
    76
    Thanks received
    384
    Rep Power
    962
    Omg, this hurt my eyes no joke. Why would you use process?

    Also, if you're going to make if (sooo && thiissooo) { statements it goes like this.

    Code:
    if ((sooo) && (thissooo)) {
    //codes here
    }
    if I'm not mistaken?

    or just

    Code:
    if (sooo) && (thissooo) {
    //codes here
    }
    Not sure this one would work but probably lol.
     

  5. #5  
    Registered Member runescapedds's Avatar
    Join Date
    Jan 2008
    Posts
    514
    Thanks given
    9
    Thanks received
    2
    Rep Power
    41
    nice gj with the chesescape revampt lol
    [IMG]pokeplushies.com/images/adoptables/312899.gif[/IMG]

    [Only registered and activated users can see links. ] << level my plushie please
     

  6. #6  
    Extreme Donator

    Patrity's Avatar
    Join Date
    Jul 2008
    Age
    28
    Posts
    937
    Thanks given
    173
    Thanks received
    306
    Discord
    View profile
    Rep Power
    882
    Quote Originally Posted by BFMV View Post
    Omg, this hurt my eyes no joke. Why would you use process?

    Also, if you're going to make if (sooo && thiissooo) { statements it goes like this.

    Code:
    if ((sooo) && (thissooo)) {
    //codes here
    }
    if I'm not mistaken?

    or just

    Code:
    if (sooo) && (thissooo) {
    //codes here
    }
    Not sure this one would work but probably lol.
    not true.. like if its only one line. you dont use brackets. if theres more than one line of code you want to include in the if statement then u must have brackets
    Free map releases: [Only registered and activated users can see links. ]



    [Only registered and activated users can see links. ]
     

  7. #7  
    Registered Member
    wizzyt21's Avatar
    Join Date
    Aug 2007
    Posts
    1,167
    Thanks given
    49
    Thanks received
    12
    Rep Power
    156
    Quote Originally Posted by Daniel View Post
    Code:
    public void stopDialogue()
    	{
    		client p = (client) server.playerHandler.players[pId];
    		p.conversationId = -1;
    		p.talkId = -1;
    		p.talkingToNPC = -1;
    		p.inDialogue = false;
    		p.removeScreens();
    		return;
    	}
    Why are you using return at the end of the method?

    Code:
    if(NPCID >= 494 && NPCID <= 495)
    Code:
    if(NPCID == 494 && NPCID == 495)
    1. I use return, to end the method, so the other method follows.
    2. I, for some reason don't like using equals signs(==) or strict type equl signs(===).
    3. I like my ways,
    YOU JUST GOT KNOCKED THE F*CK UP.
     

  8. #8  
    Registered Member

    Join Date
    Jun 2007
    Posts
    2,237
    Thanks given
    267
    Thanks received
    411
    Rep Power
    1283
    Quote Originally Posted by BFMV View Post
    Omg, this hurt my eyes no joke. Why would you use process?

    Also, if you're going to make if (sooo && thiissooo) { statements it goes like this.

    Code:
    if ((sooo) && (thissooo)) {
    //codes here
    }
    if I'm not mistaken?

    or just

    Code:
    if (sooo) && (thissooo) {
    //codes here
    }
    Not sure this one would work but probably lol.
    Code:
    if(so && soo)
    you don't need to put parenthesises over each condition unless you are using a mathematical equation.

    1. I use return, to end the method, so the other method follows.
    2. I, for some reason don't like using equals signs(==) or strict type equl signs(===).
    3. I like my ways,

    It automatically ends if there is nothing further to proces.
    Don't worry, Be happy.
     

  9. #9  
    Registered Member
    wizzyt21's Avatar
    Join Date
    Aug 2007
    Posts
    1,167
    Thanks given
    49
    Thanks received
    12
    Rep Power
    156
    Quote Originally Posted by Daniel View Post
    Code:
    if(so && soo)
    you don't need to put parenthesises over each condition unless you are using a mathematical equation.




    It automatically ends if there is nothing further to proces.
    An example of what I mean:
    Code:
    if(p.isDead && p.inDialogue) p.pDialogue.stopDialogue();
    (just an example of pking..)
    rather than doing:
    Code:
    if(p.isDead && p.inDialogue)
    {
         p.pDialogue.stopDialogue();
         return;
    }
    I use the return statement to end the sub-accessed method.
    YOU JUST GOT KNOCKED THE F*CK UP.
     

  10. #10  
    Registered Member

    Join Date
    Jun 2007
    Posts
    2,237
    Thanks given
    267
    Thanks received
    411
    Rep Power
    1283
    Quote Originally Posted by momosherilly View Post
    An example of what I mean:
    Code:
    if(p.isDead && p.inDialogue) p.pDialogue.stopDialogue();
    (just an example of pking..)
    rather than doing:
    Code:
    if(p.isDead && p.inDialogue)
    {
         p.pDialogue.stopDialogue();
         return;
    }
    I use the return statement to end the sub-accessed method.
    Wouldn't that return in the stopDialogue() method, not how your are using it?
    Sorry if i'm spamming your thread.
    Don't worry, Be happy.
     

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

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