Thread: does anyone know how to make it work on delta ?

Results 1 to 2 of 2
  1. #1 does anyone know how to make it work on delta ? 
    Registered Member


    Join Date
    May 2008
    Posts
    710
    Thanks given
    42
    Thanks received
    21
    Rep Power
    323
    Quote Originally Posted by hayzie View Post
    Description: Change the face direction from south to anything you want on different npcs.

    Difficulty: 2.

    Assumed Knowledge: how to declare and read.

    Tested Server: cleaned v3 and v4. should work on most

    Files/Classes Modified: NPC and NPCHandler.

    Step 1:
    In your NPC class make sure you have the following methods or something that looks similar, if not just add them.

    first declare these
    Code:
    public int focusPointX, focusPointY;
    public boolean turnUpdateRequired;
    Code:
    public void turnNpc(int i, int j) {
        focusPointX = 2 * i + 1;
        focusPointY = 2 * j + 1;
        updateRequired = true;
        turnUpdateRequired = true;
    }
    Code:
    private void appendSetFocusDestination(stream str) {
        str.writeWordBigEndian(focusPointX);
        str.writeWordBigEndian(focusPointY);
    }
    Step 2:
    go to your appendNPCUpdateBlock method add the text in green in the exact position.
    Code:
    public void appendNPCUpdateBlock(stream str) {
        if(!updateRequired) return ;
        int updateMask = 0;
        if(textUpdateRequired) updateMask |= 1;
        if(animUpdateRequired) updateMask |= 0x10;
        if(hitUpdateRequired) updateMask |= 0x40;
        if(dirUpdateRequired) updateMask |= 0x20;
        if(faceToUpdateRequired) updateMask |= 0x20;
        if(turnUpdateRequired) updateMask |= 4;		
    			
        str.writeByte(updateMask);
    				
        if(textUpdateRequired) {
            str.writeString(textUpdate);
        }
        if (animUpdateRequired) appendAnimUpdate(str);
        if (hitUpdateRequired) appendHitUpdate(str);
        if (dirUpdateRequired) appendDirUpdate(str);
        if (faceToUpdateRequired) appendFaceToUpdate(str);
        if(turnUpdateRequired) appendSetFocusDestination(str);		
    }
    under the clearUpdateFlags method add
    Code:
    focusPointX = -1; 
    focusPointY = -1; 
    turnUpdateRequired = false;
    Step 3:
    Save and close your NPC class.

    Open your NPCHandler and search for
    Code:
    process()
    then under
    Code:
    for (int i = 0; i < maxNPCs; i++) {
        if (npcs[i] != null) {
            if (npcs[i].actionTimer > 0) {
                npcs[i].actionTimer--;
            }
    add
    Code:
    if (npcs[i].walkingType == 0) {
        switch(npcs[i].npcType) {
            case 494: // banker
            /** 
            * absX and absY of a specific npc you want to change face direction, 
            * if you want all the npcs of the same type to  face 
            * the same direction remove it
            **/
            if(npcs[i].absX == 3256 && npcs[i].absY == 3418) { 
    
            /** 
             * this turns the npc 
             * +1 to absX makes the npc face east, 
             * -1 to absX makes it face west. 
             * +1 to absY makes it face north and 
             * -1 to absY makes it face south.
             **/
                npcs[i].turnNpc(npcs[i].absX, npcs[i].absY+1); 
    
             }
    	  break;
    
             default: // applies to all npc who are only standing, remove if not needed
    	  npcs[i].turnNpc(npcs[i].absX, npcs[i].absY+1); 
    	  break;				
        }
    }
    compile and hopefully it works for you
    Picture:


    Remember: to change your autospawn to the walking type is set to "0"

    Credits: me i guess

    Does anyone know how to make it work on delta ?
    Reply With Quote  
     

  2. #2  
    Client Developer

    Pb600's Avatar
    Join Date
    Dec 2008
    Posts
    2,153
    Thanks given
    259
    Thanks received
    472
    Rep Power
    925
    I want too for me not working...
    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

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