Thread: How do I disable combat in pi?

Results 1 to 5 of 5
  1. #1 How do I disable combat in pi? 
    Registered Member
    Join Date
    Jun 2014
    Posts
    7
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    I'm new to coding and trying to understand how the servers work. I'm in progress of making a quest and I found how to disable walking, but when you click on a npc to attack, the player will walk to it and engage in combat. I want to disable this alltogether.

    I tried putting something along the lines of

    Code:
    if(c.combatEnabled = true) {
    //do sheyt
    }
    in combatAssistant.java, clickNPC.java and attackNPC.java and I never got any errors but it just didn't work.

    I really felt that it should work here but it didn't. Attacknpc.java

    Code:
    public static void attackNpc(Client c, int i) {		
    		if (NPCHandler.npcs[i] != null) {
    			if (NPCHandler.npcs[i].isDead || NPCHandler.npcs[i].MaxHP <= 0) {
    				c.usingMagic = false;
    				c.faceUpdate(0);
    				c.npcIndex = 0;
    				return;
    			}
    			if(c.respawnTimer > 0) {
    				c.npcIndex = 0;
    				return;
    			}
    			if (NPCHandler.npcs[i].underAttackBy > 0 && NPCHandler.npcs[i].underAttackBy != c.playerId && !NPCHandler.npcs[i].inMulti()) {
    				c.npcIndex = 0;
    				c.sendMessage("This monster is already in combat.");
    				return;
    if(c.combatEnabled = false) {
    c.sendMessage("You cannot fight right now");
    return;
    }
    What am I doing wrong here? I'm still a total noob at this, sry if it's a stupid question.

    QUESTION 2

    I edited the text of a quest and figured out how to make it change colors depending on the stage of the quest, but when you move to the next stage you need to relog for the color to update (red to yellow i.e.). Is this a client error? How can I make the text update instantly?

    Thank you.
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Jun 2014
    Posts
    7
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Quote Originally Posted by Belz View Post
    Code:
    if (!c.combatEnabled) {
        c.sendMessage("You cannot fight right now.");
        return;
    }
    It worked! Though why? Isnt the code identical? D:
    Reply With Quote  
     

  3. #3  
    wip, just like you :^)

    blj_'s Avatar
    Join Date
    Sep 2007
    Posts
    89
    Thanks given
    93
    Thanks received
    45
    Rep Power
    105
    Quote Originally Posted by entropy View Post
    QUESTION 2

    I edited the text of a quest and figured out how to make it change colors depending on the stage of the quest, but when you move to the next stage you need to relog for the color to update (red to yellow i.e.). Is this a client error? How can I make the text update instantly?
    All you need to do is when you progress for the first time in the quest (when it should change yellow for the first time) where ever you change the quest stage add something like(sendquest/sendstring/sendframe126 - idk anymore)
    Code:
    sendString("@yel@quest", id);
    And do the same for when you finish the quest but of course make the text green.

    However if you're like me and find the hover-colour important you can find a nice thread here - http://www.rune-server.org/runescape...ver-color.html
    hi
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Jun 2014
    Posts
    7
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Quote Originally Posted by edwood View Post
    All you need to do is when you progress for the first time in the quest (when it should change yellow for the first time) where ever you change the quest stage add something like(sendquest/sendstring/sendframe126 - idk anymore)
    Code:
    sendString("@yel@quest", id);
    And do the same for when you finish the quest but of course make the text green.

    However if you're like me and find the hover-colour important you can find a nice thread here - http://www.rune-server.org/runescape...ver-color.html
    This was more educational than expected. Thank you!!
    Reply With Quote  
     

  5. #5  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Posts
    6,092
    Thanks given
    2,402
    Thanks received
    2,823
    Rep Power
    4550
    Quote Originally Posted by entropy View Post
    It worked! Though why? Isnt the code identical? D:
    No, it's not identical. The symbol '=' is for assignment, where as the conjunction of symbols '==' is used for determining equivalency.

    Code:
    boolean combatEnabled = true; //correct because we are initializing a class member
    Code:
    boolean combatEnabled == true; //incorrect because we're initialize, not comparing
    Code:
    if (combatEnabled == true) //correct because we're comparing the state of the variable to that of true
    Code:
    if (combatEnabled = true) //incorrect because we're comparing, not assigning
    Reply With Quote  
     


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. Replies: 5
    Last Post: 03-02-2014, 10:29 PM
  2. Replies: 5
    Last Post: 04-20-2012, 11:47 PM
  3. How do i disable only staking? [pi]
    By Anthony in forum Help
    Replies: 2
    Last Post: 05-22-2011, 02:51 PM
  4. Replies: 0
    Last Post: 04-22-2011, 03:03 AM
  5. Replies: 6
    Last Post: 09-11-2010, 08:42 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
  •