Thread: Vencillio readvalues problem

Results 1 to 7 of 7
  1. #1 Vencillio readvalues problem 
    Banned
    Join Date
    Sep 2017
    Posts
    340
    Thanks given
    24
    Thanks received
    30
    Rep Power
    0
    Can someone please help me sort this out? :/

    Error i get.
    Code:
    npc def invalid opcode: 255
    EntityDef Readvalues
    Code:
    public void readValues(Buffer stream) {
    		while (true) {
    			int opcode = stream.readUByte();
    			if (opcode == 0) {
    				return;
    			} else if (opcode == 1) {
    				int len = stream.readUByte();
    				models = new int[len];
    				for (int i = 0; i < len; i++) {
    					models[i] = stream.readUShort();
    				}
    
    			} else if (opcode == 2) 
    				name = stream.readString();
    			else if (opcode == 3) 
    				description = stream.readBytes();
    			else if (opcode == 12)
    				aByte68 = stream.readSignedByte();
    			else if (opcode == 13)
    				standAnim = stream.readUShort();
    			else if (opcode == 14)
    				walkAnim = stream.readUShort();
    			else if (opcode == 17) {
    				walkAnim = stream.readUShort();
    				anInt58 = stream.readUShort();
    				anInt83 = stream.readUShort();
    				anInt55 = stream.readUShort();
    			} else if (opcode >= 30 && opcode < 40) {
    				if (actions == null)
    					actions = new String[5];
    				actions[opcode - 30] = stream.readString();
    				if (actions[opcode - 30].equalsIgnoreCase("hidden"))
    					actions[opcode - 30] = null;
    			} else if (opcode == 40) {
    				int k = stream.readUByte();
    				anIntArray76 = new int[k];
    				anIntArray70 = new int[k];
    				for (int k1 = 0; k1 < k; k1++) {
    					anIntArray76[k1] = stream.readUShort();
    					anIntArray70[k1] = stream.readUShort();
    				}
    				
    			} else if (opcode == 41) {
    				int len = stream.readUByte();
    
    				for (int i = 0; i < len; i++) {
    					stream.readUShort(); // textures
    					stream.readUShort();
    				}
    
    			} else if (opcode == 60) {
    				int l = stream.readUByte();
    				anIntArray73 = new int[l];
    				for (int l1 = 0; l1 < l; l1++)
    					anIntArray73[l1] = stream.readUShort();
    
    			} else if (opcode == 90)
    				stream.readUShort();
    			else if (opcode == 91)
    				stream.readUShort();
    			else if (opcode == 92)
    				stream.readUShort();
    			else if (opcode == 93)
    				aBoolean87 = false;
    			else if (opcode == 95)
    				combatLevel = stream.readUShort();
    			else if (opcode == 97)
    				anInt91 = stream.readUShort();
    			else if (opcode == 98)
    				anInt86 = stream.readUShort();
    			else if (opcode == 99)
    				aBoolean93 = true;
    			else if (opcode == 100)
    				anInt85 = stream.readSignedByte();
    			else if (opcode == 101)
    				anInt92 = stream.readSignedByte() * 5;
    			else if (opcode == 102) {
    				anInt75 = stream.readUShort();
    		} else if (opcode == 103) {
    				anInt79 = stream.readUShort();
    		  } else if (opcode == 106 || opcode == 118) {
    			anInt57 = stream.readUShort();
    			
    			if (anInt57 == 65535) { //anInt57 = Varbit
    				anInt57 = -1;
    			}
    			anInt59 = stream.readUShort();
    			
    			if (anInt59 == 65535) {
    				anInt59 = -1;
    			}
    			
    			int value = -1;
    			
    			if (opcode == 118) {
                    value = stream.readUShort();
                }
    				
    			int len = stream.readUByte();
    			childrenIDs = new int[len + 2];
    			for (int i = 0; i <= len; i++) {
    				childrenIDs[i] = stream.readUShort();
    				if (childrenIDs[i] == 65535) {
    					childrenIDs[i] = -1;
    			}
    		}
    		childrenIDs[len + 1] = value;
    	} else if (opcode == 107) {
    		aBoolean84 = false;
    	} else if (opcode == 109) {
    		//TODO
    	} else {
            System.out.println(String.format("npc def invalid opcode: %d", opcode));
    	}
    }
    }
    Reply With Quote  
     

  2. #2  
    Registered Member Brainpower's Avatar
    Join Date
    Jan 2019
    Posts
    118
    Thanks given
    12
    Thanks received
    6
    Rep Power
    60
    You need to read all opcodes correctly, let's say you remove 1x stream.readUShort on correctly working readvalues it'll break the entire
    thing and cause issues like yours.

    You either
    A) use a readvalues method that comes from a different revision than the data you're using
    B) decided to remove reading the Stream in one of the opcodes (Maybe 109?)
    Reply With Quote  
     

  3. #3  
    Banned
    Join Date
    Sep 2017
    Posts
    340
    Thanks given
    24
    Thanks received
    30
    Rep Power
    0
    Quote Originally Posted by Brainpower View Post
    You need to read all opcodes correctly, let's say you remove 1x stream.readUShort on correctly working readvalues it'll break the entire
    thing and cause issues like yours.

    You either
    A) use a readvalues method that comes from a different revision than the data you're using
    B) decided to remove reading the Stream in one of the opcodes (Maybe 109?)
    Yea i know but can't figure this out maybe if someone post their read values i can fix it.
    Reply With Quote  
     

  4. #4  
    Registered Member Brainpower's Avatar
    Join Date
    Jan 2019
    Posts
    118
    Thanks given
    12
    Thanks received
    6
    Rep Power
    60
    Quote Originally Posted by replicant View Post
    Yea i know but can't figure this out maybe if someone post their read values i can fix it.
    ReadValues differ per revision so you'd need to specify which revision data you're using
    Reply With Quote  
     

  5. #5  
    Banned
    Join Date
    Sep 2017
    Posts
    340
    Thanks given
    24
    Thanks received
    30
    Rep Power
    0
    Quote Originally Posted by Brainpower View Post
    ReadValues differ per revision so you'd need to specify which revision data you're using
    179,2
    Reply With Quote  
     

  6. #6  
    Respected Member

    Join Date
    Jan 2009
    Posts
    5,670
    Thanks given
    1,080
    Thanks received
    3,402
    Rep Power
    5000
    Quote Originally Posted by replicant View Post
    179,2

    you'll need to know what tool was used to dump the definition, then match it.
    Reply With Quote  
     

  7. #7  
    Banned
    Join Date
    Sep 2017
    Posts
    340
    Thanks given
    24
    Thanks received
    30
    Rep Power
    0
    Quote Originally Posted by Spooky View Post
    you'll need to know what tool was used to dump the definition, then match it.
    I just used released data from sgsrocks probably.
    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. Vencillio Cache problem
    By Runesupremacy1 in forum Help
    Replies: 6
    Last Post: 11-24-2017, 05:12 PM
  2. Vencillio moving problem
    By Sami2427 in forum Help
    Replies: 4
    Last Post: 01-30-2017, 10:51 PM
  3. vencillio NPC problem
    By anc13nt pure in forum Help
    Replies: 4
    Last Post: 06-24-2016, 06:30 PM
  4. Vencillio npc problem
    By Ellison in forum Help
    Replies: 6
    Last Post: 06-01-2016, 07:19 AM
  5. Vencillio Error Problem NEED HELP!!!
    By darkening in forum Help
    Replies: 3
    Last Post: 05-11-2016, 08:30 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
  •