Thread: NPC Transformation

Results 1 to 5 of 5
  1. #1 NPC Transformation 
    Retired. Stop PMing me.


    Galkon's Avatar
    Join Date
    Nov 2007
    Age
    17
    Posts
    7,526
    Thanks given
    1,805
    Thanks received
    2,830
    Rep Power
    5000
    Well, I don't exactly know how to go about fixing this. So, here is my bug.

    Server checks to see if NPC can transform.
    If yes, transform(when required).
    When the NPC transforms, it doesn't transform correctly. Here is the issue.

    If the first player that was online walks by an NPC that transforms(like rock crabs), then the NPC transforms into NPC 256 no matter what.

    If it's the second player that walks by, it transforms into 512, no matter what.

    If it's the third player that walks by, it transforms into 768, no matter what .

    And so on, so forth with intervals of 256.

    Code:
    Code:
    								if(transformNPC(i)) {
    									if(!npcs[i].transformed) {
    										requestTransform(i, npcs[i].npcType - 1);
    										npcs[i].walkingType = 1;
    										npcs[i].transformed = true;
    									}
    								}
    Code:
        public void requestTransform(int i, int id) {
            npcs[i].transformId = id;
            npcs[i].transformUpdateRequired = true;
            npcs[i].updateRequired = true;
        }
    Code:
    	public void appendTransformUpdate(Stream str) {
    		str.writeWordBigEndianA(transformId);
    	}
    Code:
    	public void appendNPCUpdateBlock(Stream str) {
    		if(!updateRequired)
    			return ;		
    		int updateMask = 0;
    		if(animUpdateRequired)
    			updateMask |= 0x10;
    		if(hitUpdateRequired2)
    			updateMask |= 8;
    		if(transformUpdateRequired)
    			updateMask |= 0x2;
    		if(mask80update)
    			updateMask |= 0x80;
    		if(dirUpdateRequired)
    			updateMask |= 0x20;
    		if(forcedChatRequired)
    			updateMask |= 1;
    		if(hitUpdateRequired)
    			updateMask |= 0x40;	
    		if(FocusPointX != -1)
    			updateMask |= 4;
    			
    		str.writeByte(updateMask);
    		if (animUpdateRequired)
    			appendAnimUpdate(str);
    		if (hitUpdateRequired2)
    			appendHitUpdate2(str);
    		if (transformUpdateRequired)
    			appendTransformUpdate(str);
    		if (mask80update)
    			appendMask80Update(str);
    		if (dirUpdateRequired)
    			appendFaceEntity(str);
    		if(forcedChatRequired) {
    			str.writeString(forcedText);
    		}
    		if (hitUpdateRequired)
    			appendHitUpdate(str);
    		if(FocusPointX != -1)
    			appendSetFocusDestination(str);
    	}
    And yes I am aware the hit masks are mixed up thanks.

    Any ideas?

    EDIT: It also isn't my client, because I tried it with moparscape 3.2 and it did the same thing(froze the client). My client just doesn't freeze when it errors, so I can see the error itself.
    Attached image
     

  2. #2  
    NPC Transformation



    Scu11's Avatar
    Join Date
    Aug 2007
    Age
    30
    Posts
    16,307
    Thanks given
    7,215
    Thanks received
    12,308
    Rep Power
    5000
    You have the wrong order?

    Code:
    		if (flags.get(UpdateFlag.ANIMATION)) {
    			mask |= 0x10;
    		}
    		if (flags.get(UpdateFlag.HIT)) {
    			mask |= 0x8;
    		}
    		if (flags.get(UpdateFlag.GRAPHICS)) {
    			mask |= 0x80;
    		}
    		if (flags.get(UpdateFlag.FACE_ENTITY)) {
    			mask |= 0x20;
    		}
    		if (flags.get(UpdateFlag.FORCED_CHAT)) {
    			mask |= 0x1;
    		}
    		if (flags.get(UpdateFlag.HIT_2)) {
    			mask |= 0x40;
    		}
    		if (flags.get(UpdateFlag.TRANSFORM)) {
    			mask |= 0x2;
    		}
    		if (flags.get(UpdateFlag.FACE_COORDINATE)) {
    			mask |= 0x4;
    		}

    Attached image
     

  3. #3  
    Registered Member

    Join Date
    Jan 2008
    Age
    31
    Posts
    1,380
    Thanks given
    76
    Thanks received
    384
    Rep Power
    962
    The client reads the mask with just 2 you have 0x2 and more then likely the wrong order.
     

  4. #4  
    Retired. Stop PMing me.


    Galkon's Avatar
    Join Date
    Nov 2007
    Age
    17
    Posts
    7,526
    Thanks given
    1,805
    Thanks received
    2,830
    Rep Power
    5000
    Ugh I thought I fixed the order :facepalm:, thanks guys lol hold on a second, I'll try both of those.

    EDIT: Long, hard facepalm. Fixed. Rofl thanks Scu11 for spotting my idiocy, and I love you very muchly and we need to anal some time soon.
    Attached image
     

  5. #5  
    Member NPC Transformation Market Banned


    Luke132's Avatar
    Join Date
    Dec 2007
    Age
    35
    Posts
    12,574
    Thanks given
    199
    Thanks received
    7,106
    Rep Power
    5000
    Have you looked clientside to see if there's a packet/formula you have to send to reset the variables the mask uses..? That's what i'd do in this situation..

    Attached imageAttached image
     


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
  •