HomePortalFAQSearchMemberlistUsergroupsRegisterLog in
Meet the new KITO admins & hear their plans here.
You can use google search to find threads and posts here now. Example

Share | 
 

 'Index out of bounds' error

View previous topic View next topic Go down 
AuthorMessage
Cloud
Texture Artist
Texture Artist
avatar

Game username : Cloud, Daydream
Server : None
Female Posts : 614
Join date : 2014-07-22
Location : Under your bed

PostSubject: 'Index out of bounds' error    Wed Sep 30, 2015 7:14 pm

Okay, I moved to a thread so I don't clog up Hyper's post.

I am using the broken bottom teeth fix for 3D teeth. I have the code set not to apply to my three heads with flat teeth - 1, 5, and 7. They only have 1 submesh, and Hyper's fix sets the 2nd submesh to be read, which those heads don't have, so therefore I crash. It gives me the 'index out of bounds' error.

I don't know why it's erroring if the code is set not to apply to the heads without 3D teeth. Here is the modified code from Hyper's fix that I used to get the broken bottom teeth fix:

All in MagixUnit
Code:
mBodyEnt->setMaterialName(tBodyMat);
      mHeadEnt->getSubEntity(0)->setMaterialName(tHeadMat);
      mHeadEnt->getSubEntity(1)->setMaterialName("TeethMat/TWOSIDE");
      mHeadEnt->getSubEntity(2)->setMaterialName("EyeModColour");
      if (getHeadID() != "1" || getHeadID() != "5" || getHeadID() != "7")mHeadEnt->getSubEntity(3)->setMaterialName("TeethMat/TWOSIDE");
      if(mManeEnt)mManeEnt->setMaterialName("ManeModColour");
      mTailEnt->setMaterialName(tTailMat);
      if(mWingEnt)mWingEnt->setMaterialName(tWingMat);
      if(mTuftEnt)mTuftEnt->setMaterialName("ManeModColour");

Code:
mBodyEnt->setMaterialName(tBodyMat);
      mHeadEnt->getSubEntity(0)->setMaterialName(tHeadMat);
      mHeadEnt->getSubEntity(1)->setMaterialName(tTeethMat);
      mHeadEnt->getSubEntity(2)->setMaterialName(tEyeMat);
      if (getHeadID() != "1" || getHeadID() != "5" || getHeadID() != "7")mHeadEnt->getSubEntity(3)->setMaterialName(tTeethMat);
      if(mManeEnt)mManeEnt->setMaterialName(tManeMat);
      mTailEnt->setMaterialName(tTailMat);
      if(mWingEnt)mWingEnt->setMaterialName(tWingMat);
      if(mTuftEnt)mTuftEnt->setMaterialName(tManeMat);

Code:
virtual bool isIndexedUnit()
  {
      return false;
  }
    String getHeadID()
  {
    String headMeshID = mHeadEnt->getMesh()->getName();
      headMeshID.erase(0, 4);
      headMeshID.erase(headMeshID.find_first_of("."), 5);
      return headMeshID;
  }
};

#endif

Since heads 1, 5, and 7 aren't set to read the second submesh I have no idea why it's crashing. If anyone could help me out with this, I'd be appreciative. c:
Back to top Go down
Cloud
Texture Artist
Texture Artist
avatar

Game username : Cloud, Daydream
Server : None
Female Posts : 614
Join date : 2014-07-22
Location : Under your bed

PostSubject: Re: 'Index out of bounds' error    Sun Oct 04, 2015 12:17 am

Posted this a couple days ago so I'm going to bump it. c:
Back to top Go down
Nakti
®
®
avatar

Game username : Nakti
Server : World of Pandora
Female Posts : 164
Join date : 2012-08-24
Age : 22
Location : black celebration

PostSubject: Re: 'Index out of bounds' error    Mon Oct 05, 2015 2:02 pm

Did you try to remove this code:
Code:
if (getHeadID() != "1" || getHeadID() != "5" || getHeadID() != "7")
with this one:
Code:
if (getHeadID() != "1" && getHeadID() != "5" && getHeadID() != "7")
?
Back to top Go down
Cloud
Texture Artist
Texture Artist
avatar

Game username : Cloud, Daydream
Server : None
Female Posts : 614
Join date : 2014-07-22
Location : Under your bed

PostSubject: Re: 'Index out of bounds' error    Mon Oct 05, 2015 7:09 pm

Thanks Nakti, that worked! It doesn't crash when I try to create a new character with head 1 as the default and 5 and 7 work also. Thanks to Hyper for posting the fix as well <3

This can be moved to Solved!
Back to top Go down
Sponsored content




PostSubject: Re: 'Index out of bounds' error    

Back to top Go down
 
'Index out of bounds' error
View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Keeping I.T. Open :: SUPPORT :: Support-
Jump to: