Thread: Npc Shouts above head from CFG

Page 1 of 7 123 ... LastLast
Results 1 to 10 of 67
  1. #1 Npc Shouts above head from CFG 
    Pandora
    Guest
    made by Monte Zuma = me

    in npc handler add this voids
    Code:
    public void npcSpeech(int i, int i1, int i2, int i3, String s){
    	if (npcs[i].npcType == i1) {
    						if (misc.random2(i2) == i3) {
    							npcs[i].updateRequired = true;
    							npcs[i].textUpdateRequired = true;
    							npcs[i].textUpdate = s;
    					}
    					}
    			}
    and
    Code:
    public void npcspeech(int i){
    		String line = "";
    		String token = "";
    		String token2 = "";
    		String token2_2 = "";
    		String[] token3 = new String[10];
    		boolean EndOfFile = false;
    		int ReadMode = 0;
    		BufferedReader characterfile = null;
    		try {
    			characterfile = new BufferedReader(new FileReader("./npcspeech.cfg"));
    		} catch(FileNotFoundException fileex) {
    			misc.println("npcspeech.cfg: not found.");
    			
    		}
    		try {
    			line = characterfile.readLine();
    		} catch(IOException ioexception) {
    			misc.println("npcspeech.cfg ERROR");
    			
    		}
    		while(EndOfFile == false && line != null) {
    			line = line.trim();
    			int spot = line.indexOf("=");
    			if (spot > -1) {
    				token = line.substring(0, spot);
    				token = token.trim();
    				token2 = line.substring(spot + 1);
    				token2 = token2.trim();
    				token2_2 = token2.replaceAll("\t\t", "\t");
    				token2_2 = token2_2.replaceAll("\t\t", "\t");
    				token2_2 = token2_2.replaceAll("\t\t", "\t");
    				token2_2 = token2_2.replaceAll("\t\t", "\t");
    				token2_2 = token2_2.replaceAll("\t\t", "\t");
    				token3 = token2_2.split("\t");
    		
    
    		if(token.equals("speech")){
    			int NPCID = Integer.parseInt(token3[0]);
    			int RanNum = Integer.parseInt(token3[1]);
    			int Num = Integer.parseInt(token3[2]);
    			String s = token3[3].replaceAll("_", " ");
    		npcSpeech(i, NPCID, RanNum, Num, s);
    		}
    			} else {
    				if (line.equals("[EOF]")) {
    					try { characterfile.close(); } catch(IOException ioexception) { }
    					
    				}
    			}
    
    			try {
    				line = characterfile.readLine();
    			} catch(IOException ioexception1) { EndOfFile = true; }
    		}
    		try { characterfile.close(); } catch(IOException ioexception) { }
    		
    	}
    in misc.java if you DONT have add:
    Code:
    public static int random2(int range) { 
    		return (int)((java.lang.Math.random() * range) + 1);
    	}
    then in process inside npchandler add:
    Code:
    npcspeech(i);
    then make a file called npcspeech.cfg and add this inside:
    Code:
    //------NpcID---speed---1--------shout-----------made by monte zuma--------------------
    speech = 2244	20	1	me lumbride guide, rep monte zuma
    and ur done, u can easy add new lines and it doesnt need an reboot to make the text update, you can edit without reboot

    monte zuma
     

  2. #2  
    Community Veteran


    Join Date
    Oct 2006
    Posts
    451
    Thanks given
    5
    Thanks received
    1
    Discord
    View profile
    Rep Power
    137
    Pretty nice, can't wait to see what you come up with next.
    Est. 2006
     

  3. #3  
    project-rs owner
    Join Date
    Sep 2006
    Age
    29
    Posts
    914
    Thanks given
    4
    Thanks received
    4
    Rep Power
    49
    good job monta
     

  4. #4  
    Turbo
    Guest
    Nice Man Nice Job
     

  5. #5  
    Pandora
    Guest
    thanks guys
    have fun with it
     

  6. #6  
    Goosey gandaar
    Guest
    Lol so your reading a file every 500mms? You need to go suck ay penos sir lel
     

  7. #7  
    Registered Member Jukk's Avatar
    Join Date
    Oct 2006
    Age
    28
    Posts
    1,881
    Thanks given
    0
    Thanks received
    18
    Rep Power
    436
    really nice, repped one
     

  8. #8  
    Pandora
    Guest
    Quote Originally Posted by Jukk View Post
    really nice, repped one
    thanks good luck adding speeches
     

  9. #9  
    josh the 1st
    Guest
    Hmmm thats a new way, good too keep them servers organised and adaptable.!

    Gratz!
     

  10. #10  
    Registered Member
    Join Date
    Apr 2007
    Posts
    200
    Thanks given
    0
    Thanks received
    0
    Rep Power
    53
    Sorry, this made my computer lag, and my server. I couldn't even connect to my client =\. Nice try anyways.
    Did you know?
    You cant die from a chicken, unless its toonie tuesdays on the 13th day of the year 2010 at exactly 2:32:37 am pacific time.
     

Page 1 of 7 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
  •