Thread: [PI] Npc forced movement mask

Results 1 to 3 of 3
  1. #1 [PI] Npc forced movement mask 
    Donator
    clrlslwi's Avatar
    Join Date
    Mar 2016
    Posts
    201
    Thanks given
    32
    Thanks received
    108
    Rep Power
    102


    SERVER
    NPC.java
    Add the following fields
    Code:
    public boolean forcedMovementUpdateRequired;
    public int forcedMoveStartX;
    public int forcedMoveStartY;
    public int forcedMoveEndX;
    public int forcedMoveEndY;
    public int forcedMoveCycleStart;
    public int forcedMoveCycleEnd;
    public int forcedMoveDirection;

    Add the following methods
    Code:
    	public void appendForcedMovementUpdate(Stream str) {
    		str.writeByte(forcedMoveStartX);
    		str.writeByte(forcedMoveStartY);
    		str.writeByte(forcedMoveEndX);
    		str.writeByte(forcedMoveEndY);
    		str.writeWord(forcedMoveCycleStart);
    		str.writeWord(forcedMoveCycleEnd);
    		str.writeByte(forcedMoveDirection);
    	}
    Code:
    	public void forceMovement(int startX, int startY, int endX, int endY, int cycleStart, int cycleEnd, int direction) {
    		this.forcedMoveStartX = startX;
    		this.forcedMoveStartY = startY;
    		this.forcedMoveEndX = endX;
    		this.forcedMoveEndY = endY;
    		this.forcedMoveCycleStart = cycleStart;
    		this.forcedMoveCycleEnd = cycleEnd;
    		this.forcedMoveDirection = direction;
    		this.forcedMovementUpdateRequired = true;
    		this.updateRequired = true;
    	}


    appendNPCUpdateBlock (still npc.java)
    Add
    Code:
    if (forcedMovementUpdateRequired)
    	updateMask |= 0x100;
    right above
    Code:
    if (animUpdateRequired)
    	updateMask |= 0x10;


    Change
    Code:
    str.writeByte(updateMask);
    to
    Code:
    str.writeWord(updateMask);


    Add
    Code:
    if (forcedMovementUpdateRequired)
    	appendForcedMovementUpdate(str);
    right above
    Code:
    if (animUpdateRequired)
    	appendAnimUpdate(str);


    clearUpdateFlags(still npc.java)
    Add
    Code:
    forcedMovementUpdateRequired = false;
    somewhere

    CLIENT
    Method86 in client.java

    Change
    Code:
    int l = stream.readUnsignedByte();
    to
    Code:
    int l = stream.readUnsignedWord();


    Right above
    Code:
    if((l & 0x10) != 0)
    add
    Code:
    if((l & 0x100) != 0)
    {
    	npc.anInt1543 = stream.readUnsignedByte();
    	npc.anInt1545 = stream.readUnsignedByte();
    	npc.anInt1544 = stream.readUnsignedByte();
    	npc.anInt1546 = stream.readUnsignedByte();
    	npc.anInt1547 = stream.readUnsignedWord() + loopCycle;
    	npc.anInt1548 = stream.readUnsignedWord() + loopCycle;
    	npc.anInt1549 = stream.readUnsignedByte();
    	npc.method446();
    }


    Command for testing it works
    Code:
    if (playerCommand.equals("testforcemove")) {
    	for (NPC npc : NPCHandler.npcs) {
    		if (npc != null) {
    			int dx = npc.absX - (c.mapRegionX * 8);
    			int dy = npc.absY - (c.mapRegionY * 8);
    			npc.forceMovement(dx, dy, dx, dy + 5, 0, 30, 2);
    		}
    	}
    }
    Reply With Quote  
     

  2. #2  
    The One And Only

    01053's Avatar
    Join Date
    Apr 2011
    Age
    25
    Posts
    2,888
    Thanks given
    416
    Thanks received
    884
    Rep Power
    856
    Good job, this will definitely be useful.


    Reply With Quote  
     

  3. #3  
    Registered Member
    Stanaveli's Avatar
    Join Date
    Aug 2014
    Posts
    1,489
    Thanks given
    179
    Thanks received
    651
    Rep Power
    1311
    Goodjob
    ~No honour among thieves.



    [Only registered and activated users can see links. ]

    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. Npc Force Movement
    By God in forum Help
    Replies: 12
    Last Post: 06-03-2011, 04:24 AM
  2. Force Movement Mask
    By Scu11 in forum Snippets
    Replies: 11
    Last Post: 01-25-2011, 04:42 AM
  3. 5$ PI npc force chat
    By Chris SS in forum Requests
    Replies: 9
    Last Post: 10-31-2010, 01:34 AM
  4. 613 Player Force Movement mask
    By mgi125 in forum Configuration
    Replies: 19
    Last Post: 10-03-2010, 11:48 PM
  5. Forced movement mask.
    By Brown in forum Requests
    Replies: 1
    Last Post: 10-31-2009, 07:48 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
  •