Thread: Loading Npc Defense Bonuses Through CFG!

Page 1 of 4 123 ... LastLast
Results 1 to 10 of 32
  1. #1 Loading Npc Defense Bonuses Through CFG! 
    Registered Member
    Unique's Avatar
    Join Date
    May 2008
    Posts
    457
    Thanks given
    0
    Thanks received
    1
    Rep Power
    164
    Purpose: This is a method that loads NPC defense bonuses through a configuration file. Note: I do not yet have this actually working in combat yet but I will soon and I will release it. This is to make certain NPC's harder to kill than others. E.G. A level 10 can hit the same on jad as he can on a regular man, This will will stop that.

    Difficulty: 2/10

    Base: Secret =D

    Knowledge: C & P and bits of Java

    Classes Modified: NPC.java

    Step 1:
    In bin > data > npcs > create a new file and name it "NPCDef.cfg".

    Step 2:
    Go into NPC.java and paste this method:

    Code:
        public int unpackBonuses(int npcId) throws Exception {
            int bonuse = 0;
            BufferedReader in = new BufferedReader(new FileReader("./data/npcs/npcdef.cfg"));
            String[] NPCDef;
            String input;
            while ((input = in.readLine()) != null) {
                NPCDef = null;
                if (!input.startsWith("/") && input.contains("=")) {
                    NPCDef = input.split("=");
                    if (NPCDef[0].startsWith("" + npcId)) {
                        bonuse = Integer.parseInt(NPCDef[1]);
                    }
                }
            }
            return bonuse;
        }
    Step 3:
    Paste this in you NPCDef.cfg:

    Code:
    //npcType=DefBonuse
    Step 4:
    For example you want a man to have 15 def bonuse, You would put:

    Code:
    2=15
    In you're CFG file.

    How this method works is, It will identify the NPC's Id and return the bonuse as an Int.

    Please comment!
    Rs-kings
     

  2. #2  
    Aza
    Aza is offline
    Banned

    Join Date
    May 2008
    Posts
    2,583
    Thanks given
    99
    Thanks received
    22
    Rep Power
    0
    Nice job of loading this. I load it threw a switch statement to load this lol, I'm a change now tho. Thanks
     

  3. #3  
    Registered Member
    Unique's Avatar
    Join Date
    May 2008
    Posts
    457
    Thanks given
    0
    Thanks received
    1
    Rep Power
    164
    No Problem (Mts).
    Rs-kings
     

  4. #4  
    Registered Member
    X Mercy X's Avatar
    Join Date
    May 2009
    Age
    28
    Posts
    1,336
    Thanks given
    3
    Thanks received
    41
    Rep Power
    301
    nice work well needed lol
     

  5. #5  
    Community Veteran



    Join Date
    Jan 2008
    Posts
    3,448
    Thanks given
    46
    Thanks received
    973
    Rep Power
    4723
    it wud be better to implant it into the npcinfo file

     

  6. #6  
    Registered Member
    Unique's Avatar
    Join Date
    May 2008
    Posts
    457
    Thanks given
    0
    Thanks received
    1
    Rep Power
    164
    I was thinking about implanting it into the npclist.cfg but, It would take to much work changing the data in the cfg file up.
    Rs-kings
     

  7. #7  
    Community Veteran



    Join Date
    Jan 2008
    Posts
    3,448
    Thanks given
    46
    Thanks received
    973
    Rep Power
    4723
    Quote Originally Posted by Slow Poke View Post
    I was thinking about implanting it into the npclist.cfg but, It would take to much work changing the data in the cfg file up.
    might be worth u 2 do it as once dun it will be easy to add more in the future

     

  8. #8  
    Registered Member
    Unique's Avatar
    Join Date
    May 2008
    Posts
    457
    Thanks given
    0
    Thanks received
    1
    Rep Power
    164
    Hmm, I may try it. But... Richard, do you have a method that initiates the NPC def bonuses in combat? So that It will hit less depending on you're attacking bonus and max hits and stuff? If you do could I please have it as I honestly suck at math.
    Rs-kings
     

  9. #9  
    Donator

    iZAjz's Avatar
    Join Date
    Mar 2007
    Age
    26
    Posts
    3,675
    Thanks given
    105
    Thanks received
    47
    Rep Power
    1882
    Nice i guess
     

  10. #10  
    Community Veteran



    Join Date
    Jan 2008
    Posts
    3,448
    Thanks given
    46
    Thanks received
    973
    Rep Power
    4723
    Quote Originally Posted by Slow Poke View Post
    Hmm, I may try it. But... Richard, do you have a method that initiates the NPC def bonuses in combat? So that It will hit less depending on you're attacking bonus and max hits and stuff? If you do could I please have it as I honestly suck at math.
    Na look at the player one

     

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